what makes google weather api throw exception when request

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

what makes google weather api throw exception when request

Postby lemondev » Mon Mar 02, 2009 8:48 am

sample code here:
URL url = new URL("http://www.google.com/ig/api?hl=zh-CN&weather=Beijing"); // or "Beijing,China",zip code like "94043" and so on
URLConnection uc = url.openConnection();
uc.connect();
InputStream is = uc.getInputStream();

above line , it throws a NullPointerException .

i tried other parameters in the URL's construction ,sometimes it returns an InputStream object without any data (finally transfered to an empty string ) .
lemondev
Freshman
Freshman
 
Posts: 7
Joined: Thu Feb 12, 2009 3:32 pm

Top

Postby MrSnowflake » Mon Mar 02, 2009 10:00 am

I guess your connect doesn't really connect, so the iostreams are null.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby lemondev » Mon Mar 02, 2009 10:26 am

MrSnowflake wrote:I guess your connect doesn't really connect, so the iostreams are null.


how to check it ? do you mean the connection to "google.com" is failed to established

i tried another site and succeeded to download a rss file .
lemondev
Freshman
Freshman
 
Posts: 7
Joined: Thu Feb 12, 2009 3:32 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 8 guests