changeset 252:a25cdbe75706

Change jar resource names to be stored in HashSet instead of String[].
author Andrew Su <asu@redhat.com>
date Wed, 08 Jun 2011 16:12:38 -0400
parents 2cfa903b7216
children 011a29a0d8a2
files ChangeLog netx/net/sourceforge/jnlp/PluginBridge.java
diffstat 2 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 08 14:38:52 2011 -0400
+++ b/ChangeLog	Wed Jun 08 16:12:38 2011 -0400
@@ -1,3 +1,10 @@
+2011-07-08  Andrew Su  <asu@redhat.com>
+
+	* netx/net/sourceforge/jnlp/PluginBridge.java:
+	(jars): Changed to use HashSet instead of String[].
+	(PluginBridge): Updated to work with HashSet instead of String[]
+	(getResources): Likewise.
+
 2011-06-08  Deepak Bhole <dbhole@redhat.com>
 
 	PR721: IcedTeaPlugin.so cannot run g_main_context_iteration on a different
--- a/netx/net/sourceforge/jnlp/PluginBridge.java	Wed Jun 08 14:38:52 2011 -0400
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java	Wed Jun 08 16:12:38 2011 -0400
@@ -24,7 +24,9 @@
 
 import java.net.URL;
 import java.net.MalformedURLException;
+import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Locale;
 import java.util.List;
 import java.util.ArrayList;
@@ -35,7 +37,7 @@
 public class PluginBridge extends JNLPFile {
 
     String name;
-    String[] jars = new String[0];
+    HashSet<String> jars = new HashSet<String>();
     String[] cacheJars = new String[0];
     String[] cacheExJars = new String[0];
     Hashtable<String, String> atts;
@@ -101,11 +103,13 @@
         }
 
         if (jar != null && jar.length() > 0) {
-            this.jars = jar.split(",");
+            String[] jars = jar.split(",");
 
             // trim white spaces
-            for (int i = 0; i < this.jars.length; i++) {
-                this.jars[i] = this.jars[i].trim();
+            for (int i = 0; i < jars.length; i++) {
+                String jarName = jars[i].trim();
+                if (jarName.length() > 0)
+                    this.jars.add(jarName);
             }
 
             if (JNLPRuntime.isDebug()) {
@@ -191,10 +195,13 @@
                         List<JARDesc> jarDescs = new ArrayList<JARDesc>();
                         jarDescs.addAll(sharedResources.getResources(JARDesc.class));
 
-                        for (int i = 0; i < jars.length; i++)
-                            if (jars[i].length() > 0)
-                                jarDescs.add(new JARDesc(new URL(codeBase, jars[i]),
+                        Iterator<String> it = jars.iterator();
+                        while(it.hasNext()) {
+                            String name = it.next();
+                            if (name.length() > 0)
+                                jarDescs.add(new JARDesc(new URL(codeBase, name),
                                         null, null, false, true, false, true));
+                        }
 
                         boolean cacheable = true;