Browse Source

release 0.7.0

* version 0.6.100 -> 0.7.0
* fixed a nullpointer if there is a false response from omdbapi
pull/24/head
Jannik 4 years ago
parent
commit
535efd98ee
  1. 2
      pom.xml
  2. 4
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  3. 24
      src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java

2
pom.xml

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

4
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -209,9 +209,9 @@ public class MainWindowController {
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
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 versionName = "toothless dragon RC";
private final String versionName = "toothless dragon";
private String dialogBtnStyle;
private String color;
private String local;

24
src/main/java/kellerkinder/HomeFlix/controller/OMDbAPIController.java

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

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close