Class ErrorInfo


  • public class ErrorInfo
    extends java.lang.Object

    A simple class that encapsulates all the information needed to report a problem using the automated report/processing system.

    All HTML referred to in this API refers to version 3.2 of the HTML markup specification.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String basicErrorMessage
      Basic message that describes incident
      private java.lang.String category
      A category name, indicating where in the application this incident occurred.
      private java.lang.String detailedErrorMessage
      Message that will fully describe the incident with all the available details
      private java.lang.Throwable errorException
      Optional Throwable that will be used as a possible source for additional information
      private java.util.logging.Level errorLevel
      Used to specify how bad this error was.
      private java.util.Map<java.lang.String,​java.lang.String> state
      A Map which captures the state of the application at the time of an exception.
      private java.lang.String title
      Short string that will be used as a error title
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrorInfo​(java.lang.String title, java.lang.String basicErrorMessage, java.lang.String detailedErrorMessage, java.lang.String category, java.lang.Throwable errorException, java.util.logging.Level errorLevel, java.util.Map<java.lang.String,​java.lang.String> state)
      Creates a new ErrorInfo based on the provided data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getBasicErrorMessage()
      Gets the basic error message.
      java.lang.String getCategory()
      Gets the category name.
      java.lang.String getDetailedErrorMessage()
      Gets the detailed error message.
      java.lang.Throwable getErrorException()
      Gets the actual exception that generated the error.
      java.util.logging.Level getErrorLevel()
      Gets the severity of the error.
      java.util.Map<java.lang.String,​java.lang.String> getState()
      Gets a copy of the application state at the time that the incident occured.
      java.lang.String getTitle()
      Gets the string to use for a dialog title or other quick reference.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • title

        private java.lang.String title
        Short string that will be used as a error title
      • basicErrorMessage

        private java.lang.String basicErrorMessage
        Basic message that describes incident
      • detailedErrorMessage

        private java.lang.String detailedErrorMessage
        Message that will fully describe the incident with all the available details
      • category

        private java.lang.String category
        A category name, indicating where in the application this incident occurred. It is recommended that this be the same value as you would use when logging.
      • errorException

        private java.lang.Throwable errorException
        Optional Throwable that will be used as a possible source for additional information
      • errorLevel

        private java.util.logging.Level errorLevel
        Used to specify how bad this error was.
      • state

        private java.util.Map<java.lang.String,​java.lang.String> state
        A Map which captures the state of the application at the time of an exception. This state is then available for error reports.
    • Constructor Detail

      • ErrorInfo

        public ErrorInfo​(java.lang.String title,
                         java.lang.String basicErrorMessage,
                         java.lang.String detailedErrorMessage,
                         java.lang.String category,
                         java.lang.Throwable errorException,
                         java.util.logging.Level errorLevel,
                         java.util.Map<java.lang.String,​java.lang.String> state)
        Creates a new ErrorInfo based on the provided data.
        Parameters:
        title - used as a quick reference for the error (for example, it might be used as the title of an error dialog or as the subject of an email message). May be null.
        basicErrorMessage - short description of the problem. May be null.
        detailedErrorMessage - full description of the problem. It is recommended, though not required, that this String contain HTML to improve the look and layout of the detailed error message. May be null.
        category - A category name, indicating where in the application this incident occurred. It is recommended that this be the same value as you would use when logging. May be null.
        errorException - Throwable that can be used as a source for additional information such as call stack, thread name, etc. May be null.
        errorLevel - any Level (Level.SEVERE, Level.WARNING, etc). If null, then the level will be set to SEVERE.
        state - the state of the application at the time the incident occured. The standard System properties are automatically added to this state, and thus do not need to be included. This value may be null. If null, the resulting map will contain only the System properties. If there is a value in the map with a key that also occurs in the System properties (for example: sun.java2d.noddraw), then the developer supplied value will be used. In other words, defined parameters override standard ones. In addition, the keys "System.currentTimeMillis" and "isOnEDT" are both defined automatically.
    • Method Detail

      • getTitle

        public java.lang.String getTitle()
        Gets the string to use for a dialog title or other quick reference. Used as a quick reference for the incident. For example, it might be used as the title of an error dialog or as the subject of an email message.
        Returns:
        quick reference String. May be null.
      • getBasicErrorMessage

        public java.lang.String getBasicErrorMessage()

        Gets the basic error message. This message should be clear and user oriented. This String may have HTML formatting, but any such formatting should be used sparingly. Generally, such formatting makes sense for making certain words bold, but should not be used for page layout or other such things.

        For example, the following are perfectly acceptable basic error messages:

              "Your camera cannot be located. Please make sure that it is powered on
               and that it is connected to this computer. Consult the instructions
               provided with your camera to make sure you are using the appropriate
               cable for attaching the camera to this computer"
        
              "<html>You are running on <b>reserver</b> battery
               power. Please plug into a power source immediately, or your work may
               be lost!</html>"
         

        Returns:
        basic error message or null
      • getDetailedErrorMessage

        public java.lang.String getDetailedErrorMessage()

        Gets the detailed error message. Unlike getBasicErrorMessage(), this method may return a more technical message to the user. However, it should still be user oriented. This String should be formatted using basic HTML to improve readability as necessary.

        This method may return null.

        Returns:
        detailed error message or null
      • getCategory

        public java.lang.String getCategory()
        Gets the category name. This value indicates where in the application this incident occurred. It is recommended that this be the same value as you would use when logging. This may be null.
        Returns:
        the category. May be null.
      • getErrorException

        public java.lang.Throwable getErrorException()
        Gets the actual exception that generated the error. If this returns a non null value, then getBasicErrorMessage() may return a null value. If this returns a non null value and getDetailedErrorMessage() returns a null value, then this returned Throwable may be used as the basis for the detailed error message (generally by showing the stack trace).
        Returns:
        exception or null
      • getErrorLevel

        public java.util.logging.Level getErrorLevel()
        Gets the severity of the error. The default level is Level.SEVERE, but any Level may be specified when constructing an ErrorInfo.
        Returns:
        the error level. This will never be null
      • getState

        public java.util.Map<java.lang.String,​java.lang.String> getState()

        Gets a copy of the application state at the time that the incident occured. This map will never be null. If running with appropriate permissions the map will contain all the System properties. In addition, it contains two keys, "System.currentTimeMillis" and "isOnEDT".

        Warning: The System.properties may not contain the exact set of System properties at the time the exception occured. This is due to the nature of System.getProperties() and the Properties collection. While they are property synchronized, it is possible that while iterating the set of properties in the ErrorInfo constructor that some other code can change the properties on another thread. This is unlikely to occur, but in some applications may occur.

        Returns:
        a copy of the application state. This will never be null.