javax.xml.bind.ValidationEvent#getLinkedException ( )源码实例Demo

下面列出了javax.xml.bind.ValidationEvent#getLinkedException ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码2 项目: TencentKona-8   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码3 项目: jdk8u60   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码4 项目: jdk8u60   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码5 项目: openjdk-jdk8u   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码7 项目: openjdk-jdk8u-backup   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码9 项目: openjdk-jdk9   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码10 项目: openjdk-jdk9   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码11 项目: hottub   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码12 项目: hottub   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码13 项目: openjdk-8-source   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码14 项目: openjdk-8-source   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码15 项目: openjdk-8   文件: XMLSerializer.java
public void reportError( ValidationEvent ve ) throws SAXException {
    ValidationEventHandler handler;

    try {
        handler = marshaller.getEventHandler();
    } catch( JAXBException e ) {
        throw new SAXException2(e);
    }

    if(!handler.handleEvent(ve)) {
        if(ve.getLinkedException() instanceof Exception)
            throw new SAXException2((Exception)ve.getLinkedException());
        else
            throw new SAXException2(ve.getMessage());
    }
}
 
源代码16 项目: openjdk-8   文件: UnmarshallingContext.java
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
源代码17 项目: aion-germany   文件: XmlValidationHandler.java
@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;
}
 
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);
}
 
源代码19 项目: SeaCloudsPlatform   文件: ValidationHandler.java
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
    if (validationEvent.getLinkedException()==null){
        logger.warn("detected " +validationEvent.getMessage() +"  it will be ignored");            
        return true;
    }
    return false;
}