release 0.7.0

* version 0.6.100 -> 0.7.0
* fixed a nullpointer if there is a false response from omdbapi
This commit is contained in:
Jannik 2018-04-27 15:06:40 +02:00
parent 9a4eae0be9
commit 535efd98ee
3 changed files with 16 additions and 14 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.kellerkinder</groupId> <groupId>org.kellerkinder</groupId>
<artifactId>Project-HomeFlix</artifactId> <artifactId>Project-HomeFlix</artifactId>
<version>0.6.99</version> <version>0.7.0</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Project-HomeFlix</name> <name>Project-HomeFlix</name>

View File

@ -209,9 +209,9 @@ public class MainWindowController {
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName()); private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
private int hashA = -647380320; private int hashA = -647380320;
private final String version = "0.6.100"; private final String version = "0.7.0";
private final String buildNumber = "151"; private final String buildNumber = "151";
private final String versionName = "toothless dragon RC"; private final String versionName = "toothless dragon";
private String dialogBtnStyle; private String dialogBtnStyle;
private String color; private String color;
private String local; private String local;

View File

@ -75,12 +75,11 @@ public class OMDbAPIController implements Runnable {
BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream())); BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream()));
output = ina.readLine(); output = ina.readLine();
ina.close(); ina.close();
LOGGER.info("response from " + URL + " was valid"); System.out.println(apiUrl);
LOGGER.info("Title was: " + mainWindowController.getCurrentTitle()); LOGGER.info("response from '" + URL + "&t=" + mainWindowController.getCurrentTitle() + "' was:" + output);
LOGGER.info(output);
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("error while making api request or reading response"); LOGGER.error("error while making api request or reading response");
LOGGER.error("response from " + URL + " was: \n" + output, e); LOGGER.error("response from '" + URL + "&t=" + mainWindowController.getCurrentTitle() + "' was:" + output, e);
return; return;
} }
@ -89,20 +88,21 @@ public class OMDbAPIController implements Runnable {
if (object.getString("Error", "").equals("Movie not found!")) { if (object.getString("Error", "").equals("Movie not found!")) {
// if the movie was not found try to search it // if the movie was not found try to search it
LOGGER.warn("Movie was not found at first try, searching again!"); LOGGER.warn("Movie was not found at first try, searching again!");
// TODO split the name intelligent as it may contain the film title /** TODO
// query the api * split the name intelligent as it may contain the film title
* search for English name
* use tmdb
*/
try { try {
URL apiUrl = new URL(URL + mainWindowController.getOmdbAPIKey() + "&s=" URL apiUrl = new URL(URL + mainWindowController.getOmdbAPIKey() + "&s="
+ mainWindowController.getCurrentTitle().replace(" ", "%20")); + mainWindowController.getCurrentTitle().replace(" ", "%20"));
BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream())); BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream()));
output = ina.readLine(); output = ina.readLine();
ina.close(); ina.close();
LOGGER.info("response from search " + URL + " was valid"); LOGGER.info("response from '" + URL + "&s=" + mainWindowController.getCurrentTitle() + "' was:" + output);
LOGGER.info("Title was: " + mainWindowController.getCurrentTitle());
LOGGER.info(output);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("error while making api request or reading response"); LOGGER.error("error while making api request or reading response");
LOGGER.error("response from search" + URL + " was: \n" + output, e); LOGGER.error("response from '" + URL + "&s=" + mainWindowController.getCurrentTitle() + "' was:" + output, e);
return; return;
} }
@ -110,13 +110,15 @@ public class OMDbAPIController implements Runnable {
if (searchObject.getString("Response", "").equals("True")) { if (searchObject.getString("Response", "").equals("True")) {
for (JsonValue movie : searchObject.get("Search").asArray()) { for (JsonValue movie : searchObject.get("Search").asArray()) {
// get first entry from the array and set object = movie // get first entry from the array and set object = movie
// TODO probably we have a NullPointerException here!
object = (JsonObject) movie; object = (JsonObject) movie;
System.out.println(movie.toString()); System.out.println(movie.toString());
break; break;
} }
System.out.println(object.getString("Title", "")); System.out.println(object.getString("Title", ""));
} else {
LOGGER.warn("Movie not found! Not adding cache!");
return;
} }
} }