Package org.glassfish.jersey.internal
Class Errors
java.lang.Object
org.glassfish.jersey.internal.Errors
Errors utility used to file processing messages (e.g. validation, provider, resource building errors, hint).
 
 Error filing methods (
#warning, #error, #fatal) can be invoked only in the "error scope" which is
 created by process(Producer) or
 processWithException(Producer) methods. Filed error messages are present also in this
 scope.
 
 TODO do not use static thread local?- Author:
- Michal Gajdos
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classGeneric error message.static classError message exception.
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidAdd an error to the list of messages.static voidAdd an error to the list of messages.static voidAdd a fatal error to the list of messages.static booleanCheck whether a fatal error is present in the list of all messages.static List<Errors.ErrorMessage>Get the list of all error messages.static List<Errors.ErrorMessage>getErrorMessages(boolean afterMark) Get the list of error messages.static voidAdd a hint to the list of messages.static booleanlogErrors(boolean afterMark) Log errors and return a status flag indicating whether a fatal issue has been found in the error collection.static voidmark()Set a mark at a current position in the errors messages list.static voidInvoke given task and gather messages.static <T> TInvoke given callable task and gather messages.static <T> TInvoke given producer task and gather errors.static voidprocessWithException(Runnable task) Invoke given task and gather messages.static <T> TprocessWithException(Producer<T> producer) Invoke given producer task and gather messages.static voidreset()Removes all issues that have been added since the last marked position as well as removes the last mark.static voidunmark()Remove a previously set mark, if any.static voidAdd a warning to the list of messages.
- 
Method Details- 
errorAdd an error to the list of messages.- Parameters:
- message- message of the error.
- severity- indicates severity of added error.
 
- 
errorAdd an error to the list of messages.- Parameters:
- source- source of the error.
- message- message of the error.
- severity- indicates severity of added error.
 
- 
fatalAdd a fatal error to the list of messages.- Parameters:
- source- source of the error.
- message- message of the error.
 
- 
warningAdd a warning to the list of messages.- Parameters:
- source- source of the error.
- message- message of the error.
 
- 
hintAdd a hint to the list of messages.- Parameters:
- source- source of the error.
- message- message of the error.
 
- 
logErrorspublic static boolean logErrors(boolean afterMark) Log errors and return a status flag indicating whether a fatal issue has been found in the error collection.The afterMarkflag indicates whether only those issues should be logged that were added after amark has been set.- Parameters:
- afterMark- if- true, only issues added after a mark has been set are returned, if- falseall issues are returned.
- Returns:
- trueif there are any fatal issues present in the collection,- falseotherwise.
 
- 
fatalIssuesFoundpublic static boolean fatalIssuesFound()Check whether a fatal error is present in the list of all messages.- Returns:
- trueif there are any fatal issues in this error context,- falseotherwise.
 
- 
processInvoke given producer task and gather errors. After the task is complete all gathered errors are logged. No exception is thrown even if there is a fatal error present in the list of errors.- Parameters:
- producer- producer task to be invoked.
- Returns:
- the result produced by the task.
 
- 
processInvoke given callable task and gather messages. After the task is complete all gathered errors are logged. Any exception thrown by the throwable is re-thrown.- Parameters:
- task- callable task to be invoked.
- Returns:
- the result produced by the task.
- Throws:
- Exception- exception thrown by the task.
 
- 
processWithExceptionInvoke given producer task and gather messages. After the task is complete all gathered errors are logged. If there is a fatal error present in the list of errors anexceptionis thrown.- Parameters:
- producer- producer task to be invoked.
- Returns:
- the result produced by the task.
 
- 
processInvoke given task and gather messages. After the task is complete all gathered errors are logged. No exception is thrown even if there is a fatal error present in the list of errors.- Parameters:
- task- task to be invoked.
 
- 
processWithExceptionInvoke given task and gather messages. After the task is complete all gathered errors are logged. If there is a fatal error present in the list of errors anexceptionis thrown.- Parameters:
- task- task to be invoked.
 
- 
getErrorMessagesGet the list of all error messages.- Returns:
- non-null error message list.
 
- 
getErrorMessagesGet the list of error messages.The afterMarkflag indicates whether only those issues should be returned that were added after amark has been set.- Parameters:
- afterMark- if- true, only issues added after a mark has been set are returned, if- falseall issues are returned.
- Returns:
- non-null error list.
 
- 
markpublic static void mark()Set a mark at a current position in the errors messages list.
- 
unmarkpublic static void unmark()Remove a previously set mark, if any.
- 
resetpublic static void reset()Removes all issues that have been added since the last marked position as well as removes the last mark.
 
-