Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenWeather REST and file connector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SOFT Core
SOFT 160
OpenWeather REST and file connector
Compare revisions
main to main
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
soft-core/soft-160/openweather-rest-and-file-connector
Select target project
No results found
main
Select Git revision
Branches
main
1 result
Swap
Target
egueret2/openweather-rest-and-file-connector
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
main
Select Git revision
Branches
egueret2-main-patch-78742
main
2 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Added clarifying note about which OneCall API is used
· a1690583
Christopher Bohn
authored
2 years ago
a1690583
NPE no longer thrown when requesting data for a timestamp not in the list
· 54daeaac
Christopher Bohn
authored
1 year ago
NoSuchElementException is thrown instead. Closes
#1
54daeaac
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
src/main/java/edu/unl/cse/soft160/json_connections/connector/OpenWeatherConnector.java
+7
-3
7 additions, 3 deletions
...t160/json_connections/connector/OpenWeatherConnector.java
with
9 additions
and
5 deletions
README.md
View file @
54daeaac
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
src/main/java/edu/unl/cse/soft160/json_connections/connector/OpenWeatherConnector.java
View file @
54daeaac
...
...
@@ -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 no
t
*
presen
t
* @return the object of interest, or null if the list
is not presen
t
*
@throws NoSuchElementException if the timestamp is not present in the lis
t
*/
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
;
}
...
...
This diff is collapsed.
Click to expand it.