src/share/classes/sun/applet/AppletPanel.java
Print this page
*** 792,814 ****
if (code != null) {
applet = (Applet)loader.loadCode(code).newInstance();
doInit = true;
} else {
// serName is not null;
! InputStream is = (InputStream)
! java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction() {
! public Object run() {
! return loader.getResourceAsStream(serName);
! }
! });
! ObjectInputStream ois =
! new AppletObjectInputStream(is, loader);
! Object serObject = ois.readObject();
! applet = (Applet) serObject;
doInit = false; // skip over the first init
}
// Determine the JDK level that the applet targets.
// This is critical for enabling certain backward
// compatibility switch if an applet is a JDK 1.1
// applet. [stanley.ho]
--- 792,809 ----
if (code != null) {
applet = (Applet)loader.loadCode(code).newInstance();
doInit = true;
} else {
// serName is not null;
! try (InputStream is = AccessController.doPrivileged(
! (PrivilegedAction<InputStream>)() -> loader.getResourceAsStream(serName));
! ObjectInputStream ois = new AppletObjectInputStream(is, loader)) {
!
! applet = (Applet) ois.readObject();
doInit = false; // skip over the first init
}
+ }
// Determine the JDK level that the applet targets.
// This is critical for enabling certain backward
// compatibility switch if an applet is a JDK 1.1
// applet. [stanley.ho]
*** 1237,1260 ****
name = name.replace('.', '/');
// append .class
final String resourceName = name + ".class";
- InputStream is = null;
byte[] classHeader = new byte[8];
! try {
! is = (InputStream) java.security.AccessController.doPrivileged(
! new java.security.PrivilegedAction() {
! public Object run() {
! return loader.getResourceAsStream(resourceName);
! }
! });
// Read the first 8 bytes of the class file
int byteRead = is.read(classHeader, 0, 8);
- is.close();
// return if the header is not read in entirely
// for some reasons.
if (byteRead != 8)
return;
--- 1232,1248 ----
name = name.replace('.', '/');
// append .class
final String resourceName = name + ".class";
byte[] classHeader = new byte[8];
! try (InputStream is = AccessController.doPrivileged(
! (PrivilegedAction<InputStream>) () -> loader.getResourceAsStream(resourceName))) {
// Read the first 8 bytes of the class file
int byteRead = is.read(classHeader, 0, 8);
// return if the header is not read in entirely
// for some reasons.
if (byteRead != 8)
return;