From 8910d90721abd69deedc3a598fa64a704cfec216 Mon Sep 17 00:00:00 2001 From: Ted Nathan Husted Date: Tue, 13 Mar 2007 03:24:41 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/branches/STRUTS_2_0_X@517510 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/struts2/showcase/source/ViewSourceAction.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java index ea546c9c6..6bd91e2f6 100644 --- a/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java +++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/source/ViewSourceAction.java @@ -57,7 +57,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa 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 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa 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 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa 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("//", "/");