@Override public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException { int ret = 0; if (args[i].startsWith("-Xpof")) { ret = 1; if (args[i].startsWith("-Xpof:typeId=")) { String sTypeId = args[i].substring("-Xpof:typeId=".length()); try { typeId = Long.parseLong(sTypeId); if (typeId < 0) { throw new BadCommandLineException("Initial POF type ID must be a positive integer"); } } catch (NumberFormatException e) { throw new BadCommandLineException("Initial POF type ID must be a positive integer"); } } } return ret; }
/** * Obtains an operand and reports an error if it's not there. */ public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { if (i == args.length || args[i].startsWith("-")) { throw new BadCommandLineException( Messages.format(Messages.MISSING_OPERAND,optionName)); } return args[i]; }
/** * Obtains an operand and reports an error if it's not there. */ public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { if (i == args.length || args[i].startsWith("-")) { throw new BadCommandLineException( Messages.format(Messages.MISSING_OPERAND,optionName)); } return args[i]; }
/** * Obtains an operand and reports an error if it's not there. * * @param optionName * @param args * @param i * @return * @throws com.sun.tools.xjc.BadCommandLineException */ public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { if (i == args.length || args[i].startsWith("-")) { throw new BadCommandLineException( Messages.format(Messages.MISSING_OPERAND, optionName)); } return args[i]; }
/** * Obtains an operand and reports an error if it's not there. * * @param optionName * @param args * @param i * @return * @throws com.sun.tools.xjc.BadCommandLineException */ public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { if (i == args.length || args[i].startsWith("-")) { throw new BadCommandLineException( Messages.format(Messages.MISSING_OPERAND, optionName)); } return args[i]; }
/** * Obtains an operand and reports an error if it's not there. * * @param optionName * @param args * @param i * @return * @throws com.sun.tools.xjc.BadCommandLineException */ public String requireArgument(String optionName, String[] args, int i) throws BadCommandLineException { if (i == args.length || args[i].startsWith("-")) { throw new BadCommandLineException( Messages.format(Messages.MISSING_OPERAND, optionName)); } return args[i]; }
private void parseProxy(String text) throws BadCommandLineException { // syntax is [user[:password]@]proxyHost:proxyPort String token = "([^@:]+)"; Pattern p = Pattern.compile("(?:"+token+"(?:\\:"+token+")?\\@)?"+token+"(?:\\:"+token+")"); Matcher matcher = p.matcher(text); if(!matcher.matches()) throw new BadCommandLineException(Messages.format(Messages.ILLEGAL_PROXY,text)); proxyUser = matcher.group(1); proxyPassword = matcher.group(2); proxyHost = matcher.group(3); proxyPort = matcher.group(4); try { Integer.valueOf(proxyPort); } catch (NumberFormatException e) { throw new BadCommandLineException(Messages.format(Messages.ILLEGAL_PROXY,text)); } }
private void parseProxy(String text) throws BadCommandLineException { // syntax is [user[:password]@]proxyHost:proxyPort String token = "([^@:]+)"; Pattern p = Pattern.compile("(?:"+token+"(?:\\:"+token+")?\\@)?"+token+"(?:\\:"+token+")"); Matcher matcher = p.matcher(text); if(!matcher.matches()) throw new BadCommandLineException(Messages.format(Messages.ILLEGAL_PROXY,text)); proxyUser = matcher.group(1); proxyPassword = matcher.group(2); proxyHost = matcher.group(3); proxyPort = matcher.group(4); try { Integer.valueOf(proxyPort); } catch (NumberFormatException e) { throw new BadCommandLineException(Messages.format(Messages.ILLEGAL_PROXY,text)); } }
public void parseArguments(String[] args) throws BadCommandLineException { for (int i = 0 ; i <args.length; i++) { if (args[i].charAt(0)== '-') { int j = parseArgument(args,i); if(j==0) throw new BadCommandLineException( Messages.UNRECOGNIZED_PARAMETER.format(args[i])); i += j; } else { arguments.add(args[i]); } } }
public void parseArguments(String[] args) throws BadCommandLineException { for (int i = 0 ; i <args.length; i++) { if (args[i].charAt(0)== '-') { int j = parseArgument(args,i); if(j==0) throw new BadCommandLineException( Messages.UNRECOGNIZED_PARAMETER.format(args[i])); i += j; } else { arguments.add(args[i]); } } }
/** * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization. */ public void scanEpisodeFile(File jar) throws BadCommandLineException { try { URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()}); Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); addBindFile(new InputSource(url.toExternalForm())); } } catch (IOException e) { throw new BadCommandLineException( Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e); } }
/** * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization. */ public void scanEpisodeFile(File jar) throws BadCommandLineException { try { URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()}); Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); addBindFile(new InputSource(url.toExternalForm())); } } catch (IOException e) { throw new BadCommandLineException( Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e); } }
/** * Finds the {@code META-INF/sun-jaxb.episode} file to add as a binding customization. * * @param jar * @throws com.sun.tools.xjc.BadCommandLineException */ public void scanEpisodeFile(File jar) throws BadCommandLineException { try { URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()}); Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); addBindFile(new InputSource(url.toExternalForm())); } } catch (IOException e) { throw new BadCommandLineException( Messages.format(Messages.FAILED_TO_LOAD, jar, e.getMessage()), e); } }
/** * Finds the {@code META-INF/sun-jaxb.episode} file to add as a binding customization. * * @param jar * @throws com.sun.tools.xjc.BadCommandLineException */ public void scanEpisodeFile(File jar) throws BadCommandLineException { try { URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()}); Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); addBindFile(new InputSource(url.toExternalForm())); } } catch (IOException e) { throw new BadCommandLineException( Messages.format(Messages.FAILED_TO_LOAD, jar, e.getMessage()), e); } }
/** * Finds the {@code META-INF/sun-jaxb.episode} file to add as a binding customization. * * @param jar * @throws com.sun.tools.xjc.BadCommandLineException */ public void scanEpisodeFile(File jar) throws BadCommandLineException { try { URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()}); Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); addBindFile(new InputSource(url.toExternalForm())); } } catch (IOException e) { throw new BadCommandLineException( Messages.format(Messages.FAILED_TO_LOAD, jar, e.getMessage()), e); } }
@Override public void onActivated(Options options) throws BadCommandLineException { super.onActivated(options); try { init(options); } catch (Exception ex) { throw new BadCommandLineException( "Could not initialize the plugin [" + getOptionName() + "].", ex); } }
@Override public void onActivated(Options options) throws BadCommandLineException { super.onActivated(options); try { init(options); } catch (Exception ex) { throw new BadCommandLineException( "Could not initialize the plugin [" + getOptionName() + "].", ex); } }
@Override public void onActivated(Options options) throws BadCommandLineException { super.onActivated(options); try { init(options); } catch (Exception ex) { throw new BadCommandLineException( "Could not initialize the plugin [" + getOptionName() + "].", ex); } }
@Override public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException { final PartialCmdLineParser cmdLineParser = new PartialCmdLineParser( getSettings()); try { return cmdLineParser.parseArgument(args, i); } catch (CmdLineException clex) { throw new BadCommandLineException("Error parsing arguments.", clex); } }
@Override public int parseArgument(Options opt, String[] args, int i) throws BadCommandLineException, IOException { final PartialCmdLineParser cmdLineParser = new PartialCmdLineParser( getSettings()); try { return cmdLineParser.parseArgument(args, i); } catch (CmdLineException clex) { throw new BadCommandLineException("Error parsing arguments.", clex); } }