You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2007/03/13 04:28:08 UTC

svn commit: r517511 - /struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java

Author: husted
Date: Mon Mar 12 20:28:08 2007
New Revision: 517511

URL: http://svn.apache.org/viewvc?view=rev&rev=517511
Log:
WW-18O4 "Showcase - view source throws NumberFormatException". The problem is that config parameter on the URL is empty (config=). It can be fixed by checing if the parameters are not empty instead of just != null in the ViewSourceAction.java. Submitted by Claus Ibsen.

Modified:
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java

Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java?view=diff&rev=517511&r1=517510&r2=517511
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java Mon Mar 12 20:28:08 2007
@@ -57,7 +57,7 @@
 
     public String execute() throws MalformedURLException, IOException {
 
-        if (page != null) {
+        if (page != null && page.trim().length() > 0) {
 
             InputStream in = ClassLoaderUtil.getResourceAsStream(page.substring(page.indexOf("//")+1), getClass());
             page = page.replace("//", "/");
@@ -72,7 +72,7 @@
             pageLines = read(in, -1);
         }
 
-        if (className != null) {
+        if (className != null && className.trim().length() > 0) {
             className = "/"+className.replace('.', '/') + ".java";
             InputStream in = getClass().getResourceAsStream(className);
             if (in == null) {
@@ -81,7 +81,7 @@
             classLines = read(in, -1);
         }
 
-        if (config != null) {
+        if (config != null && config.trim().length() > 0) {
             int pos = config.lastIndexOf(':');
             configLine = Integer.parseInt(config.substring(pos+1));
             config = config.substring(0, pos).replace("//", "/");
@@ -89,6 +89,7 @@
         }
         return SUCCESS;
     }
+
 
     /**
      * @param className the className to set