You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Roberto Tyley <Ro...@reuters.com> on 2004/01/05 13:52:34 UTC
[PATCH] One-line patch to
org.apache.struts.config.ActionConfigMatcher.convertActionConfig() to
remove a simple IndexOutOfBoundsException
The following first line of code was causing an
IndexOutOfBoundsException in
org.apache.struts.config.ActionConfigMatcher.convertActionConfig(String
path, ActionConfig orig, Map vars) at line 185, when the variable 'path'
was the empty string:
---
if (path.charAt(0) != '/') {
path = "/" + path;
}
---
It *is* possible for the 'path' variable to be the empty string, and
indeed ActionConfigMatcher codes defensively for this case elsewhere-
just not here. This bug is present in all versions, including the most
recent, of the ActionConfigMatcher class, as found at:
http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/st
ruts/config/ActionConfigMatcher.java
The attached patch changes the line to:
---
if (path.length() == 0 || path.charAt(0) != '/') {
path = "/" + path;
}
---
cheers,
Roberto
--------------------------------------------------------------- -
Visit our Internet site at http://www.reuters.com
Get closer to the financial markets with Reuters Messaging - for more
information and to register, visit http://www.reuters.com/messaging
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Reuters Ltd.