logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r369263 - /logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java
Date Sun, 15 Jan 2006 21:18:17 GMT
Author: psmith
Date: Sun Jan 15 13:18:08 2006
New Revision: 369263

URL: http://svn.apache.org/viewcvs?rev=369263&view=rev
Log:
After quite a bit of fiddling I realised that Sun is stupid.

The main-class being run under Java Webstart must be in the first jar
listed.

Changed the script so a sort is used to guarantee that the chainsaw jar
is placed ahead of all the others when creating the JNLP file.

Modified:
    logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java

Modified: logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java
URL: http://svn.apache.org/viewcvs/logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java?rev=369263&r1=369262&r2=369263&view=diff
==============================================================================
--- logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java (original)
+++ logging/chainsaw/trunk/anttasks-src/org/apache/chainsaw/ant/CreateShellScripts.java Sun
Jan 15 13:18:08 2006
@@ -5,12 +5,11 @@
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
@@ -86,7 +85,27 @@
         }
         
         StringBuffer jarBuf = new StringBuffer();
-        for (Iterator iter = filenames.iterator(); iter.hasNext();) {
+        
+//        TODO  MUST place chainsaw jar that contains the main class entry as the first jar
output...
+        /**
+         * Good one Sun!  For some stupid reason, we MUST list the jar that contains the
main-class
+         * FIRST.  Why? Why? WHYYYYYYYYYYYYYYYYYY?
+         * 
+         * So, we sort a copied list and make sure that the chainsaw jar is first.
+         */
+        List list = new ArrayList(filenames);
+        Collections.sort(list, new Comparator() {
+
+            public int compare(Object o1, Object o2) {
+                if(o1.toString().toLowerCase().indexOf("chainsaw")>-1) {
+                    return -1;
+                }else if(o2.toString().toLowerCase().indexOf("chainsaw")>-1) {
+                    return 1;
+                }else {
+                    return 0;
+                }
+            }});
+        for (Iterator iter = list.iterator(); iter.hasNext();) {
             String jar = (String) iter.next();
             jarBuf.append("\t<jar href=\"lib/"+jar + "\"/>\n");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message