summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/App.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-03-05 17:09:58 +0100
committerSimon Rettberg2015-03-05 17:09:58 +0100
commita6ff21250abe9f0415c8aaa488bea5f962cfea72 (patch)
treee65c161ebfca9b492fb649296c7a9fc0b6555c30 /dozentenmodul/src/main/java/App.java
parentminor - reduce logging spam and removed unneeded check (diff)
downloadtutor-module-a6ff21250abe9f0415c8aaa488bea5f962cfea72.tar.gz
tutor-module-a6ff21250abe9f0415c8aaa488bea5f962cfea72.tar.xz
tutor-module-a6ff21250abe9f0415c8aaa488bea5f962cfea72.zip
[client] Restore RPC version check; add error message on thrift communication error
Diffstat (limited to 'dozentenmodul/src/main/java/App.java')
-rw-r--r--dozentenmodul/src/main/java/App.java33
1 files changed, 24 insertions, 9 deletions
diff --git a/dozentenmodul/src/main/java/App.java b/dozentenmodul/src/main/java/App.java
index 11ab05a8..0eb9b847 100644
--- a/dozentenmodul/src/main/java/App.java
+++ b/dozentenmodul/src/main/java/App.java
@@ -8,19 +8,20 @@ import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
+import org.openslx.thrifthelper.ThriftManager;
+import org.openslx.thrifthelper.ThriftManager.ErrorCallback;
import util.GuiManager;
import config.Config;
import config.ConfigProxy;
-
public class App {
// Logger
private final static Logger LOGGER = Logger.getLogger(App.class);
private static void setupLogger() {
-
+
// path to the log file
final String logFilePath = Config.getPath() + System.getProperty("file.separator") + "bwSuite.log";
@@ -31,8 +32,7 @@ public class App {
try {
logFile.renameTo(new File(logFilePath + ".old"));
} catch (Exception e) {
- LOGGER.error("Could not move '" + logFilePath +
- "' to '" + logFilePath + ".old':");
+ LOGGER.error("Could not move '" + logFilePath + "' to '" + logFilePath + ".old':");
e.printStackTrace();
}
}
@@ -50,7 +50,6 @@ public class App {
LOGGER.info("Logger initialised.");
}
-
public static void main(final String[] args) {
// Pruefe und Erzeuge gegebenfalls Config
@@ -58,8 +57,7 @@ public class App {
Config.init();
} catch (IOException e) {
e.printStackTrace();
- JOptionPane.showMessageDialog(null, e.getMessage(),
- "Fehler", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(null, e.getMessage(), "Fehler", JOptionPane.ERROR_MESSAGE);
return;
}
@@ -72,6 +70,24 @@ public class App {
LOGGER.error("IOException when trying to initialise the proxy, see trace: ", e);
}
+ // Set up thrift error message displaying
+ ThriftManager.setErrorCallback(new ErrorCallback() {
+
+ @Override
+ public void thriftError(Throwable t, String message) {
+ EventQueue.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ JOptionPane.showMessageDialog(null, "Die Kommunikation mit dem Server ist fehlgeschlagen.\n"
+ + "Bitte stellen Sie sicher, dass Sie mit dem Internet verbunden sind.\n"
+ + "Sofern das Problem weiterhin besteht, liegt möglicherweise eine serverseitige\n"
+ + "Störung vor.", "Fehler", JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+ });
+
// start the GUI
EventQueue.invokeLater(new Runnable() {
public void run() {
@@ -79,8 +95,7 @@ public class App {
GuiManager.initGui();
} catch (Exception e) {
e.printStackTrace();
- JOptionPane.showMessageDialog(null, e.getStackTrace(),
- "Message", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(null, e.getStackTrace(), "Message", JOptionPane.ERROR_MESSAGE);
}
}