aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/icedteanp
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/icedteanp')
-rw-r--r--plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java5
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java220
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletViewer.java70
3 files changed, 190 insertions, 105 deletions
diff --git a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java
index bba1e8a..9120155 100644
--- a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java
+++ b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java
@@ -403,7 +403,7 @@ public class MethodOverloadResolver {
}
}
- return matchingConstructors.toArray(new Constructor[0]);
+ return matchingConstructors.toArray(new Constructor<?>[0]);
}
private static Class<?> getPrimitiveType(Class<?> c) {
@@ -435,8 +435,9 @@ public class MethodOverloadResolver {
private static boolean isNumericString(Object o) {
// At this point, it _has_ to be a string else automatically
// return false
- if (!(o instanceof java.lang.String))
+ if (!(o instanceof java.lang.String)) {
return false;
+ }
try {
Long.parseLong((String) o); // whole number test
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
index 2fc42d8..3686419 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java
@@ -68,7 +68,7 @@ import netscape.javascript.JSUtil;
class Signature {
private String signature;
private int currentIndex;
- private List<Class> typeList;
+ private List<Class<?>> typeList;
private static final char ARRAY = '[';
private static final char OBJECT = 'L';
private static final char SIGNATURE_ENDCLASS = ';';
@@ -136,18 +136,20 @@ class Signature {
public Signature(String signature, ClassLoader cl) {
this.signature = signature;
currentIndex = 0;
- typeList = new ArrayList<Class>(10);
+ typeList = new ArrayList<Class<?>>(10);
String elem;
while (currentIndex < signature.length()) {
elem = nextTypeName();
- if (elem == null) // end of signature
+ if (elem == null) {
continue;
+ }
- Class primitive = primitiveNameToType(elem);
- if (primitive != null)
+ Class<?> primitive = primitiveNameToType(elem);
+ if (primitive != null) {
typeList.add(primitive);
+ }
else {
int dimsize = 0;
int n = elem.indexOf('[');
@@ -164,9 +166,10 @@ class Signature {
if (primitive != null) {
typeList.add(Array.newInstance(primitive, dims)
.getClass());
- } else
+ } else {
typeList.add(Array.newInstance(
getClass(arrayType, cl), dims).getClass());
+ }
} else {
typeList.add(getClass(elem, cl));
}
@@ -178,9 +181,9 @@ class Signature {
}
}
- public static Class getClass(String name, ClassLoader cl) {
+ public static Class<?> getClass(String name, ClassLoader cl) {
- Class c = null;
+ Class<?> c = null;
try {
c = Class.forName(name);
@@ -197,31 +200,41 @@ class Signature {
return c;
}
- public static Class primitiveNameToType(String name) {
- if (name.equals("void"))
+ public static Class<?> primitiveNameToType(String name) {
+ if (name.equals("void")) {
return Void.TYPE;
- else if (name.equals("boolean"))
+ }
+ else if (name.equals("boolean")) {
return Boolean.TYPE;
- else if (name.equals("byte"))
+ }
+ else if (name.equals("byte")) {
return Byte.TYPE;
- else if (name.equals("char"))
+ }
+ else if (name.equals("char")) {
return Character.TYPE;
- else if (name.equals("short"))
+ }
+ else if (name.equals("short")) {
return Short.TYPE;
- else if (name.equals("int"))
+ }
+ else if (name.equals("int")) {
return Integer.TYPE;
- else if (name.equals("long"))
+ }
+ else if (name.equals("long")) {
return Long.TYPE;
- else if (name.equals("float"))
+ }
+ else if (name.equals("float")) {
return Float.TYPE;
- else if (name.equals("double"))
+ }
+ else if (name.equals("double")) {
return Double.TYPE;
- else
+ }
+ else {
return null;
+ }
}
- public Class[] getClassArray() {
- return typeList.subList(0, typeList.size()).toArray(new Class[] {});
+ public Class<?>[] getClassArray() {
+ return typeList.subList(0, typeList.size()).toArray(new Class<?>[] {});
}
}
@@ -264,7 +277,7 @@ public class PluginAppletSecurityContext {
OutputController.getLogger().log(OutputController.Level.ERROR_ALL,e);
}
- this.classLoaders.put(liveconnectLoader, u);
+ PluginAppletSecurityContext.classLoaders.put(liveconnectLoader, u);
}
public PluginAppletSecurityContext(int identifier) {
@@ -272,49 +285,61 @@ public class PluginAppletSecurityContext {
}
private static <V> V parseCall(String s, ClassLoader cl, Class<V> c) {
- if (c == Integer.class)
+ if (c == Integer.class) {
return c.cast(new Integer(s));
- else if (c == String.class)
- return c.cast(new String(s));
- else if (c == Signature.class)
+ }
+ else if (c == String.class) {
+ return c.cast(s);
+ }
+ else if (c == Signature.class) {
return c.cast(new Signature(s, cl));
- else
+ }
+ else {
throw new RuntimeException("Unexpected call value.");
+ }
}
- private Object parseArgs(String s, Class c) {
- if (c == Boolean.TYPE || c == Boolean.class)
- return new Boolean(s);
- else if (c == Byte.TYPE || c == Byte.class)
+ private Object parseArgs(String s, Class<?> c) {
+ if (c == Boolean.TYPE || c == Boolean.class) {
+ return Boolean.valueOf(s);
+ }
+ else if (c == Byte.TYPE || c == Byte.class) {
return new Byte(s);
+ }
else if (c == Character.TYPE || c == Character.class) {
String[] bytes = s.split("_");
int low = Integer.parseInt(bytes[0]);
int high = Integer.parseInt(bytes[1]);
int full = ((high << 8) & 0x0ff00) | (low & 0x0ff);
return new Character((char) full);
- } else if (c == Short.TYPE || c == Short.class)
+ } else if (c == Short.TYPE || c == Short.class) {
return new Short(s);
- else if (c == Integer.TYPE || c == Integer.class)
+ }
+ else if (c == Integer.TYPE || c == Integer.class) {
return new Integer(s);
- else if (c == Long.TYPE || c == Long.class)
+ }
+ else if (c == Long.TYPE || c == Long.class) {
return new Long(s);
- else if (c == Float.TYPE || c == Float.class)
+ }
+ else if (c == Float.TYPE || c == Float.class) {
return new Float(s);
- else if (c == Double.TYPE || c == Double.class)
+ }
+ else if (c == Double.TYPE || c == Double.class) {
return new Double(s);
- else
+ }
+ else {
return store.getObject(new Integer(s));
+ }
}
public void associateSrc(ClassLoader cl, URL src) {
PluginDebug.debug("Associating ", cl, " with ", src);
- this.classLoaders.put(cl, src);
+ PluginAppletSecurityContext.classLoaders.put(cl, src);
}
public void associateInstance(Integer i, ClassLoader cl) {
PluginDebug.debug("Associating ", cl, " with instance ", i);
- this.instanceClassLoaders.put(i, cl);
+ PluginAppletSecurityContext.instanceClassLoaders.put(i, cl);
}
public static void setStreamhandler(PluginStreamHandler sh) {
@@ -337,6 +362,7 @@ public class PluginAppletSecurityContext {
private static long privilegedJSObjectUnbox(final JSObject js) {
return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+ @Override
public Long run() {
return JSUtil.getJSObjectInternalReference(js);
}
@@ -418,8 +444,8 @@ public class PluginAppletSecurityContext {
try {
if (message.startsWith("FindClass")) {
- ClassLoader cl = null;
- Class c = null;
+ ClassLoader cl;
+ Class<?> c;
cl = liveconnectLoader;
String[] args = message.split(" ");
Integer instance = new Integer(args[1]);
@@ -432,7 +458,7 @@ public class PluginAppletSecurityContext {
write(reference, "FindClass " + store.getIdentifier(c));
} catch (ClassNotFoundException cnfe) {
- cl = this.instanceClassLoaders.get(instance);
+ cl = PluginAppletSecurityContext.instanceClassLoaders.get(instance);
PluginDebug.debug("Not found. Looking in ", cl);
if (instance != 0 && cl != null) {
@@ -460,14 +486,16 @@ public class PluginAppletSecurityContext {
if (message.startsWith("GetStaticMethodID") ||
methodName.equals("<init>") ||
- methodName.equals("<clinit>"))
- c = (Class<?>) store.getObject(classID);
- else
- c = store.getObject(classID).getClass();
-
- Method m = null;
- Constructor cs = null;
- Object o = null;
+ methodName.equals("<clinit>")) {
+ c = (Class<?>) store.getObject(classID);
+ }
+ else {
+ c = store.getObject(classID).getClass();
+ }
+
+ Method m;
+ Constructor<?> cs;
+ Object o;
if (methodName.equals("<init>")
|| methodName.equals("<clinit>")) {
o = cs = c.getConstructor(signature.getClassArray());
@@ -489,7 +517,7 @@ public class PluginAppletSecurityContext {
PluginDebug.debug("GetStaticFieldID/GetFieldID got class=", c.getName());
- Field f = null;
+ Field f;
f = c.getField(fieldName);
store.reference(f);
@@ -508,6 +536,7 @@ public class PluginAppletSecurityContext {
checkPermission(src, c, acc);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
return f.get(c);
@@ -517,8 +546,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
String objIDStr = toObjectIDString(ret, f.getType(), false /*do not unbox primitives*/);
write(reference, "GetStaticField " + objIDStr);
@@ -547,6 +577,7 @@ public class PluginAppletSecurityContext {
checkPermission(src, message.startsWith("SetStaticField") ? (Class) o : o.getClass(), acc);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
f.set(o, fValue);
@@ -558,8 +589,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
write(reference, "SetField");
} else if (message.startsWith("GetObjectArrayElement")) {
@@ -610,6 +642,7 @@ public class PluginAppletSecurityContext {
checkPermission(src, o.getClass(), acc);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
return f.get(o);
@@ -619,8 +652,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
String objIDStr = toObjectIDString(ret, f.getType(), false /*do not unbox primitives*/);
write(reference, "GetField " + objIDStr);
@@ -676,6 +710,7 @@ public class PluginAppletSecurityContext {
// http://forums.sun.com/thread.jspa?threadID=332001&start=15&tstart=0
m.setAccessible(true);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
return m.invoke(callableObject, fArguments);
@@ -685,8 +720,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
String retO;
if (ret == null) {
@@ -704,8 +740,8 @@ public class PluginAppletSecurityContext {
} else if (message.startsWith("GetSuperclass")) {
String[] args = message.split(" ");
Integer classID = parseCall(args[1], null, Integer.class);
- Class<?> c = null;
- Class<?> ret = null;
+ Class<?> c;
+ Class<?> ret;
c = (Class) store.getObject(classID);
ret = c.getSuperclass();
@@ -740,7 +776,7 @@ public class PluginAppletSecurityContext {
String[] args = message.split(" ");
Integer stringID = parseCall(args[1], null, Integer.class);
- String o = null;
+ String o;
byte[] b = null;
o = (String) store.getObject(stringID);
b = o.getBytes("UTF-8");
@@ -750,7 +786,7 @@ public class PluginAppletSecurityContext {
String[] args = message.split(" ");
Integer stringID = parseCall(args[1], null, Integer.class);
- String o = null;
+ String o;
byte[] b = null;
o = (String) store.getObject(stringID);
b = o.getBytes("UTF-16LE");
@@ -760,22 +796,23 @@ public class PluginAppletSecurityContext {
String[] args = message.split(" ");
Integer stringID = parseCall(args[1], null, Integer.class);
- String o = null;
+ String o;
byte[] b = null;
StringBuffer buf = null;
o = (String) store.getObject(stringID);
b = o.getBytes("UTF-8");
buf = new StringBuffer(b.length * 2);
buf.append(b.length);
- for (int i = 0; i < b.length; i++)
+ for (int i = 0; i < b.length; i++) {
buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16));
+ }
write(reference, "GetStringUTFChars " + buf);
} else if (message.startsWith("GetStringChars")) {
String[] args = message.split(" ");
Integer stringID = parseCall(args[1], null, Integer.class);
- String o = null;
+ String o;
byte[] b = null;
StringBuffer buf = null;
o = (String) store.getObject(stringID);
@@ -783,8 +820,9 @@ public class PluginAppletSecurityContext {
b = o.getBytes("UTF-16LE");
buf = new StringBuffer(b.length * 2);
buf.append(b.length);
- for (int i = 0; i < b.length; i++)
+ for (int i = 0; i < b.length; i++) {
buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16));
+ }
PluginDebug.debug("Java: GetStringChars: ", o);
PluginDebug.debug(" String BYTES: ", buf);
@@ -793,15 +831,16 @@ public class PluginAppletSecurityContext {
String[] args = message.split(" ");
Integer objectID = parseCall(args[1], null, Integer.class);
- String o = null;
+ String o;
byte[] b = null;
StringBuffer buf = null;
o = store.getObject(objectID).toString();
b = o.getBytes("UTF-8");
buf = new StringBuffer(b.length * 2);
buf.append(b.length);
- for (int i = 0; i < b.length; i++)
+ for (int i = 0; i < b.length; i++) {
buf.append(" " + Integer.toString(((int) b[i]) & 0x0ff, 16));
+ }
write(reference, "GetToStringValue " + buf);
} else if (message.startsWith("NewArray")) {
@@ -809,9 +848,9 @@ public class PluginAppletSecurityContext {
String type = parseCall(args[1], null, String.class);
Integer length = parseCall(args[2], null, Integer.class);
- Object newArray = null;
+ Object newArray;
- Class c;
+ Class<?> c;
if (type.equals("bool")) {
c = Boolean.class;
} else if (type.equals("double")) {
@@ -826,10 +865,12 @@ public class PluginAppletSecurityContext {
c = JSObject.class;
}
- if (args.length > 3)
+ if (args.length > 3) {
newArray = Array.newInstance(c, new int[] { length, parseCall(args[3], null, Integer.class) });
- else
+ }
+ else {
newArray = Array.newInstance(c, length);
+ }
store.reference(newArray);
write(reference, "NewArray " + store.getIdentifier(newArray));
@@ -838,7 +879,7 @@ public class PluginAppletSecurityContext {
Integer classNameID = parseCall(args[1], null, Integer.class);
Integer methodNameID = parseCall(args[2], null, Integer.class);
- Class c = (Class<?>) store.getObject(classNameID);
+ Class<?> c = (Class<?>) store.getObject(classNameID);
String methodName = (String) store.getObject(methodNameID);
Method method = null;
@@ -869,7 +910,7 @@ public class PluginAppletSecurityContext {
Integer classNameID = parseCall(args[1], null, Integer.class);
Integer fieldNameID = parseCall(args[2], null, Integer.class);
- Class c = (Class) store.getObject(classNameID);
+ Class<?> c = (Class<?>) store.getObject(classNameID);
String fieldName = (String) store.getObject(fieldNameID);
Field field = null;
@@ -890,13 +931,14 @@ public class PluginAppletSecurityContext {
Integer classID = parseCall(args[2], null, Integer.class);
Integer objectID = parseCall(args[3], null, Integer.class);
- Object newArray = null;
+ Object newArray;
newArray = Array.newInstance((Class) store.getObject(classID),
length);
Object[] array = (Object[]) newArray;
- for (int i = 0; i < array.length; i++)
+ for (int i = 0; i < array.length; i++) {
array[i] = store.getObject(objectID);
+ }
store.reference(newArray);
write(reference, "NewObjectArray "
+ store.getIdentifier(newArray));
@@ -906,7 +948,7 @@ public class PluginAppletSecurityContext {
Integer classID = parseCall(args[1], null, Integer.class);
Integer methodID = parseCall(args[2], null, Integer.class);
- final Constructor m = (Constructor) store.getObject(methodID);
+ final Constructor<?> m = (Constructor<?>) store.getObject(methodID);
Class[] argTypes = m.getParameterTypes();
Object[] arguments = new Object[argTypes.length];
@@ -917,10 +959,11 @@ public class PluginAppletSecurityContext {
final Object[] fArguments = arguments;
AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
- Class c = (Class) store.getObject(classID);
+ Class<?> c = (Class<?>) store.getObject(classID);
checkPermission(src, c, acc);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
return m.newInstance(fArguments);
@@ -930,8 +973,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
store.reference(ret);
@@ -969,6 +1013,7 @@ public class PluginAppletSecurityContext {
checkPermission(src, c, acc);
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
return cons.newInstance(castedArgs);
@@ -978,8 +1023,9 @@ public class PluginAppletSecurityContext {
}
}, acc);
- if (ret instanceof Throwable)
+ if (ret instanceof Throwable) {
throw (Throwable) ret;
+ }
store.reference(ret);
@@ -1010,7 +1056,7 @@ public class PluginAppletSecurityContext {
Integer strlength = parseCall(args[1], null, Integer.class);
int bytelength = 2 * strlength;
byte[] byteArray = new byte[bytelength];
- String ret = null;
+ String ret;
for (int i = 0; i < strlength; i++) {
int c = parseCall(args[2 + i], null, Integer.class);
PluginDebug.debug("char ", i, " ", c);
@@ -1027,13 +1073,15 @@ public class PluginAppletSecurityContext {
} else if (message.startsWith("ExceptionOccurred")) {
PluginDebug.debug("EXCEPTION: ", throwable);
- if (throwable != null)
+ if (throwable != null) {
store.reference(throwable);
+ }
write(reference, "ExceptionOccurred "
+ store.getIdentifier(throwable));
} else if (message.startsWith("ExceptionClear")) {
- if (throwable != null && store.contains(throwable))
+ if (throwable != null && store.contains(throwable)) {
store.unreference(store.getIdentifier(throwable));
+ }
throwable = null;
write(reference, "ExceptionClear");
} else if (message.startsWith("DeleteGlobalRef")) {
@@ -1083,8 +1131,9 @@ public class PluginAppletSecurityContext {
// Store the cause as the actual exception. This is needed because
// the exception we get here will always be an
// "InvocationTargetException" due to the use of reflection above
- if (message.startsWith("CallMethod") || message.startsWith("CallStaticMethod"))
+ if (message.startsWith("CallMethod") || message.startsWith("CallStaticMethod")) {
throwable = t.getCause();
+ }
}
}
@@ -1097,7 +1146,7 @@ public class PluginAppletSecurityContext {
* @param acc AccessControlContext for this execution
* @throws AccessControlException If the script has insufficient permissions
*/
- public void checkPermission(String jsSrc, Class target, AccessControlContext acc) throws AccessControlException {
+ public void checkPermission(String jsSrc, Class<?> target, AccessControlContext acc) throws AccessControlException {
// NPRuntime does not allow cross-site calling. We therefore always
// allow this, for the time being
return;
@@ -1180,7 +1229,7 @@ public class PluginAppletSecurityContext {
private int prepopulateClass(String name) {
name = name.replace('/', '.');
ClassLoader cl = liveconnectLoader;
- Class c = null;
+ Class<?> c = null;
try {
c = cl.loadClass(name);
@@ -1199,7 +1248,7 @@ public class PluginAppletSecurityContext {
Class<?> c = (Class<?>) store.getObject(classID);
Method m = null;
- Constructor cs = null;
+ Constructor<?> cs = null;
try {
if (methodName.equals("<init>")
@@ -1285,8 +1334,9 @@ public class PluginAppletSecurityContext {
// do nothing
}
- if (src.equals("[System]"))
+ if (src.equals("[System]")) {
grantedPermissions.add(new JSObjectCreatePermission());
+ }
} else {
JSObjectCreatePermission perm = new JSObjectCreatePermission();
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
index b1abf19..8d1630d 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
@@ -82,7 +82,6 @@ import java.awt.print.Printable;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
import java.net.SocketPermission;
import java.net.URI;
import java.net.URL;
@@ -110,11 +109,9 @@ import net.sourceforge.jnlp.PluginParameters;
import net.sourceforge.jnlp.runtime.JNLPClassLoader;
import net.sourceforge.jnlp.security.appletextendedsecurity.AppletSecurityLevel;
import net.sourceforge.jnlp.security.appletextendedsecurity.AppletStartupSecuritySettings;
-import net.sourceforge.jnlp.security.appletextendedsecurity.ExecuteUnsignedApplet;
import net.sourceforge.jnlp.splashscreen.SplashController;
import net.sourceforge.jnlp.splashscreen.SplashPanel;
import net.sourceforge.jnlp.splashscreen.SplashUtils;
-import netscape.javascript.JSObject;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.X11.XEmbeddedFrame;
@@ -250,14 +247,17 @@ public class PluginAppletViewer extends XEmbeddedFrame
windowEventListener = new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent evt) {
destroyApplet(identifier);
}
+ @Override
public void windowIconified(WindowEvent evt) {
appletStop();
}
+ @Override
public void windowDeiconified(WindowEvent evt) {
appletStart();
}
@@ -273,6 +273,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
}
+ @Override
public void replaceSplash(final SplashPanel newSplash) {
if (splashPanel == null) {
return;
@@ -284,6 +285,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
splashPanel.getSplashComponent().setVisible(false);
splashPanel.stopAnimation();
@@ -310,6 +312,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
splashPanel.getSplashComponent().setVisible(false);
splashPanel.stopAnimation();
@@ -356,6 +359,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
this.appletViewer = appletViewer;
}
+ @Override
public void appletStateChanged(AppletEvent evt) {
AppletPanel src = (AppletPanel) evt.getSource();
@@ -387,10 +391,12 @@ public class PluginAppletViewer extends XEmbeddedFrame
// Swing also maintains a Frame list for the AppContext,
// so we will have to rearrange it as well.
//
- if (a != null)
+ if (a != null) {
AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a));
- else
+ }
+ else {
AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext());
+ }
updateStatus(appletViewer.identifier, PAV_INIT_STATUS.INIT_COMPLETE);
@@ -435,8 +441,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
// If there is a key for this status, it means it
// was either initialized before, or destroy has been
// processed. Stop moving further.
- if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null)
+ if (updateStatus(identifier, PAV_INIT_STATUS.PRE_INIT) != null) {
return;
+ }
// Extract the information from the message
String[] msgParts = new String[4];
@@ -543,8 +550,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
;
// don't bother processing further for inactive applets
- if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE))
+ if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
return;
+ }
applets.get(identifier).handleMessage(reference, message);
}
@@ -640,6 +648,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("Attempting to destroy panel ", identifier);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
pav.appletClose();
}
@@ -685,6 +694,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
waitForAppletInit(panel);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
panel.updateSizeInAtts(height, width);
@@ -774,6 +784,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an audio clip.
*/
+ @Override
public AudioClip getAudioClip(URL url) {
checkConnect(url);
synchronized (audioClips) {
@@ -790,6 +801,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an image.
*/
+ @Override
public Image getImage(URL url) {
return getCachedImage(url);
}
@@ -818,8 +830,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
JNLPClassLoader loader = (JNLPClassLoader) panel.getAppletClassLoader();
URL localURL = null;
- if (loader.resourceAvailableLocally(resourceName))
+ if (loader.resourceAvailableLocally(resourceName)) {
url = loader.getResource(resourceName);
+ }
url = localURL != null ? localURL : url;
}
@@ -853,6 +866,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Get an applet by name.
*/
+ @Override
public Applet getApplet(String name) {
name = name.toLowerCase();
SocketPermission panelSp =
@@ -883,6 +897,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
* Return an enumeration of all the accessible
* applets on this page.
*/
+ @Override
public Enumeration<Applet> getApplets() {
Vector<Applet> v = new Vector<Applet>();
SocketPermission panelSp =
@@ -904,11 +919,13 @@ public class PluginAppletViewer extends XEmbeddedFrame
return v.elements();
}
+ @Override
public void showDocument(URL url) {
PluginDebug.debug("Showing document...");
showDocument(url, "_self");
}
+ @Override
public void showDocument(URL url, String target) {
// If it is a javascript document, eval on current page.
if ("javascript".equals(url.getProtocol())) {
@@ -930,6 +947,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
/**
* Show status.
*/
+ @Override
public void showStatus(String status) {
try {
// FIXME: change to postCallRequest
@@ -1124,8 +1142,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait eval request 1");
synchronized (request) {
PluginDebug.debug("wait eval request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait eval request 3");
}
} catch (InterruptedException e) {
@@ -1189,8 +1208,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait call request 1");
synchronized (request) {
PluginDebug.debug("wait call request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait call request 3");
}
} catch (InterruptedException e) {
@@ -1224,8 +1244,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait cookieinfo request 1");
synchronized (request) {
PluginDebug.debug("wait cookieinfo request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait cookieinfo request 3");
}
} catch (InterruptedException e) {
@@ -1256,8 +1277,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait call request 1");
synchronized (request) {
PluginDebug.debug("wait call request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait call request 3");
}
} catch (InterruptedException e) {
@@ -1282,8 +1304,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("wait finalize request 1");
synchronized (request) {
PluginDebug.debug("wait finalize request 2");
- while (request.isDone() == false)
+ while (request.isDone() == false) {
request.wait();
+ }
PluginDebug.debug("wait finalize request 3");
}
} catch (InterruptedException e) {
@@ -1322,6 +1345,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
PluginDebug.debug("WRITING 2 DONE");
}
+ @Override
public void setStream(String key, InputStream stream) throws IOException {
// We do nothing.
}
@@ -1402,6 +1426,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
}
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
public Void run() {
((AppletViewerPanel)panel).createAppletThread();
return null;
@@ -1413,6 +1438,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
panel.sendEvent(AppletPanel.APPLET_START);
}
+ @Override
public int print(Graphics graphics, PageFormat pf, int pageIndex) {
return Printable.NO_SUCH_PAGE;
}
@@ -1458,13 +1484,15 @@ public class PluginAppletViewer extends XEmbeddedFrame
new Thread(new Runnable() {
@SuppressWarnings("deprecation")
+ @Override
public void run() {
ClassLoader cl = p.applet.getClass().getClassLoader();
// Since we want to deal with JNLPClassLoader, extract it if this
// is a codebase loader
- if (cl instanceof JNLPClassLoader.CodeBaseClassLoader)
+ if (cl instanceof JNLPClassLoader.CodeBaseClassLoader) {
cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader();
+ }
appletShutdown(p);
appletPanels.removeElement(p);
@@ -1474,6 +1502,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
dispose();
}
@@ -1514,10 +1543,12 @@ public class PluginAppletViewer extends XEmbeddedFrame
try {
java.security.Permission perm =
url.openConnection().getPermission();
- if (perm != null)
+ if (perm != null) {
security.checkPermission(perm);
- else
+ }
+ else {
security.checkConnect(url.getHost(), url.getPort());
+ }
} catch (java.io.IOException ioe) {
security.checkConnect(url.getHost(), url.getPort());
}
@@ -1531,6 +1562,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
* the parent class's update() just does a couple of checks (both of
* which are accounted for) and then calls paint anyway.
*/
+ @Override
public void paint(Graphics g) {
// If the image or the graphics don't exist, create new ones
@@ -1573,8 +1605,9 @@ public class PluginAppletViewer extends XEmbeddedFrame
long timeout) {
// Can't wait on null. Return 0 indicating no wait happened.
- if (lock == null)
- return 0;
+ if (lock == null) {
+ return 0;
+ }
assert lock.isHeldByCurrentThread();
@@ -1598,6 +1631,7 @@ public class PluginAppletViewer extends XEmbeddedFrame
this.fPanel = fPanel;
}
+ @Override
public void run() {
add("Center", fPanel);
fPanel.setVisible(false);