public boolean executeSchematronDriver ( InputSource inputDoc , File schemaFile , String phase ) { boolean isValid = false ; ValidationDriver driver = createSchematronDriver ( phase ) ; assert null != driver : "Unable to create Schematron ValidationDriver" ; InputSource is = null ; // Fortify Mod: move fis out so it can be closed on exit FileInputStream fis = null ; try { // FileInputStream fis = new FileInputStream(schemaFile); fis = new FileInputStream ( schemaFile ) ; is = new InputSource ( fis ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } try { if ( driver . loadSchema ( is ) ) { isValid = driver . validate ( inputDoc ) ; fis . close ( ) ; // Fortify addition } else { assert false : ( "Failed to load Schematron schema: " + schemaFile + "\nIs the schema valid? Is the phase defined?" ) ; } } catch ( SAXException e ) { assert false : e . toString ( ) ; } catch ( IOException e ) { assert false : e . toString ( ) ; } return isValid ; }
Runs the schematron file against the input source .