You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2008/03/05 19:51:43 UTC

svn commit: r633972 - /harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java

Author: ayza
Date: Wed Mar  5 10:51:41 2008
New Revision: 633972

URL: http://svn.apache.org/viewvc?rev=633972&view=rev
Log:
Fix for HARMONY-5577 was applied. Now it is possible to specify several jar files in "archive" parameter of "applet" tag.

Modified:
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java?rev=633972&r1=633971&r2=633972&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java (original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletInfo.java Wed Mar  5 10:51:41 2008
@@ -20,6 +20,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
+import java.util.StringTokenizer;
 
 import javax.swing.JLabel;
 
@@ -29,7 +30,7 @@
     
     private URL documentBase;
     private URL codeBase;
-    private URL archive;
+    private URL[] clURLs;
     private String archiveStr;
     private String tagName;
     private int width;
@@ -61,20 +62,6 @@
         this.codeBase = new URL(this.documentBase, (codeBaseStr == null)?"./":codeBaseStr);
     }
 
-    public URL getArchive() {
-        if (archive == null && archiveStr != null) {
-            try {
-                archive = new URL(getCodeBase(), archiveStr);
-            } catch (MalformedURLException _) {                
-            }
-        }
-        return archive;
-    }
-
-    public void setArchive(URL archive) {
-        this.archive = archive;
-    }
-
     public String getParameter(String name) {
         return params.get(name.toUpperCase());
     }
@@ -115,16 +102,40 @@
         if (statusLabel != null)
             statusLabel.setText(text);
     }
-    
-    public URL []getClassLoaderURLs() {
-        archiveStr = getParameter("ARCHIVE");
-    	URL []res = (archive == null && archiveStr == null)?new URL[1]:new URL[2];
-    	switch (res.length) {
-    		case 2: res[1] = getArchive();
-    		case 1: res[0] = getCodeBase();
-    	}
-    	return res;
+
+    public URL[] getClassLoaderURLs() {
+
+        if (clURLs == null) {
+            archiveStr = getParameter("ARCHIVE");
+
+            if (archiveStr == null) {
+                clURLs = new URL[] { getCodeBase() };
+            } else {
+                StringTokenizer st = new StringTokenizer(archiveStr, ", ");
+                int k = 0;
+
+                clURLs = new URL[st.countTokens() + 1];
+                clURLs[k++] = getCodeBase();
+
+                try {
+                    while (st.hasMoreTokens()) {
+                        String token = st.nextToken();
+                        clURLs[k++] = new URL(getCodeBase(), token);
+                    }
+                } catch (MalformedURLException e) {
+                    //TODO add exception handler
+                }
+            }
+
+        }
+
+        return clURLs;
+    }
+
+    public void setClassLoaderURLs(URL[] urls) {
+        this.clURLs = urls;
     }
+
 
     public void setTag(String tagName){
         this.tagName = tagName;