Java Code Examples for org.xml.sax.SAXException#initCause()
The following examples show how to use
org.xml.sax.SAXException#initCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StorageReader.java From netbeans with Apache License 2.0 | 6 votes |
private SAXException log(String errorType, SAXParseException e) { Level level; String message; if (file == null) { level = Level.FINE; message = "XML parser " + errorType; } else { if (isModuleFile()) { //NOI18N level = Level.WARNING; // warnings for module layer supplied files } else { level = Level.FINE; // user files, can be from previous versions } message = "XML parser " + errorType + " in file " + file.getPath(); } SAXException saxe = new SAXException(message); saxe.initCause(e); LOG.log(level, message, saxe); //NOI18N return saxe; }
Example 2
Source File: IvyXmlModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { try { if (state == State.DESCRIPTION) { // make sure we don't interpret any tag while in description tag descriptionStarted(qName, attributes); } else if ("ivy-module".equals(qName)) { ivyModuleStarted(attributes); } else if ("info".equals(qName)) { infoStarted(attributes); } else if (state == State.INFO && "extends".equals(qName)) { extendsStarted(attributes); } else if (state == State.INFO && "license".equals(qName)) { getMd().addLicense(new License(substitute(attributes.getValue("name")), substitute(attributes.getValue("url")))); } else if (state == State.INFO && "ivyauthor".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "repository".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "description".equals(qName)) { getMd().setHomePage(substitute(attributes.getValue("homepage"))); state = State.DESCRIPTION; buffer = new StringBuffer(); } else if (state == State.INFO && isOtherNamespace(qName)) { buffer = new StringBuffer(); state = State.EXTRA_INFO; } else if ("configurations".equals(qName)) { configurationStarted(attributes); } else if ("publications".equals(qName)) { publicationsStarted(attributes); } else if ("dependencies".equals(qName)) { dependenciesStarted(attributes); } else if ("conflicts".equals(qName)) { state = State.CONFLICT; checkConfigurations(); } else if ("artifact".equals(qName)) { artifactStarted(qName, attributes); } else if ("include".equals(qName) && state == State.DEP) { addIncludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEP) { addExcludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEPS) { state = State.EXCLUDE; parseRule(qName, attributes); getMd().addExcludeRule((ExcludeRule) confAware); } else if ("dependency".equals(qName)) { dependencyStarted(attributes); } else if ("conf".equals(qName)) { confStarted(attributes); } else if ("mapped".equals(qName)) { dd.addDependencyConfiguration(conf, substitute(attributes.getValue("name"))); } else if (("conflict".equals(qName) && state == State.DEPS) || "manager".equals(qName) && state == State.CONFLICT) { LOGGER.debug("Ivy.xml conflict managers are not supported by Gradle. Ignoring conflict manager declared in {}", getResource().getName()); } else if ("override".equals(qName) && state == State.DEPS) { LOGGER.debug("Ivy.xml dependency overrides are not supported by Gradle. Ignoring override declared in {}", getResource().getName()); } else if ("include".equals(qName) && state == State.CONF) { includeConfStarted(attributes); } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) { addError("unknown tag " + qName); } } catch (Exception ex) { if (ex instanceof SAXException) { throw (SAXException) ex; } SAXException sax = new SAXException("Problem occurred while parsing ivy file: " + ex.getMessage(), ex); sax.initCause(ex); throw sax; } }
Example 3
Source File: IvyXmlModuleDescriptorParser.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { try { if (state == State.DESCRIPTION) { // make sure we don't interpret any tag while in description tag descriptionStarted(qName, attributes); } else if ("ivy-module".equals(qName)) { ivyModuleStarted(attributes); } else if ("info".equals(qName)) { infoStarted(attributes); } else if (state == State.INFO && "extends".equals(qName)) { extendsStarted(attributes); } else if (state == State.INFO && "license".equals(qName)) { getMd().addLicense(new License(substitute(attributes.getValue("name")), substitute(attributes.getValue("url")))); } else if (state == State.INFO && "ivyauthor".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "repository".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "description".equals(qName)) { getMd().setHomePage(substitute(attributes.getValue("homepage"))); state = State.DESCRIPTION; buffer = new StringBuffer(); } else if (state == State.INFO && isOtherNamespace(qName)) { buffer = new StringBuffer(); state = State.EXTRA_INFO; } else if ("configurations".equals(qName)) { configurationStarted(attributes); } else if ("publications".equals(qName)) { publicationsStarted(attributes); } else if ("dependencies".equals(qName)) { dependenciesStarted(attributes); } else if ("conflicts".equals(qName)) { if (!descriptorVersion.startsWith("1.")) { DeprecationLogger.nagUserWith("Using conflicts section in ivy.xml is deprecated: please use hints section instead. Ivy file: " + getResource().getName()); } state = State.CONFLICT; checkConfigurations(); } else if ("artifact".equals(qName)) { artifactStarted(qName, attributes); } else if ("include".equals(qName) && state == State.DEP) { addIncludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEP) { addExcludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEPS) { state = State.EXCLUDE; parseRule(qName, attributes); getMd().addExcludeRule((ExcludeRule) confAware); } else if ("dependency".equals(qName)) { dependencyStarted(attributes); } else if ("conf".equals(qName)) { confStarted(attributes); } else if ("mapped".equals(qName)) { dd.addDependencyConfiguration(conf, substitute(attributes.getValue("name"))); } else if (("conflict".equals(qName) && state == State.DEPS) || "manager".equals(qName) && state == State.CONFLICT) { LOGGER.debug("Ivy.xml conflict managers are not supported by Gradle. Ignoring conflict manager declared in {}", getResource().getName()); } else if ("override".equals(qName) && state == State.DEPS) { LOGGER.debug("Ivy.xml dependency overrides are not supported by Gradle. Ignoring override declared in {}", getResource().getName()); } else if ("include".equals(qName) && state == State.CONF) { includeConfStarted(attributes); } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) { addError("unknown tag " + qName); } } catch (Exception ex) { if (ex instanceof SAXException) { throw (SAXException) ex; } SAXException sax = new SAXException("Problem occurred while parsing ivy file: " + ex.getMessage(), ex); sax.initCause(ex); throw sax; } }
Example 4
Source File: IvyXmlModuleDescriptorParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { try { if (state == State.DESCRIPTION) { // make sure we don't interpret any tag while in description tag descriptionStarted(qName, attributes); } else if ("ivy-module".equals(qName)) { ivyModuleStarted(attributes); } else if ("info".equals(qName)) { infoStarted(attributes); } else if (state == State.INFO && "extends".equals(qName)) { extendsStarted(attributes); } else if (state == State.INFO && "license".equals(qName)) { getMd().addLicense(new License(substitute(attributes.getValue("name")), substitute(attributes.getValue("url")))); } else if (state == State.INFO && "ivyauthor".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "repository".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "description".equals(qName)) { getMd().setHomePage(substitute(attributes.getValue("homepage"))); state = State.DESCRIPTION; buffer = new StringBuffer(); } else if (state == State.INFO && isOtherNamespace(qName)) { buffer = new StringBuffer(); state = State.EXTRA_INFO; } else if ("configurations".equals(qName)) { configurationStarted(attributes); } else if ("publications".equals(qName)) { publicationsStarted(attributes); } else if ("dependencies".equals(qName)) { dependenciesStarted(attributes); } else if ("conflicts".equals(qName)) { state = State.CONFLICT; checkConfigurations(); } else if ("artifact".equals(qName)) { artifactStarted(qName, attributes); } else if ("include".equals(qName) && state == State.DEP) { addIncludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEP) { addExcludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEPS) { state = State.EXCLUDE; parseRule(qName, attributes); getMd().addExcludeRule((ExcludeRule) confAware); } else if ("dependency".equals(qName)) { dependencyStarted(attributes); } else if ("conf".equals(qName)) { confStarted(attributes); } else if ("mapped".equals(qName)) { dd.addDependencyConfiguration(conf, substitute(attributes.getValue("name"))); } else if (("conflict".equals(qName) && state == State.DEPS) || "manager".equals(qName) && state == State.CONFLICT) { LOGGER.debug("Ivy.xml conflict managers are not supported by Gradle. Ignoring conflict manager declared in {}", getResource().getName()); } else if ("override".equals(qName) && state == State.DEPS) { LOGGER.debug("Ivy.xml dependency overrides are not supported by Gradle. Ignoring override declared in {}", getResource().getName()); } else if ("include".equals(qName) && state == State.CONF) { includeConfStarted(attributes); } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) { addError("unknown tag " + qName); } } catch (Exception ex) { if (ex instanceof SAXException) { throw (SAXException) ex; } SAXException sax = new SAXException("Problem occurred while parsing ivy file: " + ex.getMessage(), ex); sax.initCause(ex); throw sax; } }
Example 5
Source File: IvyXmlModuleDescriptorParser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { try { if (state == State.DESCRIPTION) { // make sure we don't interpret any tag while in description tag descriptionStarted(qName, attributes); } else if ("ivy-module".equals(qName)) { ivyModuleStarted(attributes); } else if ("info".equals(qName)) { infoStarted(attributes); } else if (state == State.INFO && "extends".equals(qName)) { extendsStarted(attributes); } else if (state == State.INFO && "license".equals(qName)) { getMd().addLicense(new License(substitute(attributes.getValue("name")), substitute(attributes.getValue("url")))); } else if (state == State.INFO && "ivyauthor".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "repository".equals(qName)) { // nothing to do, we don't store this return; } else if (state == State.INFO && "description".equals(qName)) { getMd().setHomePage(substitute(attributes.getValue("homepage"))); state = State.DESCRIPTION; buffer = new StringBuffer(); } else if (state == State.INFO && isOtherNamespace(qName)) { buffer = new StringBuffer(); state = State.EXTRA_INFO; } else if ("configurations".equals(qName)) { configurationStarted(attributes); } else if ("publications".equals(qName)) { publicationsStarted(attributes); } else if ("dependencies".equals(qName)) { dependenciesStarted(attributes); } else if ("conflicts".equals(qName)) { if (!descriptorVersion.startsWith("1.")) { DeprecationLogger.nagUserWith("Using conflicts section in ivy.xml is deprecated: please use hints section instead. Ivy file: " + getResource().getName()); } state = State.CONFLICT; checkConfigurations(); } else if ("artifact".equals(qName)) { artifactStarted(qName, attributes); } else if ("include".equals(qName) && state == State.DEP) { addIncludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEP) { addExcludeRule(qName, attributes); } else if ("exclude".equals(qName) && state == State.DEPS) { state = State.EXCLUDE; parseRule(qName, attributes); getMd().addExcludeRule((ExcludeRule) confAware); } else if ("dependency".equals(qName)) { dependencyStarted(attributes); } else if ("conf".equals(qName)) { confStarted(attributes); } else if ("mapped".equals(qName)) { dd.addDependencyConfiguration(conf, substitute(attributes.getValue("name"))); } else if (("conflict".equals(qName) && state == State.DEPS) || "manager".equals(qName) && state == State.CONFLICT) { LOGGER.debug("Ivy.xml conflict managers are not supported by Gradle. Ignoring conflict manager declared in {}", getResource().getName()); } else if ("override".equals(qName) && state == State.DEPS) { LOGGER.debug("Ivy.xml dependency overrides are not supported by Gradle. Ignoring override declared in {}", getResource().getName()); } else if ("include".equals(qName) && state == State.CONF) { includeConfStarted(attributes); } else if (validate && state != State.EXTRA_INFO && state != State.DESCRIPTION) { addError("unknown tag " + qName); } } catch (Exception ex) { if (ex instanceof SAXException) { throw (SAXException) ex; } SAXException sax = new SAXException("Problem occurred while parsing ivy file: " + ex.getMessage(), ex); sax.initCause(ex); throw sax; } }
Example 6
Source File: CASTransportable.java From uima-uimaj with Apache License 2.0 | 2 votes |
/** * Create a SAXException that wraps the given IOException. * The wrapping is done using the standard Java 1.4 mechanism, * so that getCause() will work. Note that new SAXException(Exception) * does NOT work. * @param e an IOException to wrap * @return a SAX exception for which <code>getCause()</code> will return <code>e</code>. */ public SAXException wrapAsSAXException(IOException e) { SAXException saxEx =new SAXException(e.getMessage()); saxEx.initCause(e); return saxEx; }