Java 类javax.xml.bind.ValidationEventLocator 实例源码
项目:OpenJSharp
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:openjdk-jdk10
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:openjdk9
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:lookaside_java-1.8.0-openjdk
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:infobip-open-jdk-8
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:cxf-plus
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:ph-commons
文件:AbstractValidationEventHandler.java
@Nullable
@OverrideOnDemand
protected String getErrorFieldName (@Nullable final ValidationEventLocator aLocator)
{
if (aLocator != null)
{
// Source object found?
final Object aObj = aLocator.getObject ();
if (aObj != null)
return "obj: " + aObj.toString ();
// Source node found?
final Node aNode = aLocator.getNode ();
if (aNode != null)
return XMLWriter.getNodeAsString (aNode);
}
return null;
}
项目:OLD-OpenJDK8
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:killbill-adyen-plugin
文件:TestIgnoreUnexpectedElementsEventHandler.java
private ValidationEvent createValidationEvent(final boolean isUnexpectedElementsMessage) {
return new ValidationEvent() {
@Override
public int getSeverity() {
throw new UnsupportedOperationException("getSeverity is not supported by ");
}
@Override
public String getMessage() {
return isUnexpectedElementsMessage ? "unexpected element ( tralala" : "other exception";
}
@Override
public Throwable getLinkedException() {
throw new UnsupportedOperationException("getLinkedException is not supported by ");
}
@Override
public ValidationEventLocator getLocator() {
throw new UnsupportedOperationException("getLocator is not supported by ");
}
};
}
项目:openjdk-icedtea7
文件:StAXConnector.java
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
visitor.startDocument(new LocatorEx() {
public ValidationEventLocator getLocation() {
return new ValidationEventLocatorImpl(this);
}
public int getColumnNumber() {
return getCurrentLocation().getColumnNumber();
}
public int getLineNumber() {
return getCurrentLocation().getLineNumber();
}
public String getPublicId() {
return getCurrentLocation().getPublicId();
}
public String getSystemId() {
return getCurrentLocation().getSystemId();
}
},nsc);
}
项目:javacash
文件:ErrorHandlerAdaptor.java
private void propagateEvent( int severity, SAXParseException saxException )
throws SAXException {
// get location info:
// sax locators simply use the location info embedded in the
// sax exception, dom locators keep a reference to their DOMScanner
// and call back to figure out where the error occurred.
ValidationEventLocator vel =
locator.getLocation( saxException );
ValidationEventImpl ve =
new ValidationEventImpl( severity, saxException.getMessage(), vel );
Exception e = saxException.getException();
if( e != null ) {
ve.setLinkedException( e );
} else {
ve.setLinkedException( saxException );
}
// call the client's event handler.
host.handleEvent( ve, severity!=ValidationEvent.FATAL_ERROR );
}
项目:wustl-common-package
文件:ErrorHandlerAdaptor.java
private void propagateEvent( int severity, SAXParseException saxException )
throws SAXException {
// get location info:
// sax locators simply use the location info embedded in the
// sax exception, dom locators keep a reference to their DOMScanner
// and call back to figure out where the error occurred.
ValidationEventLocator vel =
locator.getLocation( saxException );
ValidationEventImpl ve =
new ValidationEventImpl( severity, saxException.getMessage(), vel );
Exception e = saxException.getException();
if( e != null ) {
ve.setLinkedException( e );
} else {
ve.setLinkedException( saxException );
}
// call the client's event handler.
host.handleEvent( ve, severity!=ValidationEvent.FATAL_ERROR );
}
项目:jalphanode
文件:XMLEventHandler.java
/**
* Validates and event.
*
* <p>The validation only continues if the there are a warning, otherwise it is stopped.
*
* @param event the encapsulated validation event information. It is a provider error if this parameter is null.
*
* @return true if the JAXB Provider should attempt to continue the current unmarshal, validate, or marshal
* operation after handling this warning/error, false if the provider should terminate the current
* operation with the appropriate <tt>UnmarshalException</tt>, <tt>ValidationException</tt>, or <tt>
* MarshalException</tt>.
*/
@Override
public boolean handleEvent(final ValidationEvent event) {
final ValidationEventLocator eventLocation = event.getLocator();
final String details = MessageFormat.format("Line: [{0}:{1}] Message: {2}", eventLocation.getLineNumber(),
eventLocation.getColumnNumber(), event.getMessage());
boolean result = true;
if (event.getSeverity() == ValidationEvent.WARNING) {
LOG.warn(details);
} else {
LOG.error(details);
result = false;
}
return result;
}
项目:rexsl
文件:XsdEventHandlerTest.java
/**
* XsdEventHandler throws exception on every event.
* @throws Exception If something goes wrong
*/
@Test
public void throwsExceptionOnEveryEvent() throws Exception {
final ValidationEventLocator locator =
Mockito.mock(ValidationEventLocator.class);
Mockito.doReturn(1).when(locator).getLineNumber();
Mockito.doReturn(1).when(locator).getColumnNumber();
Mockito.doReturn(new URL("http://localhost")).when(locator).getURL();
final ValidationEvent event = Mockito.mock(ValidationEvent.class);
Mockito.doReturn("msg").when(event).getMessage();
Mockito.doReturn(locator).when(event).getLocator();
final ValidationEventHandler handler = new XsdEventHandler();
MatcherAssert.assertThat(
handler.handleEvent(event),
Matchers.is(false)
);
}
项目:MyDMAM
文件:FFprobeJAXB.java
public FFprobeJAXB() throws JAXBException, ParserConfigurationException {
/**
* Load JAXB classes
*/
JAXBContext jc = JAXBContext.newInstance("org.ffmpeg.ffprobe");
unmarshaller = jc.createUnmarshaller();
/**
* Prepare an error catcher if trouble are catched during import.
*/
unmarshaller.setEventHandler((ValidationEventHandler) e -> {
ValidationEventLocator localtor = e.getLocator();
Loggers.Transcode.warn("FFprobe XML validation: " + e.getMessage() + " [s" + e.getSeverity() + "] at line " + localtor.getLineNumber() + ", column " + localtor.getColumnNumber() + " offset " + localtor.getOffset() + " node: " + localtor.getNode() + ", object " + localtor.getObject());
return true;
});
/**
* Load XML engine
*/
DocumentBuilderFactory xmlDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
xml_document_builder = xmlDocumentBuilderFactory.newDocumentBuilder();
xml_document_builder.setErrorHandler(null);
}
项目:lams
文件:JaxbHelper.java
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
ValidationEventLocator locator = validationEvent.getLocator();
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
message = validationEvent.getMessage();
return false;
}
项目:lams
文件:JaxbProcessor.java
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
ValidationEventLocator locator = validationEvent.getLocator();
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
message = validationEvent.getMessage();
return false;
}
项目:OpenJSharp
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:OpenJSharp
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:openjdk-jdk10
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:openjdk-jdk10
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:openjdk9
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:openjdk9
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:Java8CN
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:lookaside_java-1.8.0-openjdk
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:lookaside_java-1.8.0-openjdk
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:omakase
文件:DashManifestParser.java
private static boolean handleValidationEvent(ImmutableList.Builder<String> errorList, ValidationEvent validationEvent) {
if (validationEvent.getSeverity() != ValidationEvent.WARNING) {
ValidationEventLocator locator = validationEvent.getLocator();
errorList.add("Line:Col[" + locator.getLineNumber() +
":" + locator.getColumnNumber() +
"]:" + validationEvent.getMessage());
}
return true;
}
项目:mobac
文件:CustomMapSourceLoader.java
public boolean handleEvent(ValidationEvent event) {
ValidationEventLocator loc = event.getLocator();
String file = loc.getURL().getFile();
try {
file = URLDecoder.decode(file, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
int lastSlash = file.lastIndexOf('/');
if (lastSlash > 0)
file = file.substring(lastSlash + 1);
String errorMsg = event.getMessage();
if (errorMsg == null) {
Throwable t = event.getLinkedException();
while (t != null && errorMsg == null) {
errorMsg = t.getMessage();
t = t.getCause();
}
}
JOptionPane
.showMessageDialog(null, "<html><h3>Failed to load a custom map</h3><p><i>" + errorMsg
+ "</i></p><br><p>file: \"<b>" + file + "</b>\"<br>line/column: <i>" + loc.getLineNumber()
+ "/" + loc.getColumnNumber() + "</i></p>", "Error: custom map loading failed",
JOptionPane.ERROR_MESSAGE);
log.error(event.toString());
return false;
}
项目:mobac
文件:Profile.java
public AtlasInterface load() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Atlas.class);
Unmarshaller um = context.createUnmarshaller();
um.setEventHandler(new ValidationEventHandler() {
public boolean handleEvent(ValidationEvent event) {
ValidationEventLocator loc = event.getLocator();
String file = loc.getURL().getFile();
int lastSlash = file.lastIndexOf('/');
if (lastSlash > 0)
file = file.substring(lastSlash + 1);
int ret = JOptionPane.showConfirmDialog(
null,
String.format(I18nUtils.localizedStringForKey("msg_error_load_atlas_profile"),
event.getMessage(), file, loc.getLineNumber(), loc.getColumnNumber()),
I18nUtils.localizedStringForKey("msg_error_load_atlas_profile_title"),
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
log.error(event.toString());
return (ret == JOptionPane.YES_OPTION);
}
});
try {
AtlasInterface newAtlas = (AtlasInterface) um.unmarshal(file);
return newAtlas;
} catch (Exception e) {
throw new JAXBException(e.getMessage(), e);
}
}
项目:infobip-open-jdk-8
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:infobip-open-jdk-8
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:droidlinguist
文件:JaxbUtil.java
/**
* Calculates a location message for the event.
*
* {@link DefaultValidationEventHandler#getLocation(ValidationEvent)}
*/
public static String getErrorLocation(ValidationEvent event)
{
StringBuilder msg = new StringBuilder();
ValidationEventLocator locator = event.getLocator();
if (locator != null)
{
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if (url != null || line != -1)
{
msg.append("line " + line);
if (url != null)
msg.append(" of " + url);
}
else if (obj != null)
{
msg.append(" obj: " + obj.toString());
}
else if (node != null)
{
msg.append(" node: " + node.toString());
}
}
else
{
msg.append("Cannot determinate the location of the error/warning");
}
return msg.toString();
}
项目:cxf-plus
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:ph-commons
文件:AbstractValidationEventHandler.java
@Nullable
@OverrideOnDemand
protected String getLocationResourceID (@Nullable final ValidationEventLocator aLocator)
{
if (aLocator != null)
{
// Source file found?
final URL aURL = aLocator.getURL ();
if (aURL != null)
return aURL.toString ();
}
return null;
}
项目:ph-commons
文件:AbstractValidationEventHandler.java
public final boolean handleEvent (@Nonnull final ValidationEvent aEvent)
{
final IErrorLevel aErrorLevel = getErrorLevel (aEvent.getSeverity ());
final SingleErrorBuilder aErrBuilder = SingleError.builder ().setErrorLevel (aErrorLevel);
final ValidationEventLocator aLocator = aEvent.getLocator ();
aErrBuilder.setErrorLocation (new SimpleLocation (getLocationResourceID (aLocator),
aLocator != null ? aLocator.getLineNumber ()
: ILocation.ILLEGAL_NUMBER,
aLocator != null ? aLocator.getColumnNumber ()
: ILocation.ILLEGAL_NUMBER))
.setErrorFieldName (getErrorFieldName (aLocator));
// Message may be null in some cases (e.g. when a linked exception is
// present), but is not allowed to be null!
String sMsg = aEvent.getMessage ();
if (sMsg == null)
{
if (aEvent.getLinkedException () != null)
{
sMsg = aEvent.getLinkedException ().getMessage ();
if (sMsg == null)
sMsg = "Exception";
}
else
{
// Does this ever happen????
sMsg = "Validation event";
}
}
aErrBuilder.setErrorText (sMsg).setLinkedException (aEvent.getLinkedException ());
// call our callback
onEvent (aErrBuilder.build ());
// Continue processing?
return continueProcessing (aErrorLevel);
}
项目:OLD-OpenJDK8
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}
项目:OLD-OpenJDK8
文件:DefaultValidationEventHandler.java
/**
* Calculate a location message for the event
*
*/
private String getLocation(ValidationEvent event) {
StringBuffer msg = new StringBuffer();
ValidationEventLocator locator = event.getLocator();
if( locator != null ) {
URL url = locator.getURL();
Object obj = locator.getObject();
Node node = locator.getNode();
int line = locator.getLineNumber();
if( url!=null || line!=-1 ) {
msg.append( "line " + line );
if( url!=null )
msg.append( " of " + url );
} else if( obj != null ) {
msg.append( " obj: " + obj.toString() );
} else if( node != null ) {
msg.append( " node: " + node.toString() );
}
} else {
msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) );
}
return msg.toString();
}
项目:solr-fusion
文件:XmlValidationHandler.java
@Override
public boolean handleEvent(ValidationEvent ve)
{
if (ve.getSeverity() == ValidationEvent.FATAL_ERROR
|| ve.getSeverity() == ValidationEvent.ERROR)
{
ValidationEventLocator locator = ve.getLocator();
log.error("{}: {} at line={}, column={}", locator.getURL(),
ve.getMessage(), locator.getLineNumber(),
locator.getColumnNumber());
foundErrors = true;
}
return true;
}
项目:lens
文件:LensJAXBValidationExceptionMapper.java
@Override
public Response toResponse(LensJAXBValidationException e) {
ValidationEvent event = e.getEvent();
ValidationEventLocator vel = event.getLocator();
String msg = "XML Validation Exception: " + event.getMessage() + " at row: " + vel.getLineNumber() + " column: "
+ vel.getColumnNumber();
LensAPIResult lensAPIResult =
LensAPIResult.composedOf(null, new MappedDiagnosticLogSegregationContext().getLogSegragationId(),
LensErrorTO.composedOf(LensCommonErrorCode.INVALID_XML_ERROR.getValue(), msg,
Arrays.toString(e.getStackTrace())), Response.Status.BAD_REQUEST);
return Response.status(Response.Status.BAD_REQUEST).entity(lensAPIResult).build();
}
项目:openjdk-icedtea7
文件:LocatorEx.java
public Snapshot(LocatorEx loc) {
columnNumber = loc.getColumnNumber();
lineNumber = loc.getLineNumber();
systemId = loc.getSystemId();
publicId = loc.getPublicId();
ValidationEventLocator vel = loc.getLocation();
offset = vel.getOffset();
url = vel.getURL();
object = vel.getObject();
node = vel.getNode();
}