From 724c78c24f35f5b6303f0fb65fa44a6fe471d58c Mon Sep 17 00:00:00 2001
From: Tobias Miosczka <6351397+TobiasMiosczka@users.noreply.github.com>
Date: Thu, 17 May 2018 00:24:43 +0200
Subject: [PATCH] Version 0.5.0
---
pom.xml | 2 +-
.../cinema/KDMManager/gui/Window.java | 16 ++++++++++++++--
.../KDMManager/helper/ConfigParseException.java | 7 +++++--
.../cinema/KDMManager/helper/XmlHelper.java | 8 ++++----
4 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0ecec82..771add3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.tobiasmiosczka.cinema
KDMManager
- 0.0.1-SNAPSHOT
+ 0.5.0
diff --git a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/gui/Window.java b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/gui/Window.java
index 6f5f7f6..2d6787f 100644
--- a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/gui/Window.java
+++ b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/gui/Window.java
@@ -4,11 +4,23 @@
import com.github.tobiasmiosczka.cinema.KDMManager.helper.EmailHelper;
import com.github.tobiasmiosczka.cinema.KDMManager.helper.FtpHelper;
import com.github.tobiasmiosczka.cinema.KDMManager.helper.XmlHelper;
-import com.github.tobiasmiosczka.cinema.KDMManager.pojo.*;
+import com.github.tobiasmiosczka.cinema.KDMManager.pojo.Config;
+import com.github.tobiasmiosczka.cinema.KDMManager.pojo.EmailLogin;
+import com.github.tobiasmiosczka.cinema.KDMManager.pojo.FtpException;
+import com.github.tobiasmiosczka.cinema.KDMManager.pojo.FtpLogin;
+import com.github.tobiasmiosczka.cinema.KDMManager.pojo.KDM;
import org.jdom2.JDOMException;
import javax.mail.MessagingException;
-import javax.swing.*;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JProgressBar;
+import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.Container;
diff --git a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/ConfigParseException.java b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/ConfigParseException.java
index 42ee3d0..bec0829 100644
--- a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/ConfigParseException.java
+++ b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/ConfigParseException.java
@@ -8,8 +8,11 @@
public class ConfigParseException extends Throwable {
private final List stack = new LinkedList<>();
+ private final String message;
+
+ public ConfigParseException(Element element, String name, String message) {
+ this.message = message;
- public ConfigParseException(Element element, String name) {
stack.add(name);
while (element != null) {
stack.add(element.getName());
@@ -19,6 +22,6 @@ public ConfigParseException(Element element, String name) {
@Override
public String getMessage() {
- return stack.stream().reduce("", (a, b) -> "<" + b + "> " + a);
+ return message + " " + stack.stream().reduce("", (a, b) -> "<" + b + "> " + a);
}
}
diff --git a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/XmlHelper.java b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/XmlHelper.java
index 33bf0f0..b727c1a 100644
--- a/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/XmlHelper.java
+++ b/src/main/java/com/github/tobiasmiosczka/cinema/KDMManager/helper/XmlHelper.java
@@ -36,7 +36,7 @@ private static String getStringValue(Element element, String name) throws Config
try {
return element.getChild(name).getValue();
} catch (NullPointerException e) {
- throw new ConfigParseException(element, name);
+ throw new ConfigParseException(element, name, "Could not parse string value.");
}
}
@@ -44,7 +44,7 @@ private static int getIntegerValue(Element element, String name) throws ConfigPa
try {
return Integer.parseInt(element.getChild(name).getValue());
} catch (NullPointerException|NumberFormatException e) {
- throw new ConfigParseException(element, name);
+ throw new ConfigParseException(element, name, "Could not parse integer value.");
}
}
@@ -54,10 +54,10 @@ private static boolean getBooleanValue(Element element, String name) throws Conf
switch (string) {
case "true": return true;
case "false": return false;
- default: throw new ConfigParseException(element, name);
+ default: throw new ConfigParseException(element, name, "Could not parse boolean value.");
}
} catch (NullPointerException e) {
- throw new ConfigParseException(element, name);
+ throw new ConfigParseException(element, name, "Could not parse boolean value.");
}
}