Skip to content

Commit

Permalink
Version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasmiosczka committed May 16, 2018
1 parent dc8a929 commit 724c78c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.tobiasmiosczka.cinema</groupId>
<artifactId>KDMManager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.5.0</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
public class ConfigParseException extends Throwable {

private final List<String> 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());
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ 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.");
}
}

private static int getIntegerValue(Element element, String name) throws ConfigParseException {
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.");
}
}

Expand All @@ -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.");
}
}

Expand Down

0 comments on commit 724c78c

Please sign in to comment.