More information after digging a bit. The change to RequestUtils (in version 1.61) has this log:

Revision : 1.61
Date : 2002/10/15 17:37:25
Author : 'ekbush'
State : 'Exp'
Lines : +33 -11
Description :
Change RequestUtils.selectApplication so that it looks for an exact
match
rather than using the startsWith criteria.This fixes a problem where
an incorrect module would be selected that either became aparant when
the application had modules where the name of one could be used as the
"root"
of the other.The bug also manifests itself when an action is invoked
from
the default module, which has a path that could be interpreted as a
"root" of
a non-default module.

Ex:modules /foo and /foobar
module /foo and action /foo in the default module

PR: 12702

And here is the relevant change:

while (prefix.equals("") &&
((lastSlash = matchPath.lastIndexOf("/")) != 0)) {

// We may be in a non-default module. Try to get it's
prefix.
matchPath = matchPath.substring(0, lastSlash);

// Match against the list of module prefixes
for (int i = 0; i < prefixes.length; i++) {
if (matchPath.equals(prefixes[i])) {
prefix = prefixes[i];
break;
}
}
}

lastIndexOf is obviously returning -1 meaning that there is no "/" in matchPath. My application works fine deployed, so this seems like an interaction with StrutsTestCase or Cactus with the servlet path being null.

If anyone has ideas on where to dig further to see where a fix is needed then I'd happily take it the extra distance and give it a shot to fix it.

Erik


Erik Hatcher wrote:
Oh, sorry for omitting this.... nightly build 20021028 is the one I tried and got the errors below....

Erik Hatcher wrote:

I decided to try out a Struts nightly build (from a previous 1.1beta2 version) and I ran our Cactus test suite to see if all validated ok... but I'm getting all Struts tests failing with this error:

String index out of range: -1

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1520)
at
org.apache.struts.util.RequestUtils.selectApplication(RequestUtils.java:
1462)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1290)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:502)
at
servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCa
se.java:384)

As you can see, I'm using StrutsTestCase on top of Cactus, and my test case looks like this:


public void testValidation() throws Exception {
setRequestPathInfo("/saveProfile");
ProfileForm form = new ProfileForm();
form.setMailForward("[EMAIL PROTECTED]");
addToParameters(form);
actionPerform();
verifyNoActionErrors();
}

This problem could certainly be in StrutsTestCase or in my custom 'addToParameters(form)' method? - but not likely there since thats a pretty trivial method to put all form properties in the request. The tests worked fine with Struts 1.1beta2, so the only thing that changed was our version of Struts.

Thoughts? I'll drop back to 1.1beta2 until something is resolved in either StrutsTestCase or Struts. Any clues on what changed that could have caused this?

Thanks,
Erik




--
To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>

Reply via email to