Re: NPE in WOHTTPConnection readResponse()
Re: NPE in WOHTTPConnection readResponse()
- Subject: Re: NPE in WOHTTPConnection readResponse()
- From: "Daniele Corti" <email@hidden>
- Date: Tue, 22 Jan 2008 12:56:17 +0100
2008/1/22, Thomas <email@hidden>:
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)
--
Daniele Corti
AIM: S0CR4TE5
Messenger:
email@hidden--
Computers are like air conditioners -- they stop working properly if you open
WINDOWS
--
What about the four lusers of the apocalypse? I nominate:
"advertising", "can't log in", "power switch" and "what backup?"
--Alistair Young
_______________________________________________
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