@Test(expected=SAXParseException.class) public void parseWrongFile() throws Exception { File file = new File("test.txt"); file.deleteOnExit(); FileUtils.write(file, "bpmn xml process defintion task"); Document doc = listener.parse(file); assertThat(doc, is(notNullValue())); }
protected Document parse(File artifact) throws Exception { if (dbf == null) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } DocumentBuilder db = dbf.newDocumentBuilder(); db.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); return db.parse(artifact); }
BpmnDeploymentListener implements ArtifactUrlTransformer { protected Document parse(File artifact) throws Exception { if (dbf == null) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } DocumentBuilder db = dbf.newDocumentBuilder(); db.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); return db.parse(artifact); } }
BpmnDeploymentListener implements ArtifactUrlTransformer { protected Document parse(File artifact) throws Exception { if (dbf == null) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } DocumentBuilder db = dbf.newDocumentBuilder(); db.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); return db.parse(artifact); }  }
BpmnDeploymentListener implements ArtifactUrlTransformer { protected Document parse(File artifact) throws Exception { if (dbf == null) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } DocumentBuilder db = dbf.newDocumentBuilder(); db.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); return db.parse(artifact); }  @Override boolean canHandle(File artifact); @Override URL transform(URL artifact); }
BpmnDeploymentListener implements ArtifactUrlTransformer { protected Document parse(File artifact) throws Exception { if (dbf == null) { dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); } DocumentBuilder db = dbf.newDocumentBuilder(); db.setErrorHandler(new ErrorHandler() { @Override public void warning(SAXParseException exception) throws SAXException { } @Override public void error(SAXParseException exception) throws SAXException { } @Override public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); return db.parse(artifact); }  @Override boolean canHandle(File artifact); @Override URL transform(URL artifact);  }