title: args4j : What argument threw the CommandLineException during the parsing?
body: <p>I am using args4j to parse the arguments given to my program.</p>
  
  <p>Here is the code where I define 2 arguments of Date type. The handler just parses the given date and throws a CommandLineException if the date is malformed.</p>
  
  <pre><code>@Option(name="-b", metaVar="&lt;beginDate&gt;", handler=DateOptionHandler.class, usage="...")
  private Date beginDate;
  
  @Option(name="-e", metaVar="&lt;endDate&gt;", handler=DateOptionHandler.class, usage="...")
  private Date endDate;
  </code></pre>
  
  <p>I need to be able to return a different code (int value) if it is beginDate or endDate which throws an exception.</p>
  
  <p>Currently, my main method looks like this : </p>
  
  <pre><code>CmdLineParser parser = new CmdLineParser(this);
  parser.setUsageWidth(120);
  
  try {
      parser.parseArgument(args);
  } catch (CmdLineException e) {
      /* Print usage if an error occurs during the parsing */
      System.err.println(e.getMessage());
      System.err.println("Usage : java LaunchProgram [options]");
      e.getParser().printUsage(System.err);
  
      /* What I need to do : */
      if(optionWhichThrewTheException.equals("-b") return 2;
      if(optionWhichThrewTheException.equals("-e") return 3;
  
      /* Other arguments */
      return -1;
  }
  </code></pre>
  
  <p>But I can't figure out how I can know which argument threw the exception (I looked the CmdLineException methods, but I found nothing).</p>
  
  <p>Is there a way to obtain the parameter which can not be parsed ?</p>
  
  <p>Thanks by advance for your help.</p>