< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SAGetopt.java

Print this page

        

*** 53,67 **** } private void extractOptarg(String opt) { // Argument expected if (_optind > _argv.length) { ! throw new RuntimeException("Not enough arguments for '" + opt + "'"); } if (! _argv[_optind].isEmpty() && _argv[_optind].charAt(0) == '-') { ! throw new RuntimeException("Argument is expected for '" + opt + "'"); } _optarg = _argv[_optind]; _optind += 1; } --- 53,67 ---- } private void extractOptarg(String opt) { // Argument expected if (_optind > _argv.length) { ! throw new SAGetoptException("Not enough arguments for '" + opt + "'"); } if (! _argv[_optind].isEmpty() && _argv[_optind].charAt(0) == '-') { ! throw new SAGetoptException("Argument is expected for '" + opt + "'"); } _optarg = _argv[_optind]; _optind += 1; }
*** 70,80 **** List<String> los = Arrays.asList(longOptStr); String[] ca = carg.split("=", 2); if (los.contains(ca[0])) { if (ca.length > 1) { ! throw new RuntimeException("Argument is not expected for '" + ca[0] + "'"); } return carg; } if (los.contains(ca[0] + "=")) { --- 70,80 ---- List<String> los = Arrays.asList(longOptStr); String[] ca = carg.split("=", 2); if (los.contains(ca[0])) { if (ca.length > 1) { ! throw new SAGetoptException("Argument is not expected for '" + ca[0] + "'"); } return carg; } if (los.contains(ca[0] + "=")) {
*** 85,102 **** else { // Mixed style options --file name try { extractOptarg(ca[0]); } catch (ArrayIndexOutOfBoundsException e) { ! throw new RuntimeException("Argument is expected for '" + ca[0] + "'"); } } return ca[0]; } ! throw new RuntimeException("Invalid option '" + ca[0] + "'"); } public String next(String optStr, String[] longOptStr) { if (_optind >= _argv.length || _argv[_optind] == null) { --- 85,102 ---- else { // Mixed style options --file name try { extractOptarg(ca[0]); } catch (ArrayIndexOutOfBoundsException e) { ! throw new SAGetoptException("Argument is expected for '" + ca[0] + "'"); } } return ca[0]; } ! throw new SAGetoptException("Invalid option '" + ca[0] + "'"); } public String next(String optStr, String[] longOptStr) { if (_optind >= _argv.length || _argv[_optind] == null) {
*** 146,156 **** // Okay, ready to process options like // -abc -d bla -ef int chIndex = optStr.indexOf(ch); if (chIndex == -1) { ! throw new RuntimeException("Invalid option '" + ch + "'"); } if (_optopt >= carg.length()) { _optind += 1; _optreset = true; --- 146,156 ---- // Okay, ready to process options like // -abc -d bla -ef int chIndex = optStr.indexOf(ch); if (chIndex == -1) { ! throw new SAGetoptException("Invalid option '" + ch + "'"); } if (_optopt >= carg.length()) { _optind += 1; _optreset = true;
< prev index next >