private void disallowedInRubyOpts(CharSequence option) { if (rubyOpts) { throw new MainExitException(1, "jruby: invalid switch in RUBYOPT: " + option + " (RuntimeError)"); } }
private void disallowedInRubyOpts(CharSequence option) { if (rubyOpts) { throw new MainExitException(1, "jruby: invalid switch in RUBYOPT: " + option + " (RuntimeError)"); } }
private static void errorMissingEquals(String label) { MainExitException mee; mee = new MainExitException(1, "missing argument for --" + label + "\n"); mee.setUsageError(true); throw mee; }
private static void errorMissingEquals(String label) { MainExitException mee; mee = new MainExitException(1, "missing argument for --" + label + "\n"); mee.setUsageError(true); throw mee; }
private String grabValue(String errorMessage) { String optValue = grabOptionalValue(); if (optValue != null) { return optValue; } argumentIndex++; if (argumentIndex < arguments.size()) { return arguments.get(argumentIndex).originalValue; } MainExitException mee = new MainExitException(1, errorMessage); mee.setUsageError(true); throw mee; }
private String grabValue(String errorMessage, boolean usageError) { String optValue = grabOptionalValue(); if (optValue != null) { return optValue; } argumentIndex++; if (argumentIndex < arguments.size()) { return arguments.get(argumentIndex).originalValue; } MainExitException mee = new MainExitException(1, errorMessage); if (usageError) mee.setUsageError(true); throw mee; }
private void processEncodingOption(String value) { List<String> encodings = StringSupport.split(value, ':', 3); switch (encodings.size()) { case 3: throw new MainExitException(1, "extra argument for -E: " + encodings.get(2)); case 2: config.setInternalEncoding(encodings.get(1)); case 1: config.setExternalEncoding(encodings.get(0)); // Zero is impossible } }
private String grabValue(String errorMessage, boolean usageError) { String optValue = grabOptionalValue(); if (optValue != null) { return optValue; } argumentIndex++; if (argumentIndex < arguments.size()) { return arguments.get(argumentIndex).originalValue; } MainExitException mee = new MainExitException(1, errorMessage); if (usageError) mee.setUsageError(true); throw mee; }
private String grabValue(String errorMessage) { String optValue = grabOptionalValue(); if (optValue != null) { return optValue; } argumentIndex++; if (argumentIndex < arguments.size()) { return arguments.get(argumentIndex).originalValue; } MainExitException mee = new MainExitException(1, errorMessage); mee.setUsageError(true); throw mee; }
private void processEncodingOption(String value) { List<String> encodings = StringSupport.split(value, ':', 3); switch (encodings.size()) { case 3: throw new MainExitException(1, "extra argument for -E: " + encodings.get(2)); case 2: config.setInternalEncoding(encodings.get(1)); case 1: config.setExternalEncoding(encodings.get(0)); // Zero is impossible } }
private void processEncodingOption(String value) { String[] encodings = value.split(":", 3); switch (encodings.length) { case 3: throw new MainExitException(1, "extra argument for -E: " + encodings[2]); case 2: config.setInternalEncoding(encodings[1]); case 1: config.setExternalEncoding(encodings[0]); // Zero is impossible } }
private void processEncodingOption(String value) { String[] encodings = value.split(":", 3); switch (encodings.length) { case 3: throw new MainExitException(1, "extra argument for -E: " + encodings[2]); case 2: config.setInternalEncoding(encodings[1]); case 1: config.setExternalEncoding(encodings[0]); // Zero is impossible } }
return new BufferedInputStream(is, 8129); throw new MainExitException(1, "Error opening script file: " + e.getMessage());
return new BufferedInputStream(is, 8129); throw new MainExitException(1, "Error opening script file: " + e.getMessage());
private static void exit(Ruby runtime, IRubyObject[] args, boolean hard) { int status = hard ? 1 : 0; String message = null; if (args.length > 0) { RubyObject argument = (RubyObject) args[0]; if (argument instanceof RubyBoolean) { status = argument.isFalse() ? 1 : 0; } else { status = RubyNumeric.fix2int(argument); } } if (args.length == 2) { if (args[1] instanceof RubyString) { message = ((RubyString) args[1]).toString(); } } if (hard) { if (runtime.getInstanceConfig().isHardExit()) { System.exit(status); } else { throw new MainExitException(status, true); } } else { if (message == null) { throw runtime.newSystemExit(status); } else { throw runtime.newSystemExit(status, message); } } }
private static void exit(Ruby runtime, IRubyObject[] args, boolean hard) { int status = hard ? 1 : 0; String message = null; if (args.length > 0) { RubyObject argument = (RubyObject) args[0]; if (argument instanceof RubyBoolean) { status = argument.isFalse() ? 1 : 0; } else { status = RubyNumeric.fix2int(argument); } } if (args.length == 2) { if (args[1] instanceof RubyString) { message = ((RubyString) args[1]).toString(); } } if (hard) { if (runtime.getInstanceConfig().isHardExit()) { System.exit(status); } else { throw new MainExitException(status, true); } } else { if (message == null) { throw runtime.newSystemExit(status); } else { throw runtime.newSystemExit(status, message); } } }
private static void exit(Ruby runtime, IRubyObject[] args, boolean hard) { int status = hard ? 1 : 0; String message = null; if (args.length > 0) { RubyObject argument = (RubyObject) args[0]; if (argument instanceof RubyBoolean) { status = argument.isFalse() ? 1 : 0; } else { status = RubyNumeric.fix2int(argument); } } if (args.length == 2) { if (args[1] instanceof RubyString) { message = ((RubyString) args[1]).toString(); } } if (hard) { if (runtime.getInstanceConfig().isHardExit()) { System.exit(status); } else { throw new MainExitException(status, true); } } else { if (message == null) { throw runtime.newSystemExit(status); } else { throw runtime.newSystemExit(status, message); } } }
private static void exit(Ruby runtime, IRubyObject[] args, boolean hard) { int status = hard ? 1 : 0; String message = null; if (args.length > 0) { RubyObject argument = (RubyObject) args[0]; if (argument instanceof RubyBoolean) { status = argument.isFalse() ? 1 : 0; } else { status = RubyNumeric.fix2int(argument); } } if (args.length == 2) { if (args[1] instanceof RubyString) { message = ((RubyString) args[1]).toString(); } } if (hard) { if (runtime.getInstanceConfig().isHardExit()) { System.exit(status); } else { throw new MainExitException(status, true); } } else { if (message == null) { throw runtime.newSystemExit(status); } else { throw runtime.newSystemExit(status, message); } } }
throw new MainExitException(1, "Error opening script file: " + e.getMessage());
throw new MainExitException(1, "Error opening script file: " + e.getMessage());