Project

General

Profile

« Previous | Next » 

Revision bb201cf5

Added by Andreas Kohlbecker about 2 years ago

resilient handling of invalid options

View differences:

src/main/java/eu/etaxonomy/cdm/server/Bootloader.java
180 180

  
181 181
    public void parseCommandOptions(String[] args) throws ParseException {
182 182
        CommandLineParser parser = new GnuParser();
183
        cmdLine = parser.parse( CommandOptions.getOptions(), args );
183

  
184
        boolean hasProblem = false;
185
            try {
186
                cmdLine = parser.parse( CommandOptions.getOptions(), args );
187
            } catch (ParseException e) {
188
                hasProblem = true;
189
                logger.warn(e);
190
            }
184 191

  
185 192
         // print the help message
186
         if(cmdLine.hasOption(HELP.getOpt())){
193
         if(cmdLine.hasOption(HELP.getOpt()) || hasProblem){
187 194
             HelpFormatter formatter = new HelpFormatter();
188 195
             formatter.setWidth(200);
189 196
             formatter.printHelp( "java .. ", CommandOptions.getOptions() );

Also available in: Unified diff