List of usage examples for javax.xml.bind ValidationEvent FATAL_ERROR
int FATAL_ERROR
To view the source code for javax.xml.bind ValidationEvent FATAL_ERROR.
Click Source Link
From source file:org.plasma.xml.uml.DefaultUMLModelAssembler.java
private Document buildDocumentModel(Query query, String destNamespaceURI, String destNamespacePrefix) { ProvisioningModelAssembler stagingAssembler = new ProvisioningModelAssembler(query, destNamespaceURI, destNamespacePrefix);/*w w w .j a va 2 s. co m*/ Model model = stagingAssembler.getModel(); if (log.isDebugEnabled()) { try { BindingValidationEventHandler debugHandler = new BindingValidationEventHandler() { public int getErrorCount() { return 0; } public boolean handleEvent(ValidationEvent ve) { ValidationEventLocator vel = ve.getLocator(); String message = "Line:Col:Offset[" + vel.getLineNumber() + ":" + vel.getColumnNumber() + ":" + String.valueOf(vel.getOffset()) + "] - " + ve.getMessage(); String sev = ""; switch (ve.getSeverity()) { case ValidationEvent.WARNING: sev = "WARNING"; break; case ValidationEvent.ERROR: sev = "ERROR"; break; case ValidationEvent.FATAL_ERROR: sev = "FATAL_ERROR"; break; default: } log.debug(sev + " - " + message); return true; } }; ProvisioningModelDataBinding binding = new ProvisioningModelDataBinding(debugHandler); String xml = binding.marshal(model); binding.validate(xml); log.debug(xml); } catch (JAXBException e) { log.debug(e.getMessage(), e); } catch (SAXException e) { log.debug(e.getMessage(), e); } } return buildDocumentModel(model, destNamespaceURI, destNamespacePrefix); }
From source file:org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil.java
private static void logValidationEvents(URL pluginJarFileUrl, ValidationEventCollector validationEventCollector, Log logger) {/*from w ww. j a v a 2s. co m*/ for (ValidationEvent event : validationEventCollector.getEvents()) { // First build the message to be logged. The message will look something like this: // // Validation fatal error while parsing [jopr-jboss-as-plugin-4.3.0-SNAPSHOT.jar:META-INF/rhq-plugin.xml] // at line 221, column 94: cvc-minInclusive-valid: Value '20000' is not facet-valid with respect to // minInclusive '30000' for type '#AnonType_defaultIntervalmetric'. // StringBuilder message = new StringBuilder(); String severity = null; switch (event.getSeverity()) { case ValidationEvent.WARNING: severity = "warning"; break; case ValidationEvent.ERROR: severity = "error"; break; case ValidationEvent.FATAL_ERROR: severity = "fatal error"; break; } message.append("Validation ").append(severity); File pluginJarFile = new File(pluginJarFileUrl.getPath()); message.append(" while parsing [").append(pluginJarFile.getName()).append(":") .append(PLUGIN_DESCRIPTOR_PATH).append("]"); ValidationEventLocator locator = event.getLocator(); message.append(" at line ").append(locator.getLineNumber()); message.append(", column ").append(locator.getColumnNumber()); message.append(": ").append(event.getMessage()); // Now write the message to the log at an appropriate level. switch (event.getSeverity()) { case ValidationEvent.WARNING: case ValidationEvent.ERROR: logger.warn(message); break; case ValidationEvent.FATAL_ERROR: logger.error(message); break; } } }
From source file:org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorUtil.java
private static void logValidationEvents(URL pluginJarFileUrl, ValidationEventCollector validationEventCollector) { for (ValidationEvent event : validationEventCollector.getEvents()) { // First build the message to be logged. The message will look something like this: ////from www.jav a 2 s .c o m // Validation fatal error while parsing [jopr-jboss-as-plugin-4.3.0-SNAPSHOT.jar:META-INF/rhq-plugin.xml] // at line 221, column 94: cvc-minInclusive-valid: Value '20000' is not facet-valid with respect to // minInclusive '30000' for type '#AnonType_defaultIntervalmetric'. // StringBuilder message = new StringBuilder(); String severity = null; switch (event.getSeverity()) { case ValidationEvent.WARNING: severity = "warning"; break; case ValidationEvent.ERROR: severity = "error"; break; case ValidationEvent.FATAL_ERROR: severity = "fatal error"; break; } message.append("Validation ").append(severity); File pluginJarFile = new File(pluginJarFileUrl.getPath()); message.append(" while parsing [").append(pluginJarFile.getName()).append(":") .append(PLUGIN_DESCRIPTOR_PATH).append("]"); ValidationEventLocator locator = event.getLocator(); message.append(" at line ").append(locator.getLineNumber()); message.append(", column ").append(locator.getColumnNumber()); message.append(": ").append(event.getMessage()); // Now write the message to the log at an appropriate level. switch (event.getSeverity()) { case ValidationEvent.WARNING: case ValidationEvent.ERROR: LOG.warn(message); break; case ValidationEvent.FATAL_ERROR: LOG.error(message); break; } } }