You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by ra...@apache.org on 2006/10/27 02:04:08 UTC
svn commit: r468201 -
/shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java
Author: rahul
Date: Thu Oct 26 17:04:07 2006
New Revision: 468201
URL: http://svn.apache.org/viewvc?view=rev&rev=468201
Log:
Exceptions should first be logged before DialogListener callbacks, for better archival.
SHALE-268
Modified:
shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java
Modified: shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java?view=diff&rev=468201&r1=468200&r2=468201
==============================================================================
--- shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java (original)
+++ shale/framework/trunk/shale-dialog/src/main/java/org/apache/shale/dialog/base/AbstractDialogContext.java Thu Oct 26 17:04:07 2006
@@ -21,6 +21,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.shale.dialog.DialogContext;
import org.apache.shale.dialog.DialogListener;
@@ -41,6 +43,12 @@
private List listeners = new ArrayList();
+ /**
+ * <p>The <code>Log</code> instance for this class.</p>
+ */
+ private transient Log log;
+
+
//--------------------------------------------------- Listener Bookkeeping
/**
@@ -139,13 +147,16 @@
/**
* Inform all registered {@link DialogListener}s that the dialog
- * instance has encountered an unexpected error condition.
+ * instance has encountered an unexpected error condition. The exception
+ * is first logged for archival.
*
* @param exception A potentially implementation specific exception
* during the execution of this dialog instance
*/
protected void fireOnException(Exception exception) {
+ log().error(exception.getMessage(), exception);
+
synchronized (listeners) {
for (int i = 0; i < listeners.size(); i++) {
DialogListener listener = (DialogListener) listeners.get(i);
@@ -211,6 +222,19 @@
listener.onTransition(fromStateId, toStateId);
}
}
+
+ }
+
+
+ /**
+ * <p>Return the <code>Log</code> instance for this class.</p>
+ */
+ private Log log() {
+
+ if (log == null) {
+ log = LogFactory.getLog(AbstractDialogContext.class);
+ }
+ return log;
}