protected static void reportError(String msg, boolean canRecover) throws SAXException { reportError(msg, null, canRecover ); }
public static void handleGenericError(Error e) throws SAXException { reportError(e.getMessage(), false); }
public static void handleGenericException(Exception e, boolean canRecover) throws SAXException { reportError(e.getMessage(), e, canRecover ); }
/** * Called when this loaderis an active loaderand we see a chunk of text. * * The runtime makes sure that adjacent characters (even those separated * by comments, PIs, etc) are reported as one event. * IOW, you won't see two text event calls in a row. */ public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { // make str printable text = text.toString().replace('\r',' ').replace('\n',' ').replace('\t',' ').trim(); reportError(Messages.UNEXPECTED_TEXT.format(text), true ); }
/** * Creates a new instance of the specified class. * In the unmarshaller, we need to check the user-specified factory class. */ public Object createInstance( JaxBeanInfo beanInfo ) throws SAXException { if(!factories.isEmpty()) { Factory factory = factories.get(beanInfo.jaxbType); if(factory!=null) return factory.createInstance(); } try { return beanInfo.createInstance(this); } catch (IllegalAccessException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InvocationTargetException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InstantiationException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } return null; // can never be here }
@SuppressWarnings({"StringEquality"}) protected final void reportUnexpectedChildElement(TagName ea, boolean canRecover) throws SAXException { if (canRecover) { // this error happens particurly often (when input documents contain a lot of unexpected elements to be ignored), // so don't bother computing all the messages and etc if we know that // there's no event handler to receive the error in the end. See #286 UnmarshallingContext context = UnmarshallingContext.getInstance(); if (!context.parent.hasEventHandler() // is somebody listening? || !context.shouldErrorBeReported()) // should we report error? return; } if(ea.uri!=ea.uri.intern() || ea.local!=ea.local.intern()) reportError(Messages.UNINTERNED_STRINGS.format(), canRecover ); else reportError(Messages.UNEXPECTED_ELEMENT.format(ea.uri,ea.local,computeExpectedElements()), canRecover ); }
protected static void reportError(String msg, boolean canRecover) throws SAXException { reportError(msg, null, canRecover ); }
public static void handleGenericException(Exception e, boolean canRecover) throws SAXException { reportError(e.getMessage(), e, canRecover ); }
public static void handleGenericError(Error e) throws SAXException { reportError(e.getMessage(), false); }
/** * Called when this loaderis an active loaderand we see a chunk of text. * * The runtime makes sure that adjacent characters (even those separated * by comments, PIs, etc) are reported as one event. * IOW, you won't see two text event calls in a row. */ public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { // make str printable text = text.toString().replace('\r',' ').replace('\n',' ').replace('\t',' ').trim(); reportError(Messages.UNEXPECTED_TEXT.format(text), true ); }
/** * Creates a new instance of the specified class. * In the unmarshaller, we need to check the user-specified factory class. */ public Object createInstance( JaxBeanInfo beanInfo ) throws SAXException { if(!factories.isEmpty()) { Factory factory = factories.get(beanInfo.jaxbType); if(factory!=null) return factory.createInstance(); } try { return beanInfo.createInstance(this); } catch (IllegalAccessException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InvocationTargetException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InstantiationException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } return null; // can never be here }
@SuppressWarnings({"StringEquality"}) protected final void reportUnexpectedChildElement(TagName ea, boolean canRecover) throws SAXException { if (canRecover) { // this error happens particurly often (when input documents contain a lot of unexpected elements to be ignored), // so don't bother computing all the messages and etc if we know that // there's no event handler to receive the error in the end. See #286 UnmarshallingContext context = UnmarshallingContext.getInstance(); if (!context.parent.hasEventHandler() // is somebody listening? || !context.shouldErrorBeReported()) // should we report error? return; } if(ea.uri!=ea.uri.intern() || ea.local!=ea.local.intern()) reportError(Messages.UNINTERNED_STRINGS.format(), canRecover ); else reportError(Messages.UNEXPECTED_ELEMENT.format(ea.uri,ea.local,computeExpectedElements()), canRecover ); }
protected static void reportError(String msg, boolean canRecover) throws SAXException { reportError(msg, null, canRecover ); }
protected static void reportError(String msg, boolean canRecover) throws SAXException { reportError(msg, null, canRecover ); }
public static void handleGenericError(Error e) throws SAXException { reportError(e.getMessage(), false); }
public static void handleGenericError(Error e) throws SAXException { reportError(e.getMessage(), false); }
public static void handleGenericException(Exception e, boolean canRecover) throws SAXException { reportError(e.getMessage(), e, canRecover ); }
public static void handleGenericException(Exception e, boolean canRecover) throws SAXException { reportError(e.getMessage(), e, canRecover ); }
/** * Called when this loaderis an active loaderand we see a chunk of text. * * The runtime makes sure that adjacent characters (even those separated * by comments, PIs, etc) are reported as one event. * IOW, you won't see two text event calls in a row. */ public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { // make str printable text = text.toString().replace('\r',' ').replace('\n',' ').replace('\t',' ').trim(); reportError(Messages.UNEXPECTED_TEXT.format(text), true ); }
/** * Called when this loaderis an active loaderand we see a chunk of text. * * The runtime makes sure that adjacent characters (even those separated * by comments, PIs, etc) are reported as one event. * IOW, you won't see two text event calls in a row. */ public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { // make str printable text = text.toString().replace('\r',' ').replace('\n',' ').replace('\t',' ').trim(); reportError(Messages.UNEXPECTED_TEXT.format(text), true ); }