src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java

Print this page

        

*** 92,106 **** state.receiver = null; } @SuppressWarnings({"StringEquality"}) protected final void reportUnexpectedChildElement(TagName ea, boolean canRecover) throws SAXException { ! if(canRecover && !UnmarshallingContext.getInstance().parent.hasEventHandler()) // 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 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 ); } --- 92,110 ---- state.receiver = null; } @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 ); }