org.kuali.rice.kns.exception
Class ExceptionIncident

java.lang.Object
  extended by org.kuali.rice.kns.exception.ExceptionIncident
All Implemented Interfaces:
KualiExceptionIncident

public class ExceptionIncident
extends Object
implements KualiExceptionIncident

This class contains the exception incident information, exception, form and session user. It is constructed and saved into the HTTP Request for passing to the jsp when an exception occurs.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
static String GENERIC_SYSTEM_ERROR_MESSAGE
           
private static org.apache.log4j.Logger LOG
           
protected  Map<String,String> properties
          Basic exception information is initialized and contained in this class instance.
 
Fields inherited from interface org.kuali.rice.kns.exception.KualiExceptionIncident
COMPONENT_NAME, DESCRIPTION, DISPLAY_MESSAGE, DOCUMENT_ID, EXCEPTION_HIDE_INCIDENT_REPORT, EXCEPTION_MESSAGE, EXCEPTION_REPORT_MESSAGE, EXCEPTION_REPORT_SUBJECT, STACK_TRACE, USER_EMAIL, USER_NAME, UUID
 
Constructor Summary
ExceptionIncident(Exception exception, Map<String,String> properties)
          This constructs list of key-value pairs from the caught exception and current settings.
ExceptionIncident(Map<String,String> inputs)
          This constructs an instance of this class from list of name-value pairs.
 
Method Summary
private  String createReportMessage()
          This method compose the exception information that includes documentId - If it's document form userEmail - Session user email userName - Session user name component - Document or lookup or inquiry form description - Information input by user or blank errorMessage - Exception error message stackTrace - Exception stack trace
private  String createReportSubject(Exception exception)
          This method compose the exception information that includes environment - Application environment componentName- Document or lookup or inquiry form errorMessage - Exception error message
 String getDisplayMessage(Exception exception)
          This overridden method return the exception if the ixception type is in the defined list.
private  Map<String,String> getExceptionInfo(Exception exception)
          This method return list of required information provided by the caught exception.
 String getExceptionStackTrace(Exception thrownException)
          This method return the thrown exception stack trace as string.
 String getProperty(String key)
          This overridden method returns value of the found property key.
private  void initialize(Exception thrownException, Map<String,String> inputs)
          This method create and populate the internal properties parameter.
 Map<String,String> toProperties()
          This overridden method return current internal properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

GENERIC_SYSTEM_ERROR_MESSAGE

public static final String GENERIC_SYSTEM_ERROR_MESSAGE
See Also:
Constant Field Values

properties

protected Map<String,String> properties
Basic exception information is initialized and contained in this class instance. Additional setting and other information can be added when exception is caught. Also, an JSP is displayed to collect additional user information and the returned parameters from the JSP can be used to initialize this class instance for reporting.

Note: The mechanism for passing data to and receiving data from the JSP uses java.util.Map. Therefore, the exception is not passed to JSP using HttpRequest. But rather a Map instance.

Constructor Detail

ExceptionIncident

public ExceptionIncident(Exception exception,
                         Map<String,String> properties)
This constructs list of key-value pairs from the caught exception and current settings.

Parameters:
exception - Caught exception
exceptionNames - List of Kuali exception for determining the display exception message
properties - Input information when the exception is caught

Example:

  • DOCUMENT_ID
  • USER_EMAIL
  • USER_NAME
  • COMPONENT_NAME

ExceptionIncident

public ExceptionIncident(Map<String,String> inputs)
This constructs an instance of this class from list of name-value pairs.

Parameters:
inputs - List of exception information such as
  • DOCUMENT_ID - If it's document form
  • USER_EMAIL - Session user email
  • USER_NAME - Session user name
  • COMPONENT_NAME - Document or lookup or inquiry form
  • attribute of GlobalVariables
  • EXCEPTION_REPORT_SUBJECT - Exception error message and current settings
  • EXCEPTION_MESSAGE - Exception error message
  • STACK_TRACE - Exception stack trace
  • DESCRIPTION - Information input by user or blank
Method Detail

initialize

private void initialize(Exception thrownException,
                        Map<String,String> inputs)
This method create and populate the internal properties parameter.

Parameters:
thrownException - The caught exception
inputs - Input information when the exception is caught

Example:

  • DOCUMENT_ID
  • USER_EMAIL
  • USER_NAME
  • COMPONENT_NAME

getExceptionInfo

private Map<String,String> getExceptionInfo(Exception exception)
This method return list of required information provided by the caught exception.

Returns:

Example: exceptionSubject, Caught exception message and settings information exceptionMessage, Caught exception message displayMessage, Either exception error message or generic exception error message stackTrace, Exception stack trace here


createReportSubject

private String createReportSubject(Exception exception)
This method compose the exception information that includes

Example; kr-dev:SomeForm:Some error message

Parameters:
exception - The caught exception
Returns:

createReportMessage

private String createReportMessage()
This method compose the exception information that includes

Example; documentId: 2942084 userEmail: someone@somewhere userName: some name description: Something went wrong! component: document errorMessage: Some error message stackTrace: Exception stack trace here

Returns:

getExceptionStackTrace

public String getExceptionStackTrace(Exception thrownException)
This method return the thrown exception stack trace as string.

Parameters:
thrownException -
Returns:

getDisplayMessage

public String getDisplayMessage(Exception exception)
This overridden method return the exception if the ixception type is in the defined list. Otherwise, it returns the GENERIC_SYSTEM_ERROR_MESSAGE.

Specified by:
getDisplayMessage in interface KualiExceptionIncident
Returns:
See Also:
KualiExceptionIncident.getDisplayMessage(Exception)

getProperty

public String getProperty(String key)
This overridden method returns value of the found property key. Except the property EXCEPTION_REPORT_MESSAGE

Specified by:
getProperty in interface KualiExceptionIncident
Returns:
null is return if not found
See Also:
KualiExceptionIncident.getProperty(java.lang.String)

toProperties

public Map<String,String> toProperties()
This overridden method return current internal properties.

Specified by:
toProperties in interface KualiExceptionIncident
Returns:

Example: documentId, 2942084 userEmail, someone@somewhere userName, some name componentFormName, Form that threw exception name exceptionMessage, Error message from exception displayMessage, Either exception error message or generic exception error message stackTrace, Exception stack trace here

See Also:
KualiExceptionIncident.toProperties()


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.