Vincent Massol wrote:
----------------------------------------------------
This email is autogenerated from the output from:
<http://cvs.apache.org/builds/gump/2002-12-18/jakarta-cactus-sample-servlet-13.html>
----------------------------------------------------
[snip]
     [java]     [junit] Testcase: testReceiveCookie took 0.048 sec
     [java]     [junit] 	Caused an ERROR
     [java]     [junit] Invalid port: -1
     [java]     [junit] java.lang.IllegalArgumentException: Invalid port: -1
     [java]     [junit] 	at org.apache.commons.httpclient.cookie.CookieSpecBase.parse(CookieSpecBase.java:167)
     [java]     [junit] 	at org.apache.commons.httpclient.cookie.CookieSpecBase.parse(CookieSpecBase.java:265)
     [java]     [junit] 	at org.apache.commons.httpclient.Cookie.parse(Cookie.java:703)
     [java]     [junit] 	at org.apache.commons.httpclient.Cookie.parse(Cookie.java:631)
     [java]     [junit] 	at org.apache.cactus.WebResponse.getCookies(WebResponse.java;org/apache/cactus/util/log/LogAspect.aj(1k):292)
     [java]     [junit] 	at org.apache.cactus.WebResponse.getCookie$ajcPostAround15(WebResponse.java;org/apache/cactus/util/log/LogAspect.aj(1k):223)
     [java]     [junit] 	at org.apache.cactus.WebResponse.getCookie(WebResponse.java;org/apache/cactus/util/log/LogAspect.aj(1k):1240)
     [java]     [junit] 	at org.apache.cactus.sample.TestSampleServlet.endReceiveCookie(Unknown Source)
     [java]     [junit] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     [junit] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     [junit] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     [junit] 	at org.apache.cactus.AbstractWebTestCase.callGenericEndMethod(AbstractWebTestCase.java:182)
     [java]     [junit] 	at org.apache.cactus.AbstractWebTestCase.callEndMethod(AbstractWebTestCase.java:235)
     [java]     [junit] 	at org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase.java:263)
     [java]     [junit] 	at org.apache.cactus.AbstractWebTestCase.runTest(AbstractWebTestCase.java:325)
     [java]     [junit] 	at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:255)

     [java]     [junit] Testcase: testReceiveCookie
The problem here is that HttpClient seems to have become more strict when parsing Cookies. Cactus is specifying a port of "-1", which is obviously illegal, and HttpClient is (IMHO) correctly complaining about that.

A possible fix would be the following: in o.a.c.ServletURL#getPort(), we'll default to -1 when no port is specified (line 356). Instead, we should probably default to the default HTTP port 80 (or 443 if the protocol is HTTPS). *If* the port is specified but invalid (i.e. a NumberFormatException is thrown), we'd still return -1.

I've tried the change on my local workspace, and the tests all run successfully. I also think that the behavior described above would be more correct than the current behavior.

What do you think? Any objections?

--
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to