src/jdk.jartool/share/classes/sun/tools/jar/Main.java

Print this page



 757                 }
 758             }
 759         } catch (ArrayIndexOutOfBoundsException e) {
 760             usageError();
 761             return false;
 762         }
 763 
 764         if (info != null) {
 765             info.print(out);
 766             return true;
 767         }
 768 
 769         if (!cflag && !tflag && !xflag && !uflag && !iflag && !printModuleDescriptor) {
 770             error(getMsg("error.bad.option"));
 771             usageError();
 772             return false;
 773         }
 774         /* parse file arguments */
 775         int n = args.length - count;
 776         if (n > 0) {






 777             int version = BASE_VERSION;
 778             int k = 0;
 779             String[] nameBuf = new String[n];
 780             pathsMap.put(version, new HashSet<>());
 781             try {
 782                 for (int i = count; i < args.length; i++) {
 783                     if (args[i].equals("-C")) {
 784                         /* change the directory */
 785                         String dir = args[++i];
 786                         dir = (dir.endsWith(File.separator) ?
 787                                dir : (dir + File.separator));
 788                         dir = dir.replace(File.separatorChar, '/');
 789                         while (dir.indexOf("//") > -1) {
 790                             dir = dir.replace("//", "/");
 791                         }
 792                         pathsMap.get(version).add(dir.replace(File.separatorChar, '/'));
 793                         nameBuf[k++] = dir + args[++i];
 794                     } else if (args[i].startsWith("--release")) {
 795                         int v = BASE_VERSION;
 796                         try {



 757                 }
 758             }
 759         } catch (ArrayIndexOutOfBoundsException e) {
 760             usageError();
 761             return false;
 762         }
 763 
 764         if (info != null) {
 765             info.print(out);
 766             return true;
 767         }
 768 
 769         if (!cflag && !tflag && !xflag && !uflag && !iflag && !printModuleDescriptor) {
 770             error(getMsg("error.bad.option"));
 771             usageError();
 772             return false;
 773         }
 774         /* parse file arguments */
 775         int n = args.length - count;
 776         if (n > 0) {
 777             if (printModuleDescriptor) {
 778                 // "--print-module-descriptor/-d" does not require file argument(s)
 779                 error(formatMsg("error.bad.dflag", args[count]));
 780                 usageError();
 781                 return false;
 782             }
 783             int version = BASE_VERSION;
 784             int k = 0;
 785             String[] nameBuf = new String[n];
 786             pathsMap.put(version, new HashSet<>());
 787             try {
 788                 for (int i = count; i < args.length; i++) {
 789                     if (args[i].equals("-C")) {
 790                         /* change the directory */
 791                         String dir = args[++i];
 792                         dir = (dir.endsWith(File.separator) ?
 793                                dir : (dir + File.separator));
 794                         dir = dir.replace(File.separatorChar, '/');
 795                         while (dir.indexOf("//") > -1) {
 796                             dir = dir.replace("//", "/");
 797                         }
 798                         pathsMap.get(version).add(dir.replace(File.separatorChar, '/'));
 799                         nameBuf[k++] = dir + args[++i];
 800                     } else if (args[i].startsWith("--release")) {
 801                         int v = BASE_VERSION;
 802                         try {