public String toString() { return format(); }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
/** * 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 ); }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
@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 ); }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
/** * Called when there's no corresponding ID value. */ public void errorUnresolvedIDREF(Object bean, String idref, LocatorEx loc) throws SAXException { handleEvent( new ValidationEventImpl( ValidationEvent.ERROR, Messages.UNRESOLVED_IDREF.format(idref), loc.getLocation()), true ); }
public String format( Object... args ) { return MessageFormat.format( rb.getString(name()), args ); } }
/** * Based on current {@link Logger} {@link Level} and errorCounter value determines if error should be reported. * * If the method called and return true it is expected that error will be reported. And that's why * errorCounter is automatically decremented during the check. * * NOT THREAD SAFE!!! In case of heave concurrency access several additional errors could be reported. It's not expected to be the * problem. Otherwise add synchronization here. * * @return true in case if {@link Level#FINEST} is set OR we haven't exceed errors reporting limit. */ public boolean shouldErrorBeReported() throws SAXException { if (logger.isLoggable(Level.FINEST)) return true; if (errorsCounter >= 0) { --errorsCounter; if (errorsCounter == 0) // it's possible to miss this because of concurrency. If required add synchronization here handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, Messages.ERRORS_LIMIT_EXCEEDED.format(), getLocator().getLocation(), null), true); } return errorsCounter >= 0; } }
context.handleError(Messages.UNABLE_TO_CREATE_MAP.format(attCatchAll.valueType)); return;
public String toString() { return format(); }
/** * 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 ); }
@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 ); }
/** * Called when there's no corresponding ID value. */ public void errorUnresolvedIDREF(Object bean, String idref, LocatorEx loc) throws SAXException { handleEvent( new ValidationEventImpl( ValidationEvent.ERROR, Messages.UNRESOLVED_IDREF.format(idref), loc.getLocation()), true ); }
/** * Based on current {@link Logger} {@link Level} and errorCounter value determines if error should be reported. * * If the method called and return true it is expected that error will be reported. And that's why * errorCounter is automatically decremented during the check. * * NOT THREAD SAFE!!! In case of heave concurrency access several additional errors could be reported. It's not expected to be the * problem. Otherwise add synchronization here. * * @return true in case if {@link Level#FINEST} is set OR we haven't exceed errors reporting limit. */ public boolean shouldErrorBeReported() throws SAXException { if (logger.isLoggable(Level.FINEST)) return true; if (errorsCounter >= 0) { --errorsCounter; if (errorsCounter == 0) // it's possible to miss this because of concurrency. If required add synchronization here handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, Messages.ERRORS_LIMIT_EXCEEDED.format(), getLocator().getLocation(), null), true); } return errorsCounter >= 0; } }
context.handleError(Messages.UNABLE_TO_CREATE_MAP.format(attCatchAll.valueType)); return;
public String toString() { return format(); }
public String toString() { return format(); }