code cleanup

This commit is contained in:
Jannik 2018-02-24 17:13:52 +01:00
parent c99a97fa49
commit 71937540b0
1 changed files with 139 additions and 142 deletions

View File

@ -287,7 +287,6 @@ public class MainWindowController {
}
}else if (mode.equals("local")) {
if(System.getProperty("os.name").contains("Linux")){
LOGGER.info("This is "+System.getProperty("os.name"));
String line;
String output = "";
Process p;
@ -297,7 +296,7 @@ public class MainWindowController {
while ((line = input.readLine()) != null) {
output = line;
}
System.out.println(output);
LOGGER.info(output);
input.close();
} catch (IOException e1) {
e1.printStackTrace();
@ -316,15 +315,13 @@ public class MainWindowController {
}
}
}else if(System.getProperty("os.name").contains("Windows") || System.getProperty("os.name").contains("Mac OS X")){
System.out.println("This is "+System.getProperty("os.name"));
try {
Desktop.getDesktop().open(new File(getPath()+"\\"+ datPath));
} catch (IOException e) {
showErrorMsg(errorPlay,e);
}
} else {
System.out.println("It seems like your operating system is not supported, please contact a developer!");
System.out.println("Error code is: nsos; OS is: " + System.getProperty("os.name"));
LOGGER.error(System.getProperty("os.name") + ", OS is not supported, please contact a developer! ");
}
} else {
IOException e = new IOException("error");
@ -432,7 +429,7 @@ public class MainWindowController {
private void directoryBtnAction(){
selectedFolder = directoryChooser.showDialog(null);
if(selectedFolder == null){
System.out.println("No Directory selected");
LOGGER.warn("No Directory selected");
}else{
setPath(selectedFolder.getAbsolutePath());
saveSettings();
@ -556,7 +553,7 @@ public class MainWindowController {
ApiQuery.startQuery(name,datPath); // start api query
}
}else{
System.out.println(streamingFilms.size());
LOGGER.info(streamingFilms.size());
if(streamingFilms.get(selected).getCached()==true){
LOGGER.info("loading from cache: "+name);
dbController.readCache(datPath);
@ -822,7 +819,7 @@ public class MainWindowController {
void loadStreamingSettings() {
if (getStreamingPath().equals("") || getStreamingPath().equals(null)) {
System.out.println("Kein Pfad angegeben"); //if path equals "" or null
LOGGER.warn("Kein Pfad angegeben");
} else {
String[] entries = new File(getStreamingPath()).list();
for (int i = 0; i < entries.length; i++) {
@ -837,11 +834,14 @@ public class MainWindowController {
}
}
}
// removes the ending
private String ohneEndung(String str) {
if (str == null) return null;
if (str == null)
return null;
int pos = str.lastIndexOf(".");
if (pos == -1) return str;
if (pos == -1)
return str;
return str.substring(0, pos);
}
@ -1028,9 +1028,7 @@ public class MainWindowController {
// Set expandable Exception into the dialog pane.
alert.getDialogPane().setExpandableContent(expContent);
alert.showAndWait();
exception.printStackTrace();
LOGGER.error("An error occurred", exception);
}
// saves the Settings
@ -1139,7 +1137,6 @@ public class MainWindowController {
LOGGER.error("cloud not load mode", e);
}
inputStream.close();
} catch (IOException e) {
if (firststart == false) {