Java Code Examples for javax.xml.bind.ValidationEventLocator#getLineNumber()

The following examples show how to use javax.xml.bind.ValidationEventLocator#getLineNumber() . 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: DefaultValidationEventHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: DefaultValidationEventHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 3
Source File: XmlBindingTool.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getLocationDescription(ValidationEvent event) {
   ValidationEventLocator locator = event.getLocator();
   if (locator == null) {
      return "XML with location unavailable";
   } else {
      StringBuffer msg = new StringBuffer();
      URL url = locator.getURL();
      Object obj = locator.getObject();
      Node node = locator.getNode();
      int line = locator.getLineNumber();
      if (url == null && line == -1) {
         if (obj != null) {
            msg.append("obj: ");
            msg.append(obj);
         } else if (node != null) {
            msg.append("node: ");
            msg.append(node);
         }
      } else {
         msg.append("line ");
         msg.append(line);
         if (url != null) {
            msg.append(" of ");
            msg.append(url);
         }
      }

      return msg.toString();
   }
}
 
Example 4
Source File: XmlBindingTool.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
private String getLocationDescription(ValidationEvent event) {
   ValidationEventLocator locator = event.getLocator();
   if (locator == null) {
      return "XML with location unavailable";
   } else {
      StringBuffer msg = new StringBuffer();
      URL url = locator.getURL();
      Object obj = locator.getObject();
      Node node = locator.getNode();
      int line = locator.getLineNumber();
      if (url == null && line == -1) {
         if (obj != null) {
            msg.append("obj: ");
            msg.append(obj);
         } else if (node != null) {
            msg.append("node: ");
            msg.append(node);
         }
      } else {
         msg.append("line ");
         msg.append(line);
         if (url != null) {
            msg.append(" of ");
            msg.append(url);
         }
      }

      return msg.toString();
   }
}
 
Example 5
Source File: DefaultValidationEventHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 6
Source File: DefaultValidationEventHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 7
Source File: XmlValidationHandler.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean handleEvent(ValidationEvent event) {
	if (event.getSeverity() == ValidationEvent.FATAL_ERROR || event.getSeverity() == ValidationEvent.ERROR) {
		ValidationEventLocator locator = event.getLocator();
		String message = event.getMessage();
		int line = locator.getLineNumber();
		int column = locator.getColumnNumber();
		log.error("Error at [line=" + line + ", column=" + column + "]: " + message);
		throw new Error(event.getLinkedException());
	}
	return true;
}
 
Example 8
Source File: DefaultValidationEventHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 9
Source File: ContextProvidingValidationEventHandler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
	ValidationEventLocator locator = validationEvent.getLocator();
	lineNumber = locator.getLineNumber();
	columnNumber = locator.getColumnNumber();
	message = validationEvent.getMessage();
	return false;
}
 
Example 10
Source File: JaxbCfgProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
	ValidationEventLocator locator = validationEvent.getLocator();
	lineNumber = locator.getLineNumber();
	columnNumber = locator.getColumnNumber();
	message = validationEvent.getMessage();
	return false;
}
 
Example 11
Source File: DefaultValidationEventHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 12
Source File: DefaultValidationEventHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 13
Source File: DefaultValidationEventHandler.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 14
Source File: DefaultValidationEventHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 15
Source File: DefaultValidationEventHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 16
Source File: DefaultValidationEventHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}