bigdragon1977 / geocoder-java

Automatically exported from code.google.com/p/geocoder-java
0 stars 1 forks source link

Exception thrown by Code when only zipcode is set in request instead of address or location #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to get latitude and longitude with only zip codes. I encountered 
following issue and created a temporary fix for it.

What steps will reproduce the problem?
1. In geocoder request don't pass address or location
2. Set Postal code component and language only
2.1 Java code throws exception with this code
GeocoderRequest geocoderRequest = new 
GeocoderRequestBuilder().addComponent(GeocoderComponent.POSTAL_CODE, 
'31421').setLanguage("en").getGeocoderRequest();

Exception is: "Address or location must be defined"

2.2 Whereas google api allows it
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:31421

What is the expected output? What do you see instead?
APi request should be parsed as valid request and google api should be called. 
I got exception "Address or location must be defined"

What version of the product are you using? On what operating system?
0.16

Please provide any additional information below.
I have override the Geocoder.getURLQuery method, not to throw exception when 
address or location both are not present. It should ideally check if not even 
one address component is there then exception should occur

Original issue reported on code.google.com by sandeep....@gmail.com on 6 Jul 2014 at 12:25

GoogleCodeExporter commented 8 years ago
I'fe added a patch for this at 
https://github.com/micw/geocoder-java/commit/652a8eef0281fd0a571f460f023275ae227
c6c04

Original comment by michael.wyraz on 5 Mar 2015 at 12:28