private void flush() { try { if (m_firstTagNotEmitted) { emitFirstTag(); } if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } } catch(SAXException e) { throw new RuntimeException(e.toString()); } }
private void flush() { try { if (m_firstTagNotEmitted) { emitFirstTag(); } if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } } catch(SAXException e) { throw new RuntimeException(e.toString()); } }
processingEnv.getMessager().printMessage(Kind.ERROR, "Failed to read generated-layer.xml: " + x.toString()); } catch (SAXException x) { processingEnv.getMessager().printMessage(Kind.ERROR, "Failed to parse generated-layer.xml: " + x.toString());
final IOException exception = new IOException(e.toString()); exception.initCause(e); throw exception;
xmlReader.parse(is); } catch (SAXException ex) { log("Caught when validating: " + ex.toString(), Project.MSG_DEBUG); if (failOnError) { throw new BuildException( "Could not validate document " + afile); log("Could not validate document " + afile + ": " + ex.toString()); result = false; } catch (IOException ex) {
messager.printMessage(Kind.ERROR, "Failed to write generated-layer.xml: " + x.toString()); } catch (SAXException x) { messager.printMessage(Kind.ERROR, "Refused to write invalid generated-layer.xml: " + x.toString());
public void parse (InputSource input) throws SAXException, IOException { XMLReader managedReader = null; try { if (getParent() == null) { try { managedReader = XMLReaderManager.getInstance() .getXMLReader(); setParent(managedReader); } catch (SAXException e) { throw new SAXException(e.toString()); } } // call parse on the parent getParent().parse(input); } finally { if (managedReader != null) { XMLReaderManager.getInstance().releaseXMLReader(managedReader); } } }
public String toString() { return mCause.toString(); } }
/** @see org.geotools.data.FeatureReader#next() */ public SimpleFeature peek() throws IOException, NoSuchElementException { if (exception != null) { state = STOP; IOException e = new IOException(exception.toString()); e.initCause(exception); throw e; } SimpleFeature f = features[head]; return f; }
/** @see org.geotools.data.FeatureReader#next() */ public SimpleFeature next() throws IOException, NoSuchElementException { if (exception != null) { state = STOP; IOException e = new IOException(exception.toString()); e.initCause(exception); throw e; } SimpleFeature f = null; synchronized (this) { size--; f = features[head++]; notify(); if (head == features.length) { head = 0; } } return f; }
public static SyntaxScheme load(Font baseFont, InputStream in) throws IOException { SyntaxSchemeLoader parser = null; try { XMLReader reader = XMLReaderFactory.createXMLReader(); parser = new SyntaxSchemeLoader(baseFont); parser.baseFont = baseFont; reader.setContentHandler(parser); InputSource is = new InputSource(in); is.setEncoding("UTF-8"); reader.parse(is); } catch (SAXException se) { throw new IOException(se.toString()); } return parser.scheme; }
/** Handles the string chunks collected in {@link #characters}. */ private void handleCharacters() throws SAXException { final String text = characters.toString(); characters.setLength(0); if (text.length() == 0) { return; } XSIElementHandler peek = null; try { if ((text != null) && !"".equals(text.trim())) { peek = (XSIElementHandler) handlers.peek(); peek.characters(text); } } catch (SAXException e) { logger.warning(e.toString()); throw e; } }
protected void initialize() { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); _docResponse = docBuilder.parse(new InputSource(new StringReader(_xmlResponse))); if (_docResponse != null) { parse(_docResponse.getDocumentElement()); } } catch (ParserConfigurationException e) { s_logger.error("Error parsing the response : " + e.toString()); } catch (SAXException e) { s_logger.error("Error parsing the response : " + e.toString()); } catch (IOException e) { s_logger.error("Error parsing the response : " + e.toString()); } }
/** Handles the string chunks collected in {@link #characters}. */ private void handleCharacters() throws SAXException { if (characters.length() == 0) { return; } try { checkStatus(); String text = characters.toString(); characters.setLength(0); if ((text != null) && !"".equals(text)) { ((XMLElementHandler) handlers.peek()).characters(text); } } catch (SAXException e) { logger.warning(e.toString()); throw e; } }
IOException e = new IOException(exception.toString()); e.initCause(exception); throw e; IOException e = new IOException(exception.toString()); e.initCause(exception); throw e; IOException e = new IOException(exception.toString()); e.initCause(exception); throw e; throw new IOException(exception.toString());
/** * Implementation of endElement. push NS,Name * * @param namespaceURI * @param localName * @param qName * @throws SAXException * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, * java.lang.String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { handleCharacters(); logger.fine("END: " + qName); try { XSIElementHandler element = (XSIElementHandler) handlers.pop(); element.endElement(namespaceURI, localName); } catch (SAXException e) { logger.warning(e.toString()); throw e; } }
eh.startElement(namespaceURI, localName, atts); } catch (SAXException e) { logger.warning(e.toString()); throw e;
public LibvirtStorageVolumeDef parseStorageVolumeXML(String volXML) { DocumentBuilder builder; try { builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(volXML)); Document doc = builder.parse(is); Element rootElement = doc.getDocumentElement(); String VolName = getTagValue("name", rootElement); Element target = (Element)rootElement.getElementsByTagName("target").item(0); String format = getAttrValue("type", "format", target); Long capacity = Long.parseLong(getTagValue("capacity", rootElement)); return new LibvirtStorageVolumeDef(VolName, capacity, LibvirtStorageVolumeDef.VolumeFormat.getFormat(format), null, null); } catch (ParserConfigurationException e) { s_logger.debug(e.toString()); } catch (SAXException e) { s_logger.debug(e.toString()); } catch (IOException e) { s_logger.debug(e.toString()); } return null; }
/** * Loads edits file, uses visitor to process all elements */ @Override public void loadEdits() throws IOException { try { XMLReader xr = XMLReaderFactory.createXMLReader(); xr.setContentHandler(this); xr.setErrorHandler(this); xr.setDTDHandler(null); xr.parse(new InputSource(fileReader)); visitor.close(null); } catch (SAXParseException e) { System.out.println("XML parsing error: " + "\n" + "Line: " + e.getLineNumber() + "\n" + "URI: " + e.getSystemId() + "\n" + "Message: " + e.getMessage()); visitor.close(e); throw new IOException(e.toString()); } catch (SAXException e) { visitor.close(e); throw new IOException(e.toString()); } catch (RuntimeException e) { visitor.close(e); throw e; } finally { fileReader.close(); } }
s_logger.debug(e.toString()); } catch (SAXException e) { s_logger.debug(e.toString()); } catch (IOException e) { s_logger.debug(e.toString());