aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime
diff options
context:
space:
mode:
authorJiri Vanek <jvanek@redhat.com>2013-12-13 10:47:07 +0100
committerJiri Vanek <jvanek@redhat.com>2013-12-13 10:47:07 +0100
commit25f307d98cb0ba4698318c6a1a4e738ee81f6e55 (patch)
treee869f4d7ea537ba2d4508f71edbafdccecd0f375 /netx/net/sourceforge/jnlp/runtime
parent6256aac59275df0edd0feb4950272aa33573be9f (diff)
itw itself warning cleanup: fixed rawtypes and unchecks, added braces and Override
After this clean up only "internal proprietary API and may be removed in a future release" warnings remain fro make check. Please keep itw in this way :) remaining issues: icedtea-web/netx/net/sourceforge/jnlp/cache/ResourceTracker.java:357: warning: [deprecation] toURL() in File has been deprecated icedtea-web/netx/net/sourceforge/jnlp/cache/CacheUtil.java:128: warning: [deprecation] toURL() in File has been deprecated icedtea-web/netx/net/sourceforge/jnlp/runtime/Boot.java:261: warning: [deprecation] toURL() in File has been deprecated There have been a lot of work around cach x file x url escaping, and as main difference between file.tourl and file.touri.tourl is escapin, I rather left it. icedtea-web/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java:804: warning: [deprecation] Ref in sun.misc has been deprecated icedtea-web/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java:121: warning: [deprecation] Ref in sun.misc has been deprecated What can be done? icedtea-web/netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java:205: warning: [fallthrough] possible fall-through into case icedtea-web/netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java:211: warning: [fallthrough] possible fall-through into case This have to be fixed
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java42
-rw-r--r--netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java2
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java9
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java54
4 files changed, 68 insertions, 39 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
index 17e9d14..d838ac6 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
@@ -89,6 +89,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
// may not need this once security manager can close windows
// that do not have app code on the stack
WindowListener closer = new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent event) {
appletInstance.destroy();
JNLPRuntime.exit(0);
@@ -105,8 +106,9 @@ public class AppletEnvironment implements AppletContext, AppletStub {
* @throws IllegalStateException
*/
private void checkDestroyed() {
- if (destroyed)
+ if (destroyed) {
throw new IllegalStateException("Illegal applet stub/context access: applet destroyed.");
+ }
}
/**
@@ -147,18 +149,21 @@ public class AppletEnvironment implements AppletContext, AppletStub {
public void startApplet() {
checkDestroyed();
- if (appletStarted)
+ if (appletStarted) {
return;
+ }
appletStarted = true;
try {
AppletDesc appletDesc = file.getApplet();
- if (cont instanceof AppletStub)
+ if (cont instanceof AppletStub) {
applet.setStub((AppletStub) cont);
- else
+ }
+ else {
applet.setStub(this);
+ }
cont.setLayout(new BorderLayout());
cont.add("Center", applet);
@@ -176,6 +181,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
try {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
// do first because some applets need to be displayed before
// starting (they use Component.getImage or something)
@@ -207,13 +213,15 @@ public class AppletEnvironment implements AppletContext, AppletStub {
* Returns the applet if the applet's name is specified,
* otherwise return null.
*/
+ @Override
public Applet getApplet(String name) {
checkDestroyed();
- if (name != null && name.equals(file.getApplet().getName()))
+ if (name != null && name.equals(file.getApplet().getName())) {
return applet;
- else
+ } else {
return null;
+ }
}
/**
@@ -231,6 +239,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
* Returns an enumeration that contains only the applet
* from the JNLP file.
*/
+ @Override
public Enumeration<Applet> getApplets() {
checkDestroyed();
@@ -240,6 +249,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Returns an audio clip.
*/
+ @Override
public AudioClip getAudioClip(URL location) {
checkDestroyed();
@@ -254,6 +264,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Return an image loaded from the specified location.
*/
+ @Override
public Image getImage(URL location) {
checkDestroyed();
@@ -266,6 +277,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Not implemented yet.
*/
+ @Override
public void showDocument(java.net.URL uRL) {
checkDestroyed();
@@ -274,6 +286,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Not implemented yet.
*/
+ @Override
public void showDocument(java.net.URL uRL, java.lang.String str) {
checkDestroyed();
@@ -282,6 +295,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Not implemented yet.
*/
+ @Override
public void showStatus(java.lang.String str) {
checkDestroyed();
@@ -290,6 +304,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Required for JRE1.4, but not implemented yet.
*/
+ @Override
public void setStream(String key, InputStream stream) {
checkDestroyed();
@@ -298,6 +313,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Required for JRE1.4, but not implemented yet.
*/
+ @Override
public InputStream getStream(String key) {
checkDestroyed();
@@ -307,6 +323,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Required for JRE1.4, but not implemented yet.
*/
+ @Override
public Iterator<String> getStreamKeys() {
checkDestroyed();
@@ -315,6 +332,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
// stub methods
+ @Override
public void appletResize(int width, int height) {
checkDestroyed();
@@ -327,18 +345,21 @@ public class AppletEnvironment implements AppletContext, AppletStub {
}
}
+ @Override
public AppletContext getAppletContext() {
checkDestroyed();
return this;
}
+ @Override
public URL getCodeBase() {
checkDestroyed();
return file.getCodeBase();
}
+ @Override
public URL getDocumentBase() {
checkDestroyed();
@@ -347,16 +368,19 @@ public class AppletEnvironment implements AppletContext, AppletStub {
// FIXME: Sun's applet code forces all parameters to lower case.
// Does Netx's JNLP code do the same, so we can remove the first lookup?
+ @Override
public String getParameter(String name) {
checkDestroyed();
- String s = (String) parameters.get(name);
- if (s != null)
+ String s = parameters.get(name);
+ if (s != null) {
return s;
+ }
- return (String) parameters.get(name.toLowerCase());
+ return parameters.get(name.toLowerCase());
}
+ @Override
public boolean isActive() {
checkDestroyed();
diff --git a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
index 4d38be4..0258840 100644
--- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
+++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
@@ -296,7 +296,7 @@ public class ApplicationInstance {
}
// then stop
- Thread.currentThread().yield();
+ Thread.yield();
nthreads = group.enumerate(threads);
for (int i = 0; i < nthreads; i++) {
OutputController.getLogger().log("Stop thread: " + threads[i]);
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
index 3a50f6c..866c7b1 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
@@ -21,9 +21,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.PrintStream;
import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.net.Authenticator;
import java.net.ProxySelector;
@@ -33,8 +31,6 @@ import java.security.AllPermission;
import java.security.KeyStore;
import java.security.Policy;
import java.security.Security;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
import java.text.MessageFormat;
import java.util.List;
import java.util.ResourceBundle;
@@ -44,8 +40,6 @@ import javax.naming.ConfigurationException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.swing.UIManager;
@@ -64,7 +58,6 @@ import net.sourceforge.jnlp.config.DeploymentConfiguration;
import net.sourceforge.jnlp.security.JNLPAuthenticator;
import net.sourceforge.jnlp.security.KeyStores;
import net.sourceforge.jnlp.security.SecurityDialogMessageHandler;
-import net.sourceforge.jnlp.security.VariableX509TrustManager;
import net.sourceforge.jnlp.services.XServiceManagerStub;
import net.sourceforge.jnlp.util.FileUtils;
import net.sourceforge.jnlp.util.logging.JavaConsole;
@@ -462,7 +455,7 @@ public class JNLPRuntime {
*
* @throws IllegalStateException if caller is not the exit class
*/
- public static void setExitClass(Class exitClass) {
+ public static void setExitClass(Class<?> exitClass) {
checkExitClass();
security.setExitClass(exitClass);
}
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
index dc1989a..762bb91 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
@@ -18,25 +18,19 @@ package net.sourceforge.jnlp.runtime;
import static net.sourceforge.jnlp.runtime.Translator.R;
-import java.awt.Frame;
import java.awt.Window;
-import java.lang.ref.WeakReference;
import java.net.SocketPermission;
-import java.security.AllPermission;
import java.security.AccessControlException;
import java.security.Permission;
-import java.security.SecurityPermission;
import javax.swing.JWindow;
-import net.sourceforge.jnlp.JNLPFile;
import net.sourceforge.jnlp.security.SecurityDialogs.AccessType;
import net.sourceforge.jnlp.services.ServiceUtil;
import net.sourceforge.jnlp.util.logging.OutputController;
import net.sourceforge.jnlp.util.WeakList;
import sun.awt.AWTSecurityManager;
import sun.awt.AppContext;
-import sun.security.util.SecurityConstants;
/**
* Security manager for JNLP environment. This security manager
@@ -118,8 +112,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
// not added to any window list when checkTopLevelWindow is
// called for it (and not disposed).
- if (!JNLPRuntime.isHeadless())
+ if (!JNLPRuntime.isHeadless()) {
new JWindow().getOwner();
+ }
mainAppContext = AppContext.getAppContext();
}
@@ -137,12 +132,15 @@ class JNLPSecurityManager extends AWTSecurityManager {
* true if no exit class is set.
*/
private boolean isExitClass(Class stack[]) {
- if (exitClass == null)
+ if (exitClass == null) {
return true;
+ }
- for (int i = 0; i < stack.length; i++)
- if (stack[i] == exitClass)
+ for (int i = 0; i < stack.length; i++) {
+ if (stack[i] == exitClass) {
return true;
+ }
+ }
return false;
}
@@ -154,9 +152,10 @@ class JNLPSecurityManager extends AWTSecurityManager {
* @param exitClass the exit class
* @throws IllegalStateException if the exit class is already set
*/
- public void setExitClass(Class exitClass) throws IllegalStateException {
- if (this.exitClass != null)
+ public void setExitClass(Class<?> exitClass) throws IllegalStateException {
+ if (this.exitClass != null) {
throw new IllegalStateException(R("RExitTaken"));
+ }
this.exitClass = exitClass;
}
@@ -181,8 +180,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
weakApplications.remove(i);
}
- if (w == window)
+ if (w == window) {
return weakApplications.get(i);
+ }
}
return null;
@@ -204,8 +204,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
cl = cl.getParent();
}
- if (maxDepth <= 0)
+ if (maxDepth <= 0) {
maxDepth = stack.length;
+ }
// this needs to be tightened up
for (int i = 0; i < stack.length && i < maxDepth; i++) {
@@ -230,8 +231,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
private JNLPClassLoader getJnlpClassLoader(ClassLoader cl) {
// 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();
+ }
if (cl instanceof JNLPClassLoader) {
JNLPClassLoader loader = (JNLPClassLoader) cl;
@@ -245,10 +247,12 @@ class JNLPSecurityManager extends AWTSecurityManager {
* Returns the application's thread group if the application can
* be determined; otherwise returns super.getThreadGroup()
*/
+ @Override
public ThreadGroup getThreadGroup() {
ApplicationInstance app = getApplication();
- if (app == null)
+ if (app == null) {
return super.getThreadGroup();
+ }
return app.getThreadGroup();
}
@@ -258,6 +262,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
* otherwise return normally. This method always denies
* permission to change the security manager or policy.
*/
+ @Override
public void checkPermission(Permission perm) {
String name = perm.getName();
@@ -267,8 +272,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
// OutputController.getLogger().log("Checking permission: " + perm.toString());
if (!JNLPRuntime.isWebstartApplication() &&
- ("setPolicy".equals(name) || "setSecurityManager".equals(name)))
+ ("setPolicy".equals(name) || "setSecurityManager".equals(name))) {
throw new SecurityException(R("RCantReplaceSM"));
+ }
try {
// deny all permissions to stopped applications
@@ -337,6 +343,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
* warning banner, and adds the window to the list of windows to
* be disposed when the calling application exits.
*/
+ @Override
public boolean checkTopLevelWindow(Object window) {
ApplicationInstance app = getApplication();
@@ -371,22 +378,26 @@ class JNLPSecurityManager extends AWTSecurityManager {
* Calls not from Runtime.exit or with no exit class set will
* behave normally, and the exit class can always exit the JVM.
*/
+ @Override
public void checkExit(int status) {
// applets are not allowed to exit, but the plugin main class (primordial loader) is
Class stack[] = getClassContext();
if (!exitAllowed) {
- for (int i = 0; i < stack.length; i++)
- if (stack[i].getClassLoader() != null)
+ for (int i = 0; i < stack.length; i++) {
+ if (stack[i].getClassLoader() != null) {
throw new AccessControlException("Applets may not call System.exit()");
+ }
+ }
}
super.checkExit(status);
boolean realCall = (stack[1] == Runtime.class);
- if (isExitClass(stack)) // either exitClass called or no exitClass set
- return; // to Runtime.exit or fake call to see if app has permission
+ if (isExitClass(stack)) {
+ return;
+ } // to Runtime.exit or fake call to see if app has permission
// not called from Runtime.exit()
if (!realCall) {
@@ -446,6 +457,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
* @exception SecurityException if the caller does not have
* permission to accesss the AWT event queue.
*/
+ @Override
public void checkAwtEventQueueAccess() {
/*
* this is the templace of the code that should allow applets access to