Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
1 result

Target

Select target project
  • jkenney6/openweather-rest-and-file-connector
  • gswartz2/openweather-rest-and-file-connector
  • egueret2/openweather-rest-and-file-connector
  • zalexander2/openweather-rest-and-file-connector
  • rlanning2/openweather-rest-and-file-connector
  • soft-core/soft-160/openweather-rest-and-file-connector
6 results
Select Git revision
  • egueret2-main-patch-78742
  • main
2 results
Show changes
Commits on Source (2)
......@@ -55,7 +55,7 @@
- [*"weather"*](https://openweathermap.org/current), the current weather
data set
- [*"onecall"*](https://openweathermap.org/api/one-call-api), the "One
Call API" data set
Call v2.5 API" data set (note: does *not* use the v3.0 API)
- [*forecast*](https://openweathermap.org/forecast5), the 5-day/3-hour
forecast data set
- [*air_pollution*](https://openweathermap.org/api/air-pollution), the air
......
......@@ -12,6 +12,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
/**
......@@ -372,10 +373,10 @@ public class OpenWeatherConnector {
*
* @param listName the key to access the list
* @param timestamp the timestamp of the list entry
* @return the object of interest, or null if the list or the timestamp are not
* present
* @return the object of interest, or null if the list is not present
* @throws NoSuchElementException if the timestamp is not present in the list
*/
private JSONObject getListEntry(String listName, Date timestamp) {
private JSONObject getListEntry(String listName, Date timestamp) throws NoSuchElementException {
JSONObject listEntry = null;
if (data.containsKey(listName)) {
JSONArray list = (JSONArray) data.get(listName);
......@@ -384,6 +385,9 @@ public class OpenWeatherConnector {
listEntry = (JSONObject) entry;
}
}
if (listEntry == null) {
throw new NoSuchElementException("The requested data is not available for " + timestamp + ".");
}
}
return listEntry;
}
......