/hg/icedtea-web: fix to ManifestedJar1Test cases

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Mon Nov 25 01:10:26 PST 2013


changeset bf80f38923af in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=bf80f38923af
author: Jiri Vanek <jvanek at redhat.com>
date: Mon Nov 25 10:16:42 2013 +0100

	fix to ManifestedJar1Test cases

	* netx/net/sourceforge/jnlp/ResourcesDesc.java: (getMainJAR) throw an RuntimeException when more then one main jar is specified. Preventing app to start.
	* tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java:(manifestedJar1main2mainNoAppDesc), (manifestedJar1nothing2nothingAppDesc)fixed and adapted to change.


diffstat:

 ChangeLog                                                                 |   9 ++++++++
 netx/net/sourceforge/jnlp/ResourcesDesc.java                              |  11 +++++++++-
 tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java |   7 ++---
 3 files changed, 22 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r bc73a1362e9c -r bf80f38923af ChangeLog
--- a/ChangeLog	Fri Nov 22 12:12:48 2013 +0100
+++ b/ChangeLog	Mon Nov 25 10:16:42 2013 +0100
@@ -1,3 +1,12 @@
+2013-11-25  Jiri Vanek  <jvanek at redhat.com>
+
+	* netx/net/sourceforge/jnlp/ResourcesDesc.java: (getMainJAR) throw an
+	RuntimeException when more then one main jar is specified. Preventing
+	app to start.
+	* tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java:
+	(manifestedJar1main2mainNoAppDesc), (manifestedJar1nothing2nothingAppDesc)
+	fixed and adapted to change.
+
 2013-11-22  Jiri Vanek  <jvanek at redhat.com>
 
 	* tests/netx/unit/net/sourceforge/jnlp/DefaultLaunchHandlerTest.java: (init)
diff -r bc73a1362e9c -r bf80f38923af netx/net/sourceforge/jnlp/ResourcesDesc.java
--- a/netx/net/sourceforge/jnlp/ResourcesDesc.java	Fri Nov 22 12:12:48 2013 +0100
+++ b/netx/net/sourceforge/jnlp/ResourcesDesc.java	Mon Nov 25 10:16:42 2013 +0100
@@ -72,11 +72,20 @@
     }
 
     public static JARDesc getMainJAR(List<JARDesc> jars) {
+        JARDesc markedMain = null;
         for (JARDesc jar : jars) {
             if (jar.isMain()) {
-                return jar;
+                if (markedMain == null){
+                markedMain = jar;
+                } else {
+                    //more then one main jar specified. It stinks. Return null to die later null;
+                    throw new RuntimeException("Multiple main JARs specified, refusing to continue.");
+                }
             }
         }
+        if (markedMain!=null){
+            return markedMain;
+        }
 
         if (jars.size() > 0) {
             return jars.get(0);
diff -r bc73a1362e9c -r bf80f38923af tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
--- a/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java	Fri Nov 22 12:12:48 2013 +0100
+++ b/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java	Mon Nov 25 10:16:42 2013 +0100
@@ -155,14 +155,13 @@
      *
      * Two jars, both with manifest, sboth with main tag, no app desc
      *
-     * thisis passing, SUSPICIOUS, but to lunch at least something is better then to lunch nothing at all.
-     * althoug it maybe SHOULD throw twoMainException
      */
     @Test
     public void manifestedJar1main2mainNoAppDesc() throws Exception {
         String id = "ManifestedJar-1main2mainNoAppDesc";
         ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
-        assertManifestedJar1(id, pr);
+        assertNotManifestedJar1(id, pr);
+        assertNotManifestedJar2(id, pr);
         assertNotDead(id, pr);
     }
 
@@ -210,7 +209,7 @@
     public void manifestedJar1nothing2nothingAppDesc() throws Exception {
         String id = "ManifestedJar-1nothing2nothingAppDesc";
         ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp");
-        assertNotManifestedJar2(id, pr);
+        assertManifestedJar2(id, pr);
         assertNotManifestedJar1(id, pr);
         assertNotDead(id, pr);
     }


More information about the distro-pkg-dev mailing list