protected void parsePropertiesFile ( InputStream propertiesInputStream ) throws IOException , CommandLineParsingException { Properties props = new Properties ( ) ; props . load ( propertiesInputStream ) ; if ( props . containsKey ( "strict" ) ) { strict = Boolean . valueOf ( props . getProperty ( "strict" ) ) ; } for ( Map . Entry entry : props . entrySet ( ) ) { try { if ( "promptOnNonLocalDatabase" . equals ( entry . getKey ( ) ) ) { continue ; } if ( ( ( String ) entry . getKey ( ) ) . startsWith ( "parameter." ) ) { changeLogParameters . put ( ( ( String ) entry . getKey ( ) ) . replaceFirst ( "^parameter." , "" ) , entry . getValue ( ) ) ; } else { Field field = getClass ( ) . getDeclaredField ( ( String ) entry . getKey ( ) ) ; Object currentValue = field . get ( this ) ; if ( currentValue == null ) { String value = entry . getValue ( ) . toString ( ) . trim ( ) ; if ( field . getType ( ) . equals ( Boolean . class ) ) { field . set ( this , Boolean . valueOf ( value ) ) ; } else { field . set ( this , value ) ; } } } } catch ( NoSuchFieldException ignored ) { if ( strict ) { throw new CommandLineParsingException ( String . format ( coreBundle . getString ( "parameter.unknown" ) , entry . getKey ( ) ) ) ; } else { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . warning ( LogType . LOG , String . format ( coreBundle . getString ( "parameter.ignored" ) , entry . getKey ( ) ) ) ; } } catch ( IllegalAccessException e ) { throw new UnexpectedLiquibaseException ( String . format ( coreBundle . getString ( "parameter.unknown" ) , entry . getKey ( ) ) ) ; } } }
Reads various execution parameters from an InputStream and sets our internal state according to the values found .