harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r611578 - in /harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer: AppletFrame.java AppletInfo.java HTMLParser.java
Date Sun, 13 Jan 2008 14:12:21 GMT
Author: apetrenko
Date: Sun Jan 13 06:12:19 2008
New Revision: 611578

URL: http://svn.apache.org/viewvc?rev=611578&view=rev
Log:
Patch for HARMONY-5385 "[jdktools][appletviewer] Applet viewer do not handle archive attribute
of applet tag"

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

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java?rev=611578&r1=611577&r2=611578&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
(original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
Sun Jan 13 06:12:19 2008
@@ -23,13 +23,10 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.WindowEvent;
 import java.awt.event.WindowListener;
-import java.beans.PropertyChangeListener;
-import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.HashSet;
 
 import javax.swing.AbstractAction;
-import javax.swing.Action;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JMenu;
@@ -51,9 +48,7 @@
         shutdownHandler.addFrame(this);
         
         // Load applet class
-        URL []urls = new URL[1];
-        urls[0] = appletInfo.getCodeBase();
-        URLClassLoader cl = new URLClassLoader(urls);
+        URLClassLoader cl = new URLClassLoader(appletInfo.getClassLoaderURLs());
         Class clz = cl.loadClass(this.appletInfo.getCode());
         applet = (Applet)clz.newInstance();
         applet.setStub(new ViewerAppletStub(applet, appletInfo));

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=611578&r1=611577&r2=611578&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
Sun Jan 13 06:12:19 2008
@@ -29,6 +29,7 @@
     
     private URL documentBase;
     private URL codeBase;
+    private URL archive;
     private String code;
     private int width;
     private int height;
@@ -59,6 +60,18 @@
         this.codeBase = new URL(this.documentBase, (codeBaseStr == null)?"./":codeBaseStr);
     }
 
+    public URL getArchive() {
+        return archive;
+    }
+
+    public void setArchive(URL archive) {
+        this.archive = archive;
+    }
+
+    public void setArchive(String archive) throws MalformedURLException {
+        this.archive = (archive == null)?null:new URL(this.documentBase, archive);
+    }
+
     public String getParameter(String name) {
         return params.get(name.toUpperCase());
     }
@@ -106,5 +119,14 @@
     public void setStatus(String text) {
         if (statusLabel != null)
             statusLabel.setText(text);
+    }
+    
+    public URL []getClassLoaderURLs() {
+    	URL []res = (archive == null)?new URL[1]:new URL[2];
+    	switch (res.length) {
+    		case 2: res[1] = archive;
+    		case 1: res[0] = codeBase;
+    	}
+    	return res;
     }
 }

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/HTMLParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/HTMLParser.java?rev=611578&r1=611577&r2=611578&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/HTMLParser.java
(original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/HTMLParser.java
Sun Jan 13 06:12:19 2008
@@ -92,6 +92,11 @@
 				} catch (Exception e) {
 					appletInfo.setCodeBase((URL)null);
 				}
+				try {
+					appletInfo.setArchive((String)attributes.getAttribute(HTML.Attribute.ARCHIVE));
+				} catch (MalformedURLException e) {
+					appletInfo.setArchive((URL)null);
+				}
                 appletInfo.setWidth((String)attributes.getAttribute(HTML.Attribute.WIDTH));
                 appletInfo.setHeight((String)attributes.getAttribute(HTML.Attribute.HEIGHT));
                 list.add(appletInfo);



Mime
View raw message