Author: mrdon Date: Wed Apr 12 12:09:01 2006 New Revision: 393581 URL: http://svn.apache.org/viewcvs?rev=393581&view=rev Log: Fixing problem report to show root exception location information and snippet
Modified: incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/DispatcherUtils.java incubator/webwork2/action/src/main/resources/org/apache/struts/action2/dispatcher/error.ftl Modified: incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/DispatcherUtils.java URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/DispatcherUtils.java?rev=393581&r1=393580&r2=393581&view=diff ============================================================================== --- incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/DispatcherUtils.java (original) +++ incubator/webwork2/action/src/main/java/org/apache/struts/action2/dispatcher/DispatcherUtils.java Wed Apr 12 12:09:01 2006 @@ -34,6 +34,7 @@ import com.opensymphony.xwork.interceptor.component.ComponentInterceptor; import com.opensymphony.xwork.interceptor.component.ComponentManager; import com.opensymphony.xwork.util.*; +import com.opensymphony.xwork.util.location.Location; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -482,6 +483,7 @@ HashMap data = new HashMap(); data.put("exception", e); + data.put("unknown", Location.UNKNOWN); data.put("chain", chain); template.process(data, response.getWriter()); response.getWriter().close(); Modified: incubator/webwork2/action/src/main/resources/org/apache/struts/action2/dispatcher/error.ftl URL: http://svn.apache.org/viewcvs/incubator/webwork2/action/src/main/resources/org/apache/struts/action2/dispatcher/error.ftl?rev=393581&r1=393580&r2=393581&view=diff ============================================================================== --- incubator/webwork2/action/src/main/resources/org/apache/struts/action2/dispatcher/error.ftl (original) +++ incubator/webwork2/action/src/main/resources/org/apache/struts/action2/dispatcher/error.ftl Wed Apr 12 12:09:01 2006 @@ -14,6 +14,13 @@ <#assign msgs = [ex.message] + msgs/> </#if> </#list> +<#list chain as ex> + <#if (ex.location?exists && (ex.location != unknown))> + <#assign rootloc = ex.location/> + <#assign rootex = ex/> + </#if> +</#list> + <div id="exception-info"> <table> <tr> @@ -30,33 +37,33 @@ </#if> </td> </tr> - <#if exception.location?exists> + <#if rootloc?exists> <tr> <td><strong>File</strong>:</td> - <td>${exception.location.URI}</td> + <td>${rootloc.URI}</td> </tr> <tr> <td><strong>Line number</strong>:</td> - <td>${exception.location.lineNumber}</td> + <td>${rootloc.lineNumber}</td> </tr> <tr> <td><strong>Column number</strong>:</td> - <td>${exception.location.columnNumber}</td> + <td>${rootloc.columnNumber}</td> </tr> </#if> </table> </div> -<#if exception.snippet?exists> - <#assign snippet = exception.getSnippet(2) /> +<#if rootex.snippet?exists> + <#assign snippet = rootex.getSnippet(2) /> <#if (snippet?size > 0)> <div id="snippet"> <hr /> <#list snippet as line> <#if (line_index == 2)> - <pre style="background:yellow">${(line[0..(exception.location.columnNumber-3)]?html)}<span style="background:red">${(line[(exception.location.columnNumber-2)]?html)}</span><#if ((exception.location.columnNumber)>line.length())>${(line[(exception.location.columnNumber-1)..]?html)}</#if></pre> + <pre style="background:yellow">${(line[0..(rootloc.columnNumber-3)]?html)}<span style="background:red">${(line[(rootloc.columnNumber-2)]?html)}</span><#if ((rootloc.columnNumber)>line.length())>${(line[(rootloc.columnNumber-1)..]?html)}</#if></pre> <#else> <pre>${line?html}</pre> </#if> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]