NPE in WOHTTPConnection readResponse()
NPE in WOHTTPConnection readResponse()
- Subject: NPE in WOHTTPConnection readResponse()
- From: Thomas <email@hidden>
- Date: Tue, 22 Jan 2008 15:24:00 +1100
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden