public void setConfigFile ( final String config ) { if ( config == null ) { throw ( new IllegalArgumentException ( "Configuration file parameter is null" ) ) ; } File file = new File ( config ) ; if ( file . exists ( ) ) { if ( file . isDirectory ( ) ) { throw new IllegalArgumentException ( "Folder " + config + " is not a configuration file" ) ; } } else { throw new IllegalArgumentException ( "Configuration file " + config + " not found" ) ; } setConfigFile ( file ) ; }
Check the config parameter and keep it only if it is valid .