URL feedUrl = new URL(YAHOO_WEATHER_SERVICE_URL
+ "?"
+ ServiceParametersUtility.toParametersString(parameters));
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new InputStreamReader(feedUrl.openStream()));
YahooWeatherServiceStatus weatherServiceStatus = new YahooWeatherServiceStatus();
if (feed.getEntries() != null && feed.getEntries().size() > 0) {
SyndEntry entry = ((SyndEntry) feed.getEntries().get(0));
String title = entry.getTitle();
String description = entry.getDescription().getValue();
if (description.indexOf(RESPONSE_INVALID_KEYWORD) >= 0) {
throw new InvalidLocationException(RESPONSE_INVALID_LOCATION);
}
weatherServiceStatus.setTitle(title);
weatherServiceStatus.setDescription(description);
}
return weatherServiceStatus;
}