Java Code Examples for com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext#handleError()

The following examples show how to use com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext#handleError() . 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: ClassBeanInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 2
Source File: ClassBeanInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 3
Source File: ClassBeanInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 4
Source File: ClassBeanInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 5
Source File: ClassBeanInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 6
Source File: ClassBeanInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException {

        BeanT bean = null;
        if (factoryMethod == null){
           bean = ClassFactory.create0(jaxbType);
        }else {
            Object o = ClassFactory.create(factoryMethod);
            if( jaxbType.isInstance(o) ){
                bean = (BeanT)o;
            } else {
                throw new InstantiationException("The factory method didn't return a correct object");
            }
        }

        if(xmlLocatorField!=null)
            // need to copy because Locator is mutable
            try {
                xmlLocatorField.set(bean,new LocatorImpl(context.getLocator()));
            } catch (AccessorException e) {
                context.handleError(e);
            }
        return bean;
    }
 
Example 7
Source File: ClassBeanInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 8
Source File: ClassBeanInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 9
Source File: ClassBeanInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 10
Source File: ClassBeanInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 11
Source File: ClassBeanInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 12
Source File: ClassBeanInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 13
Source File: ClassBeanInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 14
Source File: ClassBeanInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException {
    try {
        if(superClazz!=null)
            superClazz.reset(bean,context);
        for( Property<BeanT> p : properties )
            p.reset(bean);
        return true;
    } catch (AccessorException e) {
        context.handleError(e);
        return false;
    }
}
 
Example 15
Source File: TransducedAccessor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}
 
Example 16
Source File: TransducedAccessor.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}
 
Example 17
Source File: TransducedAccessor.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}
 
Example 18
Source File: TransducedAccessor.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}
 
Example 19
Source File: TransducedAccessor.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}
 
Example 20
Source File: TransducedAccessor.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException {
    if(!targetType.isInstance(t))
        context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass()));
    else
        acc.set(bean,t);
}