@Override
    protected boolean validateSettings() throws IllegalArgumentException {
        // Validate values which do not require user input first to avoid unnecesary
        // work on the user part.

        // dates
        Date startDate = getStartDate();
        Date stopDate = getStopDate();
        if (startDate != null && stopDate != null) {
            if (startDate.after(stopDate)) {
                // stop date is before the start date.
                throw new IllegalArgumentException(getLocalizedString("BL_MINDATE_AFTER_MAXDATE"));
            }
        }

        // Validate levels if specified.
        Level minLevel = getMinLevel();
        Level maxLevel = getMaxLevel();
        if (maxLevel != null && minLevel != null) {
            // We have both a max and min level. Check that the min level is
            // equal to or less than the max level
            if (minLevel.intValue() > maxLevel.intValue()) {
                // Min is greater than Max level. Report error
                throw new IllegalArgumentException(getLocalizedString("BL_MINLEVEL_GREATER_THAN_MAXLEVEL"));
            }
        }

        // Required options
        try {
            setBinaryRepositoryDir(unvalidatedRepositoryDir.getCanonicalPath());
            System.out.println(getLocalizedParmString("BL_REPOSITORY_DIRECTORY", new Object[] { getValidatedBinaryRepositoryDir() }));
        } catch (IOException e) {
            throw new IllegalArgumentException(getLocalizedParmString("BL_INVALID_REPOSITORYDIR", new Object[] { unvalidatedRepositoryDir }));
        }

        // in case of copy action, we have an unvalidatedTargetDir set
        try {
            if (unvalidatedTargetDir != null) {
                String dir = unvalidatedTargetDir.getCanonicalPath();
                setOutputRepositoryDir(dir);
                System.out.println(getLocalizedParmString("BL_TARGET_DIRECTORY", new Object[] { dir }));
            }
        } catch (IOException e) {
            throw new IllegalArgumentException(getLocalizedParmString("BL_INVALID_TARGETDIR", new Object[] { unvalidatedTargetDir }));
        }

        return false;

    }
@ Override protected boolean validateSettings ( ) throws IllegalArgumentException { Date startDate = getStartDate ( ) ; Date stopDate = getStopDate ( ) ; if ( startDate != null && stopDate != null ) { if ( startDate . after ( stopDate ) ) { throw new IllegalArgumentException ( getLocalizedString ( "BL_MINDATE_AFTER_MAXDATE" ) ) ; } } Level minLevel = getMinLevel ( ) ; Level maxLevel = getMaxLevel ( ) ; if ( maxLevel != null && minLevel != null ) { if ( minLevel . intValue ( ) > maxLevel . intValue ( ) ) { throw new IllegalArgumentException ( getLocalizedString ( "BL_MINLEVEL_GREATER_THAN_MAXLEVEL" ) ) ; } } try { setBinaryRepositoryDir ( unvalidatedRepositoryDir . getCanonicalPath ( ) ) ; System . out . println ( getLocalizedParmString ( "BL_REPOSITORY_DIRECTORY" , new Object [ ] { getValidatedBinaryRepositoryDir ( ) } ) ) ; } catch ( IOException e ) { throw new IllegalArgumentException ( getLocalizedParmString ( "BL_INVALID_REPOSITORYDIR" , new Object [ ] { unvalidatedRepositoryDir } ) ) ; } try { if ( unvalidatedTargetDir != null ) { String dir = unvalidatedTargetDir . getCanonicalPath ( ) ; setOutputRepositoryDir ( dir ) ; System . out . println ( getLocalizedParmString ( "BL_TARGET_DIRECTORY" , new Object [ ] { dir } ) ) ; } } catch ( IOException e ) { throw new IllegalArgumentException ( getLocalizedParmString ( "BL_INVALID_TARGETDIR" , new Object [ ] { unvalidatedTargetDir } ) ) ; } return false ; }
The validateSettings method.
<p>
This method validates the settings which are configured via cmd line arguments. Invalid settings will either be
set to defaults or the program must exit.