diff options
author | Andrew John Hughes <[email protected]> | 2010-12-03 00:30:45 +0000 |
---|---|---|
committer | Andrew John Hughes <[email protected]> | 2010-12-03 00:30:45 +0000 |
commit | 8ddaf6d039146a442d35a7a31bfd48b061d456ff (patch) | |
tree | 023d91ea69877ae494e83bc01711c26c2ba41245 /plugin/icedteanp/java/sun/applet/PluginProxySelector.java | |
parent | cad9500675e6a5dd9600a55fbe6dcb9523d23609 (diff) |
Fix warnings produced by NetX and the plugin (both Java and C++).
2010-12-01 Andrew John Hughes <[email protected]>
* netx/net/sourceforge/jnlp/cache/CacheUtil.java:
(getCachedResource(URL,Version,UpdatePolicy)): Use
toURI().toURL() to avoid broken escaping.
* netx/net/sourceforge/jnlp/cache/ResourceTracker.java:
(getCacheURL(URL)): Likewise.
* netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java:
(destroy()): Suppress deprecated warning from use of thread.stop().
Only use when interrupt() has already been tried.
* netx/net/sourceforge/jnlp/runtime/Boot.java:
(getFile()): Use toURI.toURL() to avoid broken escaping.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
(initializeResources()): Likewise.
* netx/net/sourceforge/jnlp/security/PasswordAuthenticationDialog.java:
(askUser(String,int,String,String)): Use getPassword() to retrieve
a character array directly. Fix overrunning line.
* netx/net/sourceforge/jnlp/tools/JarSigner.java:
Remove unused IdentityScope variable, scope.
* netx/net/sourceforge/nanoxml/XMLElement.java:
(scanWhitespace(StringBuffer)): Don't fallthrough.
* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc:
Fix warnings where std::string is used in printf
rather than char* by invoking c_str on these strings.
* plugin/icedteanp/java/netscape/javascript/JSException.java:
(JSException()): Mark with @Deprecated annotation.
(JSException(String)): Likewise.
(JSException(String,String,int,String,int)): Likewise.
* plugin/icedteanp/java/netscape/javascript/JSObject.java:
(JSObject(String)): Remove redundant cast.
(getWindow(Applet)): Likewise.
* plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java:
(contexts): Initialise properly with generic typing.
* plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java:
(getMatchingMethod(Object[]): Add missing generic type to Class
instances.
(getMatchingConstructor(Object[])): Likewise.
(getCostAndCastedObject(Object,Class<?>)): Likewise.
(getMatchingMethods(Class<?>,String,int)): Likewise.
(getMatchingConstructors(Class<?>,int)): Likewise.
(getNum(String,Class<?>)): Likewise.
* plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java:
(parseCall(String,ClassLoader,Class<V>)): Use c.cast rather than (V).
(handleMessage(int,String,AccessControlContext,String)): Add
missing generic type to Class instances. Remove redundant casts.
(prepopulateField(int,String)): Add missing generic type to Class instance.
* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java:
(createPanel(PluginStreamHandler,int,long,URL,Hashtable<String,String>)):
Add missing generic types on Hashtable and PrivilegedAction.
(initEventQueue(AppletPanel)): Add missing generic type to PrivilegedAction.
(splitSeparator(String,String)): Use an ArrayList rather than Vector
to avoid locking and use generic types.
(requests): Initialise properly with generic typing.
(applets): Likewise.
(appletStateChanged(AppletEvent)): Use setSize and getPreferredSize.
(handleMessage(int,String)): Remove redundant casts.
(audioClips): Add generic types.
(getAudioClip): Remove redundant cast.
(imageRefs): Add generic types.
(getCachedImageRef(URL)): Remove redundant cast.
(appletPanels): Add generic types.
(getApplets()): Likewise.
(getStream(String)): Mark with @Override.
(getStreamKeys()): Likewise.
(systemParam): Add generic types.
(printTag(PrintStream,Hashtable<String,String>)): Likewise.
Remove redundant casts.
(updateAtts()): Use getSize() and getInsets(). Use Integer.valueOf().
(appletReload()): Add generic types to PrivilegedAction.
(scanIdentifier(int[],Reader)): Use StringBuilder to avoid unnecessary
locking.
(skipComment(int[],Reader)): Likewise.
(scanTag(int[],Reader)): Likewise. Add generic types.
(parse(int,long,String,String,Reader,URL)): Use PrivilegedExceptionAction
to avoid catching and rethrowing the exception manually. Add generic types.
(parse(int,long,String,String,Reader,URL,PrintStream,PluginAppletPanelFactory)):
Add generic types. Remove unnecessary casts. Fix overlong lines.
* plugin/icedteanp/java/sun/applet/PluginMain.java:
(init()): Add generic types. Remove unnecessary cast.
* plugin/icedteanp/java/sun/applet/PluginObjectStore.java:
(objects): Initialise properly with generic typing.
(counts): Likewise.
(identifiers): Likewise.
* plugin/icedteanp/java/sun/applet/PluginProxySelector.java:
(get(Object)): Suppress unchecked warning arising from cast to K.
Diffstat (limited to 'plugin/icedteanp/java/sun/applet/PluginProxySelector.java')
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginProxySelector.java | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java index f6a096f..36236ba 100644 --- a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java +++ b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java @@ -49,20 +49,20 @@ import net.sourceforge.jnlp.runtime.JNLPProxySelector; /** * Proxy selector implementation for plugin network functions. - * - * This class fetches proxy information from the web browser and - * uses that information in the context of all network connection + * + * This class fetches proxy information from the web browser and + * uses that information in the context of all network connection * (plugin specific and applet connections) as applicable - * + * */ public class PluginProxySelector extends JNLPProxySelector { - private TimedHashMap<String, Proxy> proxyCache = new TimedHashMap<String, Proxy>(); + private TimedHashMap<String, Proxy> proxyCache = new TimedHashMap<String, Proxy>(); /** * Selects the appropriate proxy (or DIRECT connection method) for the given URI - * + * * @param uri The URI being accessed * @return A list of Proxy objects that are usable for this URI */ @@ -87,11 +87,11 @@ public class PluginProxySelector extends JNLPProxySelector { if (o != null) { PluginDebug.debug("Proxy URI = " + o); URI proxyURI = (URI) o; - + // If origin uri is http/ftp, we're good. If origin uri is not that, the proxy _must_ be socks, else we fallback to direct if (uri.getScheme().startsWith("http") || uri.getScheme().equals("ftp") || proxyURI.getScheme().startsWith("socks")) { - Proxy.Type type = proxyURI.getScheme().equals("http") ? Proxy.Type.HTTP : Proxy.Type.SOCKS; + Proxy.Type type = proxyURI.getScheme().equals("http") ? Proxy.Type.HTTP : Proxy.Type.SOCKS; InetSocketAddress socketAddr = new InetSocketAddress(proxyURI.getHost(), proxyURI.getPort()); proxy = new Proxy(type, socketAddr); @@ -113,14 +113,14 @@ public class PluginProxySelector extends JNLPProxySelector { return proxyList; } - /** - * Checks to see if proxy information is already cached. - * + /** + * Checks to see if proxy information is already cached. + * * @param uri The URI to check - * @return The cached Proxy. null if there is no suitable cached proxy. + * @return The cached Proxy. null if there is no suitable cached proxy. */ private Proxy checkCache(URI uri) { - + String uriKey = uri.getScheme() + "://" + uri.getHost(); if (proxyCache.get(uriKey) != null) { return proxyCache.get(uriKey); @@ -128,10 +128,10 @@ public class PluginProxySelector extends JNLPProxySelector { return null; } - + /** * Simple utility class that extends HashMap by adding an expiry to the entries. - * + * * This map stores entries, and returns them only if the entries were last accessed within time t=10 seconds * * @param <K> The key type @@ -142,10 +142,10 @@ public class PluginProxySelector extends JNLPProxySelector { HashMap<K, Long> timeStamps = new HashMap<K, Long>(); Long expiry = 10000L; - + /** * Store the item in the map and associate a timestamp with it - * + * * @param key The key * @param value The value to store */ @@ -156,12 +156,13 @@ public class PluginProxySelector extends JNLPProxySelector { /** * Return cached item if it has not already expired. - * - * Before returning, this method also resets the "last accessed" + * + * Before returning, this method also resets the "last accessed" * time for this entry, so it is good for another 10 seconds - * + * * @param key The key */ + @SuppressWarnings("unchecked") public V get(Object key) { Long now = new Date().getTime(); @@ -169,7 +170,7 @@ public class PluginProxySelector extends JNLPProxySelector { if (super.containsKey(key)) { Long age = now - timeStamps.get(key); - // Item exists. If it has not expired, renew its access time and return it + // Item exists. If it has not expired, renew its access time and return it if (age <= expiry) { PluginDebug.debug("Returning proxy " + super.get(key) + " from cache for " + key); timeStamps.put((K) key, (new Date()).getTime()); @@ -177,10 +178,10 @@ public class PluginProxySelector extends JNLPProxySelector { } else { PluginDebug.debug("Proxy cache for " + key + " has expired (age=" + age/1000.0 + " seconds)"); } - } + } return null; } } - + } |