diff options
author | Andrew John Hughes <[email protected]> | 2010-10-21 21:12:21 +0100 |
---|---|---|
committer | Andrew John Hughes <[email protected]> | 2010-10-21 21:12:21 +0100 |
commit | 61aeaaf89164aa93280527c7eb80cf4c1432fbee (patch) | |
tree | 73a8266a319eadc6126f3196f35ccb28ef330bcf /netx/net/sourceforge/jnlp/Parser.java | |
parent | 16d8de7b9030235bfc7e3cb8e6a480a08f6a46d8 (diff) |
Fix most warnings arising from NetX code.
2010-10-20 Andrew John Hughes <[email protected]>
* netx/javax/jnlp/ServiceManager.java:
(lookupTable): Add generic types.
* netx/net/sourceforge/jnlp/AppletDesc.java:
(parameters): Likewise.
(AppletDesc(String,String,URL,int,int,Map)): Likewise.
(getParameters()): Likewise.
* netx/net/sourceforge/jnlp/ApplicationDesc.java:
(getArguments()): Remove redundant cast.
(addArgument(String)): Add generic typing.
* netx/net/sourceforge/jnlp/ExtensionDesc.java:
(extToPart): Add generic types.
(eagerExtParts): Likewise.
* netx/net/sourceforge/jnlp/InformationDesc.java:
(info): Likewise.
(getIcons(Object)): Add generic typing.
(getAssociations()): Likewise.
(getRelatedContents()): Likewise.
(getItem(Object)): Likewise.
(getItems(Object)): Likewise.
(addItem(String,Object)): Likewise.
* netx/net/sourceforge/jnlp/JNLPFile.java:
(resources): Likewise.
(InformationDesc.getItems(Object)): Likewise.
(getResources(Class)): Likewise.
* netx/net/sourceforge/jnlp/LaunchException.java:
(getCauses()): Likewise.
* netx/net/sourceforge/jnlp/Launcher.java:
(launchApplication(JNLPFile)): Likewise.
* netx/net/sourceforge/jnlp/NetxPanel.java:
(NetxPanel(URL,Hashtable)): Likewise.
(NetxPanel(URL,Hashtable,boolean)): Likewise.
* netx/net/sourceforge/jnlp/Node.java:
(getChildNodes()): Likewise.
* netx/net/sourceforge/jnlp/Parser.java:
(getResources(Node,boolean)): Likewise.
(getInfo(Node)): Likewise.
(getInformationDesc(Node)): Likewise.
(getApplet(Node)): Likewise.
(getApplication(Node)): Likewise.
(splitString(String)): Likewise.
(getLocales(Node)): Likewise.
(getChildNodes(Node,String)): Likewise.
* netx/net/sourceforge/jnlp/PluginBridge.java:
Fix variable naming and add generic types.
(cacheJars): Changed from cache_jars.
(cacheExJars): Changed from cache_ex-jars.
(atts): Add generic typing.
(PluginBridge(URL,URL,String,String,int,int,Hashtable)): Likewise.
(getInformation(Locale)): Likewise.
(getResources(Locale,String,String)): Likewise.
(getJARs()): Avoid excessive copying; filtering already performed
by getResources in JNLPFile.
* netx/net/sourceforge/jnlp/ResourcesDesc.java:
(resources): Add generic typing.
(getJREs()): Likewise.
(getJARs()): Likewise.
(getJARs(String)): Likewise.
(getExtensions()): Likewise.
(getPackages()): Likewise.
(getPackages(String)): Likewise.
(getProperties()): Likewise.
(getPropertiesMap()): Likewise.
(getResources(Class)): Make generic.
* netx/net/sourceforge/jnlp/Version.java:
(matches(Version)): Add generic types.
(matchesAny(Version)): Likewise.
(matchesSingle(String)): Likewise.
(matches(String,String)): Likewise.
(equal(List,List)): Likewise.
(greater(List,List)): Likewise.
(compare(String,String)): Use Integer.valueOf.
(normalize(List,int)): Add generic types, using
a List of lists rather than an array of lists.
(getVersionStrings()): Add generic types.
(getParts()): Likewise.
* netx/net/sourceforge/jnlp/cache/CacheUtil.java:
(waitForResources(ApplicationInstance,ResourceTracker,
URL,String)): Likewise.
* netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java:
(getListener(ApplicatonInstance,String,URL)): Use setVisible instead
of show().
(disposeListener(DownloadServiceListener)): Use setVisible instead
of hide().
(DownloadPanel.urls): Add generic typing.
(DownloadPanel.panels): Likewise.
(DownloadPanel.update(URL,String,long,long,int)): Fix formatting.
Add generic types.
* netx/net/sourceforge/jnlp/cache/Resource.java:
(resources): Add generic typing.
(trackers): Likewise.
(getResource(URL,Version,UpdatePolicy)): Use generic types.
(getTracker()): Likewise.
(addTracker(ResourceTracker)): Likewise.
(fireDownloadEvent()): Likewise.
* netx/net/sourceforge/jnlp/cache/ResourceTracker.java:
(prefetchTrackers): Add generic typing.
(queue): Likewise.
(active): Likewise.
(resources): Likewise.
(listeners): Likewise.
(fireDownloadEvent(Resource)): Remove unneeded cast.
(getPrefetch()): Use generic typing.
(selectByFlag(List,int,int)): Likewise.
(getResource(URL)): Likewise.
* netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java:
(weakClips): Add generic types.
(destroy()): Use generic typing.
(getApplets()): Likewise.
(getStreamKeys()): Likewise.
* netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java:
(weakWindows): Add generic types.
(installEnvironment()): Likewise.
(destroy()): Remove redundant cast.
* netx/net/sourceforge/jnlp/runtime/Boot.java:
Extend PrivilegedAction<Void>.
(run()): Add generic typing.
(getOptions(String)): Likewise.
* netx/net/sourceforge/jnlp/runtime/Boot13.java:
(main(String[]): Likewise.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java:
Fix formatting.
(urlToLoader): Add generic types.
(resourcePermissions): Likewise.
(available): Likewise.
(jarEntries): Likewise.
(getInstance(JNLPFile,UpdatePolicy)): Remove redundant cast.
(getInstance(URL,String,Version,UpdatePolicy)): Likewise.
(initializeExtensions()): Add generic types.
(initializePermissions()): Likewise.
(initializeResources()): Likewise.
(getPermissions(CodeSource)): Likewise.
(fillInPartJars(List)): Likewise.
(activateJars(List)): Likewise.
(loadClass(String)): Likewise. Suppress warnings due to
sun.misc.JarIndex usage.
(findResources(String)): Mark as overriding. Add generic
types.
(getExtensionName()): Add @Deprecated annotation.
(getExtensionHREF()): Likewise.
* netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java:
(weakWindows): Add generic typing.
(weakApplications): Likewise.
(getApplication(Window)): Remove redundant casts. Add w,
which is window cast to Window.
* netx/net/sourceforge/jnlp/services/ServiceUtil.java:
(invoke(Object,Method,Object[])): Use generic types.
* netx/net/sourceforge/jnlp/services/XPersistenceService.java:
(getNames(URL)): Likewise.
* netx/net/sourceforge/jnlp/tools/JarSigner.java:
(verifyJars(List,ResourceTracker)): Remove redundant cast.
* netx/net/sourceforge/jnlp/util/WeakList.java:
Redesign as a generic type.
(refs): Add generic types.
(deref(WeakReference)): Likewise.
(get(int)): Likewise.
(set(int,Object)): Likewise.
(add(int,E)): Likewise.
(remove()): Likewise.
(hardList()): Likewise.
* netx/net/sourceforge/nanoxml/XMLElement.java:
(attributes): Add generic typing.
(children): Likewise.
(entities): Likewise.
(XMLElement()): Use generic types.
(XMLElement(Hashtable): Likewise.
(resolveEntity(StringBuffer)): Remove redundant cast.
Diffstat (limited to 'netx/net/sourceforge/jnlp/Parser.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/Parser.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/netx/net/sourceforge/jnlp/Parser.java b/netx/net/sourceforge/jnlp/Parser.java index 9c44f69..758b00d 100644 --- a/netx/net/sourceforge/jnlp/Parser.java +++ b/netx/net/sourceforge/jnlp/Parser.java @@ -239,8 +239,10 @@ class Parser { * @param j2se true if the resources are located under a j2se or java node * @throws ParseException if the JNLP file is invalid */ - public List getResources(Node parent, boolean j2se) throws ParseException { - List result = new ArrayList(); + public List<ResourcesDesc> getResources(Node parent, boolean j2se) + throws ParseException + { + List<ResourcesDesc> result = new ArrayList<ResourcesDesc>(); Node resources[] = getChildNodes(parent, "resources"); // ensure that there are at least one information section present @@ -433,8 +435,10 @@ class Parser { * @param parent the parent node (jnlp) * @throws ParseException if the JNLP file is invalid */ - public List getInfo(Node parent) throws ParseException { - List result = new ArrayList(); + public List<InformationDesc> getInfo(Node parent) + throws ParseException + { + List<InformationDesc> result = new ArrayList<InformationDesc>(); Node info[] = getChildNodes(parent, "information"); // ensure that there are at least one information section present @@ -455,7 +459,7 @@ class Parser { * @throws ParseException if the JNLP file is invalid */ public InformationDesc getInformationDesc(Node node) throws ParseException { - List descriptionsUsed = new ArrayList(); + List<String> descriptionsUsed = new ArrayList<String>(); // locale Locale locales[] = getLocales(node); @@ -642,7 +646,7 @@ class Parser { String name = getRequiredAttribute(node, "name", R("PUnknownApplet")); String main = getRequiredAttribute(node, "main-class", null); URL docbase = getURL(node, "documentbase", base); - Map paramMap = new HashMap(); + Map<String,String> paramMap = new HashMap<String,String>(); int width = 0; int height = 0; @@ -673,7 +677,7 @@ class Parser { */ public ApplicationDesc getApplication(Node node) throws ParseException { String main = getAttribute(node, "main-class", null); - List argsList = new ArrayList(); + List<String> argsList = new ArrayList<String>(); // if (main == null) // only ok if can be found in main jar file (can't check here but make a note) @@ -687,8 +691,7 @@ class Parser { argsList.add( getSpanText(args[i]) ); } - String argStrings[] = - (String[]) argsList.toArray( new String[argsList.size()] ); + String argStrings[] = argsList.toArray( new String[argsList.size()] ); return new ApplicationDesc(main, argStrings); } @@ -825,9 +828,9 @@ class Parser { if (source == null) return new String[0]; - List result = new ArrayList(); + List<String> result = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(source, " "); - StringBuffer part = new StringBuffer(); + StringBuilder part = new StringBuilder(); while (st.hasMoreTokens()) { part.setLength(0); @@ -849,7 +852,7 @@ class Parser { result.add( part.toString() ); } - return (String[]) result.toArray(new String[result.size()] ); + return result.toArray(new String[result.size()] ); } /** @@ -858,7 +861,7 @@ class Parser { * @param node the node with a locale attribute */ public Locale[] getLocales(Node node) { - List locales = new ArrayList(); + List<Locale> locales = new ArrayList<Locale>(); String localeParts[] = splitString(getAttribute(node, "locale", "")); @@ -868,7 +871,7 @@ class Parser { locales.add(l); } - return (Locale[]) locales.toArray(new Locale[locales.size()] ); + return locales.toArray(new Locale[locales.size()] ); } /** @@ -936,7 +939,7 @@ class Parser { * Returns all child nodes with the specified name. */ public static Node[] getChildNodes(Node node, String name) { - List result = new ArrayList(); + List<Node> result = new ArrayList<Node>(); Node child = node.getFirstChild(); while (child != null) { @@ -945,7 +948,7 @@ class Parser { child = child.getNextSibling(); } - return (Node[]) result.toArray( new Node[result.size()] ); + return result.toArray( new Node[result.size()] ); } |