Re: NPE in WOHTTPConnection readResponse()
Re: NPE in WOHTTPConnection readResponse()
- Subject: Re: NPE in WOHTTPConnection readResponse()
- From: Thomas <email@hidden>
- Date: Wed, 23 Jan 2008 09:41:03 +1100
With an Eclipse project that doesn't use wonder, running in Eclipse, I
don't get this error.
So something fishy is going on with Wonder. I'm using the build from
two nights ago. But I'm using the "stable" 3.3.1.1 version of Eclipse
with a very old version of WOLips 3.3.4606.
Regards
Thomas
On 23/01/2008, at 9:11 AM, Mr. Pierre Frisch wrote:
Could you try without Wonder please. Wonder has its own
implementation of NSArray and I am not sure what is going on.
Thanks
Pierre
--
Pierre Frisch
email@hidden
On Jan 22, 2008, at 13:10, Thomas wrote:
No, it does not work on Mac OS X for me. Both the following
environments give the NPE in WOHTTPConnection.readResponse().
Server 10.5.1 Java 1.5 WO 5.4 Wonder build from 2 days ago,
deployed using JavaMonitor
Client 10.5.1 Java 1.5 WO 5.4 Wonder build from 2 days ago,
deployed in development mode through Eclipse using wo/-xxx/whatever
It is probably to do with headers, but it seems to do it for any
web page, even www.apple.com. See sample code below.
Regards
Thomas
// both connectHost and connectPath are set to valid values.
WOHTTPConnection ppEchoConnection = new
WOHTTPConnection(connectHost, 80);
NSMutableDictionary headers = new NSMutableDictionary();
headers.setObjectForKey("en", "Accept-Language");
headers.setObjectForKey("iso-8859-1,*,utf-8", "Accept-Charset");
headers.setObjectForKey("image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, image/png, */*", "Accept");
headers.setObjectForKey("WebObjects/5.4 [en] (i386; Mac OS X
10.5.1)","User-Agent");
WORequest request = new WORequest("GET", connectPath, "HTTP/1.1",
headers, null, null);
request.setContent(connectPath);
ppEchoConnection.setReceiveTimeout(90 * 1000);
boolean success = ppEchoConnection.sendRequest(request);
// everything is working fine to this point. The web server log
shows the correct URL is requested and content returned.
if (success) {
stringA = ppEchoConnection.readResponse().contentString(); // NPE
below happens here
}
java.lang.NullPointerException
at com.webobjects.foundation.NSArray.toArray(NSArray.java:965)
at java.util.ArrayList.<init>(ArrayList.java:136)
at com.webobjects.appserver.WOMessage.appendHeaders(WOMessage.java:
645)
at
com
.webobjects
.appserver
.WOHTTPConnection.setResponseHeaders(WOHTTPConnection.java:124)
at
com
.webobjects
.appserver.WOHTTPConnection.readResponse(WOHTTPConnection.java:581)
at biz.webjini.Test.fetchURL(Test.java:106)
On 23/01/2008, at 6:20 AM, Mr. Pierre Frisch wrote:
I am a bit confused. Which platform is broken? Does it work on
MacOSX?
Pierre
--
Pierre Frisch
email@hidden
On Jan 22, 2008, at 10:25, Thomas wrote:
I didn't solve the problem, but I managed to get PayPal working
by using my own code with a plain Java URLConnection instead of
WOHTTPConnection.
I still don't know why WOHTTPConnection doesn't work. I've
carefully studied the docs, and I believe it is a bug in
WebObject 5.4. Moving our production server to Java 1.6 is not an
option...
Note that the NPE in setHeaders below is not the same place where
I get a NPE. Something is seriously broken.
Thanks anyway.
Regards
Thomas
On 23/01/2008, at 4:42 AM, Alexander Spohr wrote:
We tried some different java-versions now:
Does NOT work:
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-
b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode,
sharing)
Does NOT work:
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-
b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode,
sharing)
Does work:
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode,
sharing)
Strange...
atze
Am 22.01.2008 um 18:27 schrieb Alexander Spohr:
Similar problem here. That code runs on two machines but not on
a third. We have WO in the apps bundle.
Runs on machine one using Java 1.5/MacOSX, machine two 1.6/
Linux, not on machine three with 1.5/Linux.
2008-01-22 17:50:20,244 WARN [WorkerThread0] NSLog:
<WOWorkerThread id=0
socket=Socket[addr127.0.0.1,port=53181,localport=2201]>
Exception occurred while responding to client:
java.lang.NullPointerException
[2008-1-22 16:50:20 CET] <WorkerThread0>
java.lang.NullPointerException
at com.webobjects.foundation.NSArray.toArray(NSArray.java:976)
at java.util.ArrayList.<init>(ArrayList.java:136)
at com.webobjects.appserver.WOMessage.setHeaders(WOMessage.java:
363)
at
com
.webobjects.appserver.WOMessage._finalizeCookies(WOMessage.java:
566)
at
com
.webobjects
.appserver.WOResponse._finalizeInContext(WOResponse.java:212)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
._handleRequest(WOComponentRequestHandler.java:411)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
.handleRequest(WOComponentRequestHandler.java:442)
at
com
.webobjects
.appserver.WOApplication.dispatchRequest(WOApplication.java:167
at
com
.webobjects
.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:
144)
at
com
.webobjects
.appserver._private.WOWorkerThread.run(WOWorkerThread.java:226)
at java.lang.Thread.run(Thread.java:595)
Am 22.01.2008 um 05:24 schrieb Thomas:
I'm trying to get WOPayPal working in WO 5.4, and I've
narrowed down to a problem in readResponse(). Below is some
sample code I am using to fetch a page from my own web server,
and it fails on that as well.
I anybody using WOHTTPConnection.readResponse() ? What am I
doing wrong?
I'm running on 10.5.1 client (same happens on server) with WO
5.4 and a 5.4-specific version of WOnder from late December.
It does the same with last night's build of the 5.4 WOnder.
Regards
Thomas
// both connectHost and connectPath are set to valid values.
WOHTTPConnection ppEchoConnection = new
WOHTTPConnection(connectHost, 80);
NSMutableDictionary headers = new NSMutableDictionary();
headers.setObjectForKey("en", "Accept-Language");
headers.setObjectForKey("iso-8859-1,*,utf-8", "Accept-Charset");
headers.setObjectForKey("image/gif, image/x-xbitmap, image/
jpeg, image/pjpeg, image/png, */*", "Accept");
headers.setObjectForKey("WebObjects/5.4 [en] (i386; Mac OS X
10.5.1)","User-Agent");
WORequest request = new WORequest("GET", connectPath, "HTTP/
1.1", headers, null, null);
request.setContent(connectPath);
ppEchoConnection.setReceiveTimeout(90 * 1000);
boolean success = ppEchoConnection.sendRequest(request);
// everything is working fine to this point. The web server
log shows the correct URL is requested and content returned.
if (success) {
stringA = ppEchoConnection.readResponse().contentString(); //
NPE below happens here
}
java.lang.NullPointerException
at com.webobjects.foundation.NSArray.toArray(NSArray.java:965)
at java.util.ArrayList.<init>(ArrayList.java:136)
at
com
.webobjects.appserver.WOMessage.appendHeaders(WOMessage.java:
645)
at
com
.webobjects
.appserver
.WOHTTPConnection.setResponseHeaders(WOHTTPConnection.java:124)
at
com
.webobjects
.appserver.WOHTTPConnection.readResponse(WOHTTPConnection.java:
581)
at biz.webjini.Test.fetchURL(Test.java:106)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects-
email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Freeport & Soliversum
Alexander Spohr
email@hidden
www.freeport.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Freeport & Soliversum
Alexander Spohr
email@hidden
www.freeport.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden