changeset 12909:1cb3c2d2dab9

Minor jar tool cleanup
author chegar
date Tue, 02 Jun 2015 13:02:09 +0100
parents 70d338e5ef2d
children f77ef662a1b0
files src/jdk.jartool/share/classes/sun/tools/jar/Main.java src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties
diffstat 2 files changed, 9 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Tue Jun 02 11:36:10 2015 +0100
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	Tue Jun 02 13:02:09 2015 +0100
@@ -598,28 +598,21 @@
      * can be found by recursively descending directories.
      */
     void expand(File dir, String[] files, boolean isUpdate) throws IOException {
-        if (files == null) {
+        if (files == null)
             return;
-        }
+
         for (int i = 0; i < files.length; i++) {
             File f;
-            if (dir == null) {
+            if (dir == null)
                 f = new File(files[i]);
-            } else {
+            else
                 f = new File(dir, files[i]);
-            }
+
             if (f.isFile()) {
                 String path = f.getPath();
-                if (path.endsWith(MODULE_INFO)) {  // TODO: must be in the root
-//                    int idx;
-//                    if ((idx = path.indexOf(File.separator)) != -1) {
-//                        if (!(idx == 1 && path.charAt(0) == '.')) {
-//                            throw new IOException(formatMsg("error.unexpected.module-info", path));
-//                        }
-//                    }
-                    if (moduleInfo != null) {
-                        throw new IOException(formatMsg("error.unexpected.module-info", path));
-                    }
+                if (entryName(path).equals(MODULE_INFO)) {
+                    if (moduleInfo != null && vflag)
+                        output(formatMsg("error.unexpected.module-info", path));
                     moduleInfo = f.toPath();
                     if (isUpdate)
                         entryMap.put(entryName(path), f);
@@ -1464,7 +1457,7 @@
      * Prints usage message.
      */
     void usageError() {
-        error(getMsg("usage"));
+        Info.USAGE_SUMMARY.print(err);
     }
 
     /**
--- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties	Tue Jun 02 11:36:10 2015 +0100
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties	Tue Jun 02 13:02:09 2015 +0100
@@ -117,14 +117,6 @@
 main.usage.summary.try=\
 Try `jar --help' or `jar --usage' for more information.
 
-main.usage=\
-Usage: jar <create|list> <options> jmod-file\n\
-\  create  - Creates a new jmod archive\n\
-\  list    - Prints the names of all the entries in the jmod\n\
-\n\
-Possible options include:
-
-
 main.help.preopt=\
 Usage: jar [OPTION...] [-C dir] files ...\n\
 jar creates an archive for classes and resources, and can manipulate or\n\