public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); try { // TODO: currently not caching the parser since we make no assumptions // or restrictions on concurrent parsing getParser(); RepositoryHandler repositoryHandler = new RepositoryHandler(); xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler)); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }
public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); try { // TODO: currently not caching the parser since we make no assumptions // or restrictions on concurrent parsing getParser(); RepositoryHandler repositoryHandler = new RepositoryHandler(); xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler)); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) { IOException ioException = new IOException(e.getMessage()); ioException.initCause(e); throw ioException; } } catch (ParserConfigurationException e) { IOException ioException = new IOException(e.getMessage()); ioException.initCause(e); throw ioException; } finally { monitor.done(); stream.close(); } }
public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); try { // TODO: currently not caching the parser since we make no assumptions // or restrictions on concurrent parsing getParser(); RepositoryHandler repositoryHandler = new RepositoryHandler(); xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler)); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }