I'm checking this in.

This cleans up a tiny detail in the jar -i support.
It also makes it invalid to specify both -M and -m.

Tom

2006-05-14  Tom Tromey  <[EMAIL PROTECTED]>

        * tools/gnu/classpath/tools/jar/Indexer.java
        (writeCommandLineEntries): Simplify insertion.
        * tools/gnu/classpath/tools/jar/Main.java (run): Don't allow both
        -m and -M.

Index: tools/gnu/classpath/tools/jar/Indexer.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Indexer.java,v
retrieving revision 1.1
diff -u -r1.1 Indexer.java
--- tools/gnu/classpath/tools/jar/Indexer.java  14 May 2006 20:38:32 -0000      
1.1
+++ tools/gnu/classpath/tools/jar/Indexer.java  14 May 2006 20:43:23 -0000
@@ -127,8 +127,9 @@
     indexJarFile(contents, parameters.archiveFile, parameters.verbose);
     if (contents.length() != 0)
       {
-        contents.insert(0, (IndexListParser.JAR_INDEX_VERSION_KEY 
-                            + "1.0\n\n"));
+        // Insert in reverse order to avoid computing anything.
+        contents.insert(0, "1.0\n\n");
+        contents.insert(0, IndexListParser.JAR_INDEX_VERSION_KEY);
         ByteArrayInputStream in
           = new ByteArrayInputStream(contents.toString().getBytes());
         writeFile(false, in, IndexListParser.JAR_INDEX_FILE, 
parameters.verbose);
Index: tools/gnu/classpath/tools/jar/Main.java
===================================================================
RCS file: /cvsroot/classpath/classpath/tools/gnu/classpath/tools/jar/Main.java,v
retrieving revision 1.3
diff -u -r1.3 Main.java
--- tools/gnu/classpath/tools/jar/Main.java     14 May 2006 20:38:32 -0000      
1.3
+++ tools/gnu/classpath/tools/jar/Main.java     14 May 2006 20:43:23 -0000
@@ -217,6 +217,8 @@
       throw new OptionException("must specify one of -t, -c, -u, -x, or -i");
     if (changedDirectory != null)
       throw new OptionException("-C argument requires both directory and 
filename");
+    if (! wantManifest && manifestFile != null)
+      throw new OptionException("can't specify both -m and -M");
     Action t = (Action) operationMode.newInstance();
     t.run(this);
   }

Reply via email to