ioos / sos-injector-db

Inject stations/observations from an arbitrary database into an IOOS 52 North SOS
The Unlicense
3 stars 5 forks source link

Nonsensical error in -Dmock run, DatabaseStationRetriever.getStations "station_lat must not be null" #6

Closed emiliom closed 10 years ago

emiliom commented 10 years ago

Shane: I'm running into a puzzling error when running sos-injector-db with -Dmock. It's failing on getStations, with this error: "station_lat must not be null" (see below). But I've already checked the output of my get_stations.sql (using the mysql shell command), and there are no cases of station_lat being null! So I don't know what else to diagnose.

Thanks for your help.

~/52nsos$ java -Dmock -jar sos-injector-db.jar config.properties

2014-03-20 12:12:42,590  INFO [main] - Mock SosInjector initialized
2014-03-20 12:12:42,591  INFO [main] - Updating mock-database-sos-injector
2014-03-20 12:12:43,286 ERROR [main] - Sos injection failed
com.axiomalaska.sos.exception.StationCreationException: Error creating station
    at com.axiomalaska.sos.injector.db.DatabaseStationRetriever.getStations(DatabaseStationRetriever.java:233)
    at com.axiomalaska.sos.SosInjector.update(SosInjector.java:189)
    at com.axiomalaska.sos.injector.db.DatabaseSosInjector.main(DatabaseSosInjector.java:40)
Caused by: java.lang.IllegalStateException: station_lat must not be null!
    at com.axiomalaska.sos.injector.db.DatabaseSosInjectorHelper.requireNonNull(DatabaseSosInjectorHelper.java:25)
    at com.axiomalaska.sos.injector.db.DatabaseStationRetriever.getStations(DatabaseStationRetriever.java:116)
    ... 2 more
daf commented 10 years ago

I had the same issue in my initial playing with sos-injector-db - I was in the middle of setting up a debugging env for it before I got sidetracked and haven't revisited.

emiliom commented 10 years ago

Cool! Misery loves company.

srstsavage commented 10 years ago

I should have a trial solution in a few On Mar 20, 2014 1:17 PM, "Dave Foster" notifications@github.com wrote:

I had the same issue in my initial playing with sos-injector-db - I was in the middle of setting up a debugging env for it before I got sidetracked and haven't revisited.

— Reply to this email directly or view it on GitHubhttps://github.com/ioos/sos-injector-db/issues/6#issuecomment-38215851 .

srstsavage commented 10 years ago

@emiliom Can you try v1.0-RC5?

https://github.com/ioos/sos-injector-db/releases/tag/v1.0-RC5

I'm guessing that the values for station_lng and station_lat returned from the queries weren't doubles, which sos-injector-db was expecting (maybe floats instead?). I added some logic to try to convert to double from any numeric result. Hopefully that solves the issue.

emiliom commented 10 years ago

Thanks, Shane! That fixed the problem. I double checked, and yes, my station_lng and station_lat were in fact floats. Yikes, is that Java being overly finicky?! Regardless, problem solved. It looks like the queries are making it to the last set, get_observations.sql, where the process fails b/c I have some things to fix there. I'll report back once I get past them, hopefully tomorrow.

srstsavage commented 10 years ago

Good to hear, thanks for checking. Java can't be blamed, it was my undersight ;)

On Thu, Mar 20, 2014 at 2:13 PM, Emilio Mayorga notifications@github.comwrote:

Thanks, Shane! That fixed the problem. I double checked, and yes, my station_lng and station_lat were in fact floats. Yikes, is that Java being overly finicky?! Regardless, problem solved. It looks like the queries are making it to the last set, get_observations.sql, where the process fails b/c I have some things to fix there. I'll report back once I get past them, hopefully tomorrow.

— Reply to this email directly or view it on GitHubhttps://github.com/ioos/sos-injector-db/issues/6#issuecomment-38221825 .

Shane StClair Software Engineer Axiom Consulting & Design http://www.axiomalaska.com