@Test public void testGoogleLookupFailure() { if (shouldRun()) { Geocoder geocoder = new GoogleMapsGeocoder(); try { geocoder.geocode("asdasdasdasdasdasdasdasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf"); assertTrue("this should throw an exception", false); } catch (GeocoderException e) { assertEquals("geo.google.GeoException: Error Status Code: G_GEO_UNKNOWN_ADDRESS", e.getMessage()); } } }
public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); GWTLatLng geocode(String geolocation); }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); GWTLatLng geocode(String geolocation);  }