struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hus...@apache.org
Subject svn commit: r517511 - /struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java
Date Tue, 13 Mar 2007 03:28:08 GMT
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



Mime
View raw message