question: private void readResources ( ResourceMap hmResourcesRules ) throws ResourceInitializationException { Pattern paReadRules = Pattern . compile ( "RULENAME=\"(.*?)\",EXTRACTION=\"(.*?)\",NORM_VALUE=\"(.*?)\"(.*)" ) ; Pattern paVariable = Pattern . compile ( "%(re[a-zA-Z0-9]*)" ) ; InputStream is = null ; InputStreamReader isr = null ; BufferedReader br = null ; try { for ( String resource : hmResourcesRules . keySet ( ) ) { is = hmResourcesRules . getInputStream ( resource ) ; isr = new InputStreamReader ( is , "UTF-8" ) ; br = new BufferedReader ( isr ) ; Logger . printDetail ( component , "Adding rule resource: " + resource ) ; for ( String line ; ( line = br . readLine ( ) ) != null ; ) { if ( line . startsWith ( "//" ) || line . equals ( "" ) ) { continue ; } Logger . printDetail ( "DEBUGGING: reading rules..." + line ) ; for ( MatchResult r : Toolbox . findMatches ( paReadRules , line ) ) { String rule_name = r . group ( 1 ) ; String rule_extraction = r . group ( 2 ) ; String rule_normalization = r . group ( 3 ) ; RePatternManager rpm = RePatternManager . getInstance ( language , false ) ; for ( MatchResult mr : Toolbox . findMatches ( paVariable , rule_extraction ) ) { Logger . printDetail ( "DEBUGGING: replacing patterns..." + mr . group ( ) ) ; if ( ! ( rpm . containsKey ( mr . group ( 1 ) ) ) ) { Logger . printError ( "Error creating rule:" + rule_name ) ; Logger . printError ( "The following pattern used in this rule does not exist, does it? %" + mr . group ( 1 ) ) ; System . exit ( - 1 ) ; } rule_extraction = rule_extraction . replaceAll ( "%" + mr . group ( 1 ) , rpm . get ( mr . group ( 1 ) ) ) ; } rule_extraction = rule_extraction . replaceAll ( " " , "[\\\\s]+" ) ; Pattern pattern = null ; try { pattern = Pattern . compile ( rule_extraction ) ; } catch ( java . util . regex . PatternSyntaxException e ) { Logger . printError ( "Compiling rules resulted in errors." ) ; Logger . printError ( "Problematic rule is " + rule_name ) ; Logger . printError ( "Cannot compile pattern: " + rule_extraction ) ; e . printStackTrace ( ) ; System . exit ( - 1 ) ; } if ( resource . equals ( "intervalrules" ) ) { hmIntervalPattern . put ( pattern , rule_name ) ; hmIntervalNormalization . put ( rule_name , rule_normalization ) ; } } } } } catch ( IOException e ) { e . printStackTrace ( ) ; throw new ResourceInitializationException ( ) ; } finally { try { if ( br != null ) { br . close ( ) ; } if ( isr != null ) { isr . close ( ) ; } if ( is != null ) { is . close ( ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } }
target:  reads in heideltime's resource files.