Author: husted Date: Mon Mar 12 20:24:41 2007 New Revision: 517510 URL: http://svn.apache.org/viewvc?view=rev&rev=517510 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/branches/STRUTS_2_0_X/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java Modified: struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java?view=diff&rev=517510&r1=517509&r2=517510 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java Mon Mar 12 20:24:41 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("//", "/");