Omertron / api-omdb

API for the Open Movie Database
GNU General Public License v3.0
27 stars 20 forks source link

Mapping error when metascore is "N/A" #3

Closed vincaslt closed 9 years ago

vincaslt commented 9 years ago

Some tv shows have metascore returned as "N/A". For example "Mr. Robot" would return metascore as "N/A", yet in model the value is mapped as integer, so it throws a mapping error. Similar to this:

com.omertron.omdbapi.OMDBException: ExceptionType=MAPPING_FAILED, ResponseCode=0, URL=http://www.omdbapi.com/?i=tt4158110
    at com.omertron.omdbapi.OmdbApi.getInfo(OmdbApi.java:180)
    at tvseriestracker.TvSeriesTrackerApplication.main(TvSeriesTrackerApplication.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct instance of java.lang.Integer from String value 'N/A': not a valid Integer value
 at [Source: {"Title":"Mr. Robot","Year":"2015–","Rated":"N/A","Released":"27 May 2015","Runtime":"60 min","Genre":"Crime, Drama","Director":"N/A","Writer":"Sam Esmail","Actors":"Rami Malek, Carly Chaikin, Portia Doubleday, Martin Wallström","Plot":"Follows a mysterious anarchist who recruits a young computer programmer (Malek) who suffers from social anxiety disorder and forms connections through hacking them.","Language":"English","Country":"USA","Awards":"1 win.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTE0Mjc1MTk2MjFeQTJeQWpwZ15BbWU4MDk2NzI4MDYx._V1_SX300.jpg","Metascore":"N/A","imdbRating":"9.4","imdbVotes":"21,489","imdbID":"tt4158110","Type":"series","Response":"True"}; line: 1, column: 566] (through reference chain: com.omertron.omdbapi.model.OmdbVideoFull["Metascore"])
    at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:55)
syfantid commented 8 years ago

I used the project's dependency from Maven for release 1.0 and I still get this exception... I tried release 1.1, but I can't download any files from Maven.

Omertron commented 8 years ago

I have released v1.1

It should be available soon to fix the issue

syfantid commented 8 years ago

Thanks a lot, but I'm still seeing v1.1 as snapshot version in Maven... Any ideas why? screenshot_1 screenshot_2

Omertron commented 8 years ago

apologies, I forgot to release it into the Maven Nexus, should be there soon

syfantid commented 8 years ago

Thanks for the great work! :) Works like a charm!