List of usage examples for org.dom4j DocumentException DocumentException
public DocumentException(String message, Throwable cause)
From source file:edu.umd.cs.findbugs.SortedBugCollection.java
License:Open Source License
/** * Read XML data from given file into this object, populating given Project * as a side effect./* w w w . j a va 2 s. c o m*/ * * @param file * the file */ public void readXML(File file) throws IOException, DocumentException { project.setCurrentWorkingDirectory(file.getParentFile()); dataSource = file.getAbsolutePath(); InputStream in = progessMonitoredInputStream(file, "Loading analysis"); try { readXML(in, file); } catch (IOException e) { throw newIOException(file, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + file, e); } }
From source file:edu.umd.cs.findbugs.SortedBugCollection.java
License:Open Source License
public void readXML(URL u) throws IOException, DocumentException { InputStream in = progessMonitoredInputStream(u.openConnection(), "Loading analysis"); dataSource = u.toString();/*from w ww. ja v a2 s . c o m*/ try { readXML(in); } catch (IOException e) { throw newIOException(u, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + u, e); } }
From source file:edu.umd.cs.findbugs.SortedBugCollection.java
License:Open Source License
private void doReadXML(@WillClose Reader reader, @CheckForNull File base) throws IOException, DocumentException { timeStartedLoading = System.currentTimeMillis(); SAXBugCollectionHandler handler = new SAXBugCollectionHandler(this, base); Profiler profiler = getProjectStats().getProfiler(); profiler.start(handler.getClass());//from www . j ava2 s . c o m try { XMLReader xr; try { xr = XMLReaderFactory.createXMLReader(); } catch (SAXException e) { AnalysisContext.logError("Couldn't create XMLReaderFactory", e); throw new DocumentException("Sax error ", e); } xr.setContentHandler(handler); xr.setErrorHandler(handler); xr.parse(new InputSource(reader)); } catch (SAXParseException e) { if (base != null) { throw new DocumentException( "Parse error at line " + e.getLineNumber() + " : " + e.getColumnNumber() + " of " + base, e); } throw new DocumentException("Parse error at line " + e.getLineNumber() + " : " + e.getColumnNumber(), e); } catch (SAXException e) { // FIXME: throw SAXException from method? if (base != null) { throw new DocumentException("Sax error while parsing " + base, e); } throw new DocumentException("Sax error ", e); } finally { Util.closeSilently(reader); profiler.end(handler.getClass()); } timeFinishedLoading = System.currentTimeMillis(); bugsPopulated(); // Presumably, project is now up-to-date project.setModified(false); }