void readControlFile ( String fileName ) throws IOException { BufferedReader reader = new BufferedReader ( new FileReader ( fileName ) ) ; try { controlList . clear ( ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . isEmpty ( ) || line . startsWith ( "#" ) ) { continue ; } int separatorIndex = line . indexOf ( ' ' ) ; if ( separatorIndex <= 0 ) { logger . warn ( "Control file line \"" + line + "\" is invalid as does not have '=' separator." ) ; continue ; } String className = line . substring ( 0 , separatorIndex ) ; ControlMode controlMode ; try { controlMode = ControlMode . valueOf ( line . substring ( separatorIndex + 1 ) . trim ( ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { logger . warn ( "Control file line \"" + line + "\" is invalid as control mode is unknown." ) ; continue ; } controlList . add ( new ControlEntry ( className . startsWith ( "/" ) && className . endsWith ( "/" ) && className . length ( ) > 2 ? Pattern . compile ( className . substring ( 1 , className . length ( ) - 1 ) ) : Pattern . compile ( className , Pattern . LITERAL ) , controlMode ) ) ; } configurationValues . put ( ConfigurationOption . CONTROL , fileName ) ; } finally { reader . close ( ) ; } }
Parse the given control file and initialize this config appropriately .