[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    /hg/icedtea-web: Make getMainClass()'s return value consistent f...
From:       omajid () icedtea ! classpath ! org (omajid at icedtea ! classpath ! org)
Date:       2011-09-28 22:19:52
Message-ID: hg.fb883fdc9331.1317248392.8643924302249223276 () icedtea ! classpath ! org
[Download RAW message or body]

changeset fb883fdc9331 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=fb883fdc9331
author: Omair Majid <omajid at redhat.com>
date: Wed Sep 28 18:17:13 2011 -0400

	Make getMainClass()'s return value consistent for AppletDesc and
	ApplicationDesc

	2011-09-28 Omair Majid <omajid at redhat.com>

	 * netx/net/sourceforge/jnlp/AppletDesc.java (getMainClass):
	Clarify the return value in javadoc.
	    * netx/net/sourceforge/jnlp/Launcher.java (createApplet,
	createAppletObject): Do not replace '/' with '.'.
	    * netx/net/sourceforge/jnlp/PluginBridge.java (PluginBridge): Ensure
	that the class name is in the dot-separated from.
	    * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
	(checkForMain): Ensure that the name is an exact match.


diffstat:

 ChangeLog                                              |  11 +++++++++++
 netx/net/sourceforge/jnlp/AppletDesc.java              |   2 +-
 netx/net/sourceforge/jnlp/Launcher.java                |   8 --------
 netx/net/sourceforge/jnlp/PluginBridge.java            |   4 +++-
 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |   5 ++---
 5 files changed, 17 insertions(+), 13 deletions(-)

diffs (91 lines):

diff -r 477780fe79ae -r fb883fdc9331 ChangeLog
--- a/ChangeLog	Wed Sep 28 15:28:14 2011 -0400
+++ b/ChangeLog	Wed Sep 28 18:17:13 2011 -0400
@@ -1,3 +1,14 @@
+2011-09-28 Omair Majid <omajid at redhat.com>
+
+	* netx/net/sourceforge/jnlp/AppletDesc.java (getMainClass): Clarify the
+	return value in javadoc.
+	* netx/net/sourceforge/jnlp/Launcher.java
+	(createApplet, createAppletObject): Do not replace '/' with '.'.
+	* netx/net/sourceforge/jnlp/PluginBridge.java (PluginBridge): Ensure that
+	the class name is in the dot-separated from.
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+	(checkForMain): Ensure that the name is an exact match.
+
 2011-09-28  Deepak Bhole <dbhole at redhat.com>
 
 	PR794: IcedTea-Web does not work if a Web Start app jar has a Class-Path
diff -r 477780fe79ae -r fb883fdc9331 netx/net/sourceforge/jnlp/AppletDesc.java
--- a/netx/net/sourceforge/jnlp/AppletDesc.java	Wed Sep 28 15:28:14 2011 -0400
+++ b/netx/net/sourceforge/jnlp/AppletDesc.java	Wed Sep 28 18:17:13 2011 -0400
@@ -73,7 +73,7 @@
     }
 
     /**
-     * Returns the main class name
+     * Returns the main class name in the dot-separated form (eg: foo.bar.Baz)
      */
     public String getMainClass() {
         return mainClass;
diff -r 477780fe79ae -r fb883fdc9331 netx/net/sourceforge/jnlp/Launcher.java
--- a/netx/net/sourceforge/jnlp/Launcher.java	Wed Sep 28 15:28:14 2011 -0400
+++ b/netx/net/sourceforge/jnlp/Launcher.java	Wed Sep 28 18:17:13 2011 -0400
@@ -704,10 +704,6 @@
             ThreadGroup group = Thread.currentThread().getThreadGroup();
 
             String appletName = file.getApplet().getMainClass();
-
-            //Classloader chokes if there's '/' in the path to the main class.
-            //Must replace with '.' instead.
-            appletName = appletName.replace('/', '.');
             Class appletClass = loader.loadClass(appletName);
             Applet applet = (Applet) appletClass.newInstance();
 
@@ -744,10 +740,6 @@
             }
 
             String appletName = file.getApplet().getMainClass();
-
-            //Classloader chokes if there's '/' in the path to the main class.
-            //Must replace with '.' instead.
-            appletName = appletName.replace('/', '.');
             Class appletClass = loader.loadClass(appletName);
             Applet applet = (Applet) appletClass.newInstance();
 
diff -r 477780fe79ae -r fb883fdc9331 netx/net/sourceforge/jnlp/PluginBridge.java
--- a/netx/net/sourceforge/jnlp/PluginBridge.java	Wed Sep 28 15:28:14 2011 -0400
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java	Wed Sep 28 18:17:13 2011 -0400
@@ -133,7 +133,9 @@
         if (main.endsWith(".class"))
             main = main.substring(0, main.length() - 6);
 
-        launchType = new AppletDesc(name, main, documentBase, width,
+        // the class name should be of the form foo.bar.Baz not foo/bar/Baz
+        String mainClass = main.replace('/', '.');
+        launchType = new AppletDesc(name, mainClass, documentBase, width,
                                     height, atts);
 
         if (main.endsWith(".class")) //single class file only
diff -r 477780fe79ae -r fb883fdc9331 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Wed Sep 28 15:28:14 2011 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Wed Sep 28 18:17:13 2011 -0400
@@ -580,6 +580,7 @@
             mainClass = ad.getMainClass();
         } else
             return;
+        String desiredJarEntryName = mainClass + ".class";
 
         for (int i = 0; i < jars.size(); i++) {
 
@@ -599,9 +600,7 @@
                 while (entries.hasMoreElements()) {
                     je = entries.nextElement();
                     String jeName = je.getName().replaceAll("/", ".");
-
-                    if (!jeName.startsWith(mainClass + "$Inner")
-                            && (jeName.startsWith(mainClass) && jeName.endsWith(".class"))) {
+                    if (jeName.equals(desiredJarEntryName)) {
                         foundMainJar = true;
                         verifySignedJNLP(jars.get(i), jarFile);
                         break;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic