[embjopr-commits] EMBJOPR SVN: r419 - in trunk/core/src/main: webapp and 1 other directory.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Thu May 14 18:58:57 EDT 2009


Author: ips
Date: 2009-05-14 18:58:57 -0400 (Thu, 14 May 2009)
New Revision: 419

Modified:
   trunk/core/src/main/java/org/jboss/on/embedded/ui/ExceptionAction.java
   trunk/core/src/main/webapp/error.xhtml
Log:
remove dependency on seam-debug.jar from ExceptionAction component


Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/ExceptionAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/ExceptionAction.java	2009-05-14 20:51:44 UTC (rev 418)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/ExceptionAction.java	2009-05-14 22:58:57 UTC (rev 419)
@@ -19,30 +19,35 @@
  */
 package org.jboss.on.embedded.ui;
 
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.util.Exceptions;
 import org.jboss.seam.annotations.Name;
 import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.ScopeType;
 
+/**
+ * @author Ian Springer
+ */
 @Name("exceptionAction")
 @Scope(ScopeType.APPLICATION)
-public class ExceptionAction {
+public class ExceptionAction
+{
+    private static final String CAUGHT_EXCEPTION_COMPONENT_NAME = "org.jboss.seam.caughtException";
 
-	@In("org.jboss.seam.caughtException")
-	private Exception exception;
-        
-    public String getStackTrace() {
-		ByteArrayOutputStream out = new ByteArrayOutputStream();
-		this.exception.printStackTrace( new PrintStream(out,true) );
-		this.exception = null;
-		return out.toString();
-	}
+    public Exception getException()
+    {
+        return (Exception)org.jboss.seam.contexts.Contexts.getConversationContext().get(CAUGHT_EXCEPTION_COMPONENT_NAME);
+    }
 
-   public Exception getException()
-   {
-      return (Exception) org.jboss.seam.contexts.Contexts.getConversationContext().get("org.jboss.seam.caughtException");
-   }
+    public List<Exception> getCauses()
+    {
+        List causes = new ArrayList();
+        for (Exception cause = getException(); cause != null; cause = Exceptions.getCause(cause))
+        {
+            causes.add(cause);
+        }
+        return causes;
+    }
 }

Modified: trunk/core/src/main/webapp/error.xhtml
===================================================================
--- trunk/core/src/main/webapp/error.xhtml	2009-05-14 20:51:44 UTC (rev 418)
+++ trunk/core/src/main/webapp/error.xhtml	2009-05-14 22:58:57 UTC (rev 419)
@@ -32,10 +32,11 @@
             <div id="errorbox">
                 <h1>#{messages['exception.heading']}</h1>
                 <p>#{messages['exception.paragraph1']}</p>
-                <p>#{messages['exception.paragraph2a']} <a href="index.html">#{messages['exception.paragraph2b']}</a> #{messages['exception.paragraph2c']}</p>
+                <p>#{messages['exception.paragraph2a']} <a href="index.html">#{messages['exception.paragraph2b']}</a>
+                   #{messages['exception.paragraph2c']}</p>
                 <h3 style="padding-top: 12px; border-bottom: 1px solid #e6eaef;">Error details:</h3>
                 <div id="codebox">
-                    <a4j:repeat value="#{org.jboss.seam.debug.contexts.exceptionCauses}" var="cause" rowKeyVar="rowKey">
+                    <a4j:repeat value="#{exceptionAction.causes}" var="cause" rowKeyVar="rowKey">
                        <div style="margin-bottom: 15px">
                           <b><h:outputLabel rendered="#{rowKey ne 0}">Caused by: </h:outputLabel>#{cause}</b><br/>
                           <div style="margin-left: 20px">




More information about the embjopr-commits mailing list