You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/03/02 23:15:07 UTC

svn commit: r632861 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ tapestry-core/src/main/resources/org/apache/tapestry/ tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ tapes...

Author: hlship
Date: Sun Mar  2 14:15:06 2008
New Revision: 632861

URL: http://svn.apache.org/viewvc?rev=632861&view=rev
Log:
TAPESTRY-2222: The exception report should highlight the lines related to the application in the stack trace

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ExceptionDisplay.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ExceptionDisplay.tml
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css
    tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ExceptionInfo.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ExceptionDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ExceptionDisplay.java?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ExceptionDisplay.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ExceptionDisplay.java Sun Mar  2 14:15:06 2008
@@ -14,8 +14,11 @@
 
 package org.apache.tapestry.corelib.components;
 
+import org.apache.tapestry.annotations.GenerateAccessors;
 import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.internal.InternalConstants;
 import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.ioc.annotations.Symbol;
 import org.apache.tapestry.ioc.services.ExceptionAnalysis;
 import org.apache.tapestry.ioc.services.ExceptionAnalyzer;
 import org.apache.tapestry.ioc.services.ExceptionInfo;
@@ -39,10 +42,20 @@
     @Inject
     private ExceptionAnalyzer _analyzer;
 
+    @Inject
+    @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
+    private String _appPackage;
+
+    @GenerateAccessors
     private ExceptionInfo _info;
 
+    @GenerateAccessors
     private String _propertyName;
 
+    @GenerateAccessors
+    private StackTraceElement _frame;
+
+    @GenerateAccessors
     private List<ExceptionInfo> _stack;
 
     void setupRender()
@@ -52,31 +65,6 @@
         _stack = analysis.getExceptionInfos();
     }
 
-    public List<ExceptionInfo> getStack()
-    {
-        return _stack;
-    }
-
-    public ExceptionInfo getInfo()
-    {
-        return _info;
-    }
-
-    public void setInfo(ExceptionInfo info)
-    {
-        _info = info;
-    }
-
-    public String getPropertyName()
-    {
-        return _propertyName;
-    }
-
-    public void setPropertyName(String propertyName)
-    {
-        _propertyName = propertyName;
-    }
-
     public boolean getShowPropertyList()
     {
         // True if either is non-empty
@@ -87,5 +75,12 @@
     public Object getPropertyValue()
     {
         return _info.getProperty(_propertyName);
+    }
+
+    public String getFrameClass()
+    {
+        if (_frame.getClassName().startsWith(_appPackage) && _frame.getLineNumber() > 0) return "t-usercode-frame";
+
+        return null;
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ExceptionDisplay.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ExceptionDisplay.tml?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ExceptionDisplay.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/ExceptionDisplay.tml Sun Mar  2 14:15:06 2008
@@ -20,8 +20,8 @@
                             <dt>Stack trace</dt>
                             <dd>
                                 <ul class="t-stack-trace">
-                                    <t:loop source="info.stackTrace" value="var:frame">
-                                        <li>${var:frame}</li>
+                                    <t:loop source="info.stackTrace" value="frame">
+                                        <li class="${frameClass}">${frame}</li>
                                     </t:loop>
                                 </ul>
                             </dd>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css Sun Mar  2 14:15:06 2008
@@ -93,6 +93,11 @@
     list-style: square;
 }
 
+LI.t-usercode-frame {
+    font-weight: bold;
+    color: blue;
+}
+
 H1.t-exception-report {
     font-family: "Trebuchet MS", Arial, sans-serif;
     color: red;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/upgrade.apt Sun Mar  2 14:15:06 2008
@@ -62,4 +62,10 @@
   The data type for boolean values has changed from "checkbox" (reflecting how it is rendered in an edit form) to "boolean"
   (reflecting what it is). In addition, all numeric types are given the data type "number".
   This will only affect your application if you provided an overriding contribution
-  to the {{{../apidocs/org/apache/tapestry/services/BeanBlockSource.html}BeanBlockSource}} service.
\ No newline at end of file
+  to the {{{../apidocs/org/apache/tapestry/services/BeanBlockSource.html}BeanBlockSource}} service.
+
+* ExceptionInfo
+
+  The return type for <<<getStackTrace()>>> on
+  {{{../apidocs/org/apache/tapestry/services/ExceptionInfo.html}ExceptionInfo}}
+  changes from List\<String\> to List\<StackTraceElement\>.
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java Sun Mar  2 14:15:06 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -62,10 +62,9 @@
     }
 
     /**
-     * We want to filter out exceptions that do not provide any additional value. Additional value
-     * includes: an exception message not present in the containing exception or a property value
-     * not present in the containing exception. Also the first exception is always valued and the
-     * last exception (with the stack trace) is valued.
+     * We want to filter out exceptions that do not provide any additional value. Additional value includes: an
+     * exception message not present in the containing exception or a property value not present in the containing
+     * exception. Also the first exception is always valued and the last exception (with the stack trace) is valued.
      *
      * @param previousInfo
      * @param info
@@ -112,7 +111,7 @@
             properties.put(name, value);
         }
 
-        List<String> stackTrace = Collections.emptyList();
+        List<StackTraceElement> stackTrace = Collections.emptyList();
 
         // Usually, I'd use a terniary expression here, but Generics gets in
         // the way here.
@@ -122,9 +121,9 @@
         return new ExceptionInfoImpl(t, properties, stackTrace);
     }
 
-    private List<String> extractStackTrace(Throwable t)
+    private List<StackTraceElement> extractStackTrace(Throwable t)
     {
-        List<String> trace = newList();
+        List<StackTraceElement> trace = newList();
 
         for (StackTraceElement e : t.getStackTrace())
         {
@@ -133,7 +132,7 @@
 
             if (e.getClassName().startsWith("$") && e.getLineNumber() < 0) continue;
 
-            trace.add(e.toString());
+            trace.add(e);
         }
 
         return trace;

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java Sun Mar  2 14:15:06 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -29,9 +29,9 @@
 
     private final Map<String, Object> _properties;
 
-    private final List<String> _stackTrace;
+    private final List<StackTraceElement> _stackTrace;
 
-    public ExceptionInfoImpl(Throwable t, Map<String, Object> properties, List<String> stackTrace)
+    public ExceptionInfoImpl(Throwable t, Map<String, Object> properties, List<StackTraceElement> stackTrace)
     {
         _className = t.getClass().getName();
         _message = t.getMessage() != null ? t.getMessage() : "";
@@ -60,7 +60,7 @@
         return InternalUtils.sortedKeys(_properties);
     }
 
-    public List<String> getStackTrace()
+    public List<StackTraceElement> getStackTrace()
     {
         return _stackTrace;
     }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ExceptionInfo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ExceptionInfo.java?rev=632861&r1=632860&r2=632861&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ExceptionInfo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ExceptionInfo.java Sun Mar  2 14:15:06 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006, 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry.ioc.services;
 
 import java.util.List;
@@ -19,7 +19,7 @@
 /**
  * Contains information about an analyzed exception.
  *
- * @see {@link ExceptionAnalysis}
+ * @see {@link org.apache.tapestry.ioc.services.ExceptionAnalysis}
  */
 public interface ExceptionInfo
 {
@@ -47,5 +47,5 @@
      * Returns the stack trace elements. Generally this is an empty list except for the deepest
      * exception.
      */
-    List<String> getStackTrace();
+    List<StackTraceElement> getStackTrace();
 }