Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineException


    try {
            if (argument.startsWith("{"))   argument=argument.substring(1);
            if (argument.endsWith("}"))   argument=argument.substring(0,argument.length()-1);
      return UUID.fromString(argument);
    } catch (IllegalArgumentException e) {
      throw new CmdLineException(owner,
          Messages.ILLEGAL_UUID, argument);
    }
  }
View Full Code Here


    public int parseArguments(Parameters params) throws CmdLineException {
      if (option.isArgument()) {
        String valueStr = params.getParameter(0).toLowerCase();
        int index = ACCEPTABLE_VALUES.indexOf(valueStr);
        if (index == -1) {
          throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr);
        }
        setter.addValue(index < ACCEPTABLE_VALUES.size() / 2);
        return 1;
      } else {
        setter.addValue(true);
View Full Code Here

  }

  @Override
  protected Character parse(String argument) throws NumberFormatException, CmdLineException {
        if (argument.length() != 1)
            throw new CmdLineException(owner, Messages.ILLEGAL_CHAR, argument);
        return argument.charAt(0);
  }
View Full Code Here

        return fallback(subCmd);
    }

    protected int fallback(String subCmd) throws CmdLineException {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), subCmd);
    }
View Full Code Here

  @Override
  protected InetAddress parse(String argument) throws CmdLineException {
    try {
      return InetAddress.getByName(argument);
    } catch (UnknownHostException e) {
      throw new CmdLineException(owner,
          Messages.ILLEGAL_IP_ADDRESS, argument);
    }
  }
View Full Code Here

        String param = params.getParameter(0);
        try {
            setter.addValue(new URI(param));
            return 1;
        } catch (URISyntaxException e) {
            throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1), param);
        }
    }
View Full Code Here

         * In most cases # is a dash (-), a colon (:) or a space ( ).
         * We just need to split by our delimiter.
         */
        macStringArray = macString.split("[^0-9a-fA-F]+");
    else
        throw new CmdLineException(owner,
          Messages.ILLEGAL_MAC_ADDRESS.format(macString));

    byte[] mac = new byte[6];
    for (int i = 0; i < 6; i++)
        /*
 
View Full Code Here

    try {
            if (argument.startsWith("{"))   argument=argument.substring(1);
            if (argument.endsWith("}"))   argument=argument.substring(0,argument.length()-1);
      return UUID.fromString(argument);
    } catch (IllegalArgumentException e) {
      throw new CmdLineException(owner,
          Messages.ILLEGAL_UUID.format(argument));
    }
  }
View Full Code Here

        return fallback(subCmd);
    }

    protected int fallback(String subCmd) throws CmdLineException {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND.format(option.toString(),subCmd));
    }
View Full Code Here

  @Override
  protected InetAddress parse(String argument) throws CmdLineException {
    try {
      return InetAddress.getByName(argument);
    } catch (UnknownHostException e) {
      throw new CmdLineException(owner,
          Messages.ILLEGAL_IP_ADDRESS.format(argument));
    }
  }
View Full Code Here

TOP

Related Classes of org.kohsuke.args4j.CmdLineException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.