public ParsedPolicy parse ( File file ) throws Exception { if ( file == null || ! file . exists ( ) ) { if ( debug ) { if ( file == null ) { ProGradePolicyDebugger . log ( "Given File is null" ) ; } else { if ( ! file . exists ( ) ) { ProGradePolicyDebugger . log ( "Policy file " + file . getCanonicalPath ( ) + " doesn't exists." ) ; } } } throw new Exception ( "ER007: File with policy doesn't exists!" ) ; } if ( debug ) { ProGradePolicyDebugger . log ( "Parsing policy " + file . getCanonicalPath ( ) ) ; } final InputStreamReader reader = new InputStreamReader ( new FileInputStream ( file ) , "UTF-8" ) ; try { return parse ( reader ) ; } finally { reader . close ( ) ; } }
Parse content of text policy file to ParsedPolicy object which represent this policy .