Package org.kohsuke.args4j

Examples of org.kohsuke.args4j.CmdLineException


        a.setProjectDir(projectDir);

        for (String f : files) {
            File file = new File(f);
            if(!file.exists())
                throw new CmdLineException("No such file nor directory exists: "+file);

            if(file.getName().equals(".classpath")) {
                a.parseDotClassPath(file.getAbsoluteFile().getParentFile());
                continue;
            }
View Full Code Here


      if (excluded.contains(s)) {
        errorMessage += String.format(
            ". Note that '%s' has been explicitly excluded from the list of possible values,"
                + " even though a resource with that name exists", s);
      }
      throw new CmdLineException(owner, errorMessage);
    }
    setter.addValue(s);
    return 1;
  }
View Full Code Here

  @Override
  public int parseArguments(Parameters params) throws CmdLineException {
    String src = params.getParameter(0);
    AbstractProject project = projectFinder.findProject(src);
    if (project == null) {
      throw new CmdLineException(
          owner,
          String.format("Project does not exist: %s", src));
    }
    if (!(project instanceof MasterProject)) {
      throw new CmdLineException(
          owner,
          String.format("Project is not a Master Project: %s", src));
    }
    setter.addValue((MasterProject) project);
    return 1;
View Full Code Here

    protected Path parse(String argument) throws NumberFormatException, CmdLineException {
        try {
        return Paths.get(argument);
        }
        catch (Exception e) {
            throw new CmdLineException(owner, Messages.ILLEGAL_PATH, argument);
        }
    }
View Full Code Here

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

                break;
            }

        if(value==null) {
            if (option.isArgument()) {
                throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), s);
            } else {
                throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1),s);
            }
        }
        setter.addValue(value);
        return 1;
    }
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, macString);

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

        try {
            T value = parse(token);
            setter.addValue(value);
        }
        catch (NumberFormatException ex) {
            throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, params.getParameter(-1), token);
        }
        return 1;
 
View Full Code Here

    Pattern p;
    try {
      p = Pattern.compile(s);
    }
    catch (PatternSyntaxException x) {
      throw new CmdLineException(owner, Messages.ILLEGAL_PATTERN.format(option.toString(), s));
    }
    setter.addValue(p);
    return 1;
  }
View Full Code Here

    }

    private Boolean getBoolean(String parameter) throws CmdLineException {
        String valueStr = parameter.toLowerCase();
        if (!ACCEPTABLE_VALUES.containsKey(valueStr)) {
            throw new CmdLineException(owner, Messages.ILLEGAL_BOOLEAN, valueStr);
        }
        return ACCEPTABLE_VALUES.get(valueStr);
    }
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.