when i run the code below
- in the Applet on JRE8, in the line con.getInputStream () it throws an exception
- in the applet on JRE7 or JRE6 he does not drop.
- in the desktop application on any JRE he does not drop.
when I delete the lines it starts with setRequestPropery , it does not throw an exception in any JRE.
URLConnection con = new URL(adress).openConnection();
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type",
"application/octet-stream");
con.setRequestProperty("pragma:", "no-cache");
PrintStream ps = new PrintStream(con.getOutputStream());
ps.println("Test");
ps.close();
in = new DataInputStream(conn.getInputStream());
An exception:
java.lang.IllegalArgumentException: invalid actions string
at java.net.URLPermission.init(Unknown Source)
at java.net.URLPermission.<init>(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.URLtoSocketPermission(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
In my applet, I am trying to open a connection, and I need these request properties.
Do you know what causes this exception in JRE8? and why only in the applet, and not in the desktopapp.