diff options
author | Simon Rettberg | 2015-08-27 18:08:48 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-08-27 18:08:48 +0200 |
commit | ac15c2a1cfe0fc0519b5577e7478c25500fe45c3 (patch) | |
tree | cdc93ee180fe17220c8a193fff73238e9ddcc651 /dozentenmodul | |
parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
download | tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.gz tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.xz tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.zip |
[*] Thrift API changes
Diffstat (limited to 'dozentenmodul')
5 files changed, 34 insertions, 11 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java index 50aae9e2..3068f8a1 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java @@ -20,7 +20,7 @@ import org.apache.log4j.Logger; import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.bwlp.thrift.iface.SatelliteServer.Client; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; +import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.bwlp.thrift.iface.WhoamiInfo; import org.openslx.dozmod.App; import org.openslx.dozmod.Config; @@ -347,7 +347,7 @@ public class LoginWindow extends LoginWindowLayout { + "Grund: " + e1.number.toString() + " (" + e1.message + ")", MessageType.ERROR, null, null); return; - } catch (TInternalServerError e1) { + } catch (TInvocationException e1) { Gui.showMessageBox( this, "Authentifizierung erfolgreich, bei der Kommunikation mit dem Satelliten trat jedoch ein interner Server-Fehler auf.", diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java index e8681c6e..e31a2852 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java @@ -24,8 +24,6 @@ import org.openslx.bwlp.thrift.iface.LectureRead; import org.openslx.bwlp.thrift.iface.LectureSummary; import org.openslx.bwlp.thrift.iface.LectureWrite; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; -import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.bwlp.thrift.iface.TransferInformation; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.dozmod.Config; diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java index 73fffc37..6982f8e5 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java @@ -7,9 +7,10 @@ import javax.swing.SwingUtilities; import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.AuthorizationError; +import org.openslx.bwlp.thrift.iface.InvocationError; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; import org.openslx.bwlp.thrift.iface.TInvalidDateParam; +import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.bwlp.thrift.iface.TTransferRejectedException; import org.openslx.dozmod.gui.Gui; @@ -23,8 +24,9 @@ public class ThriftError { } else if (ex instanceof TAuthorizationException) { String reason = getString(((TAuthorizationException) ex).getNumber()); messageText += "\n\nZugriff verweigert: " + reason + "\n" + ex.getMessage(); - } else if (ex instanceof TInternalServerError) { - messageText += "\n\nEin serverseitiger Fehler ist aufgetreten. Bitte kontaktieren Sie den lokalen Support."; + } else if (ex instanceof TInvocationException) { + messageText += "\n\nDer Funktionsaufruf konnte nicht durchgeführt werden: " + + getString(((TInvocationException) ex).getNumber()) + "\n" + ex.getMessage(); } else if (ex instanceof TInvalidDateParam) { messageText += "\n\nEin angegebenes Datum ist ungültig:\n" + ex.getMessage(); } else if (ex instanceof TTransferRejectedException) { @@ -46,6 +48,29 @@ public class ThriftError { }); } + private static String getString(InvocationError error) { + if (error == null) + return "Interner serverseitiger Fehler"; + switch (error) { + case INTERNAL_SERVER_ERROR: + return "Interner serverseitiger Fehler"; + case INVALID_DATA: + return "Ein Parameter hat einen ungültigen Wert"; + case INVALID_SHARE_MODE: + return "Ungültiger Share-Mode"; + case MISSING_DATA: + return "Ein Parameter fehlt (null?)"; + case UNKNOWN_IMAGE: + return "Unbekanntes Image"; + case UNKNOWN_LECTURE: + return "Unbekannte Veranstaltung"; + case UNKNOWN_USER: + return "Unbekannter Benutzer"; + default: + return "Unbekannter Fehlercode: " + error.toString(); + } + } + public static String getString(AuthorizationError error) { if (error == null) return "(AuthorizationError=null)"; diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/ImageCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/ImageCache.java index 8e6f8566..051e7b26 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/ImageCache.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/ImageCache.java @@ -5,7 +5,7 @@ import java.util.List; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; +import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.dozmod.thrift.Session; import org.openslx.thrifthelper.ThriftManager; import org.openslx.util.GenericDataCache; @@ -17,7 +17,7 @@ public class ImageCache { private static final GenericDataCache<List<ImageSummaryRead>> listCache = new GenericDataCache<List<ImageSummaryRead>>(CACHE_TIME_LIST_MS) { @Override - protected List<ImageSummaryRead> update() throws TAuthorizationException, TInternalServerError, TException { + protected List<ImageSummaryRead> update() throws TAuthorizationException, TInvocationException, TException { List<ImageSummaryRead> result = null; int pageSize = Session.getSatelliteConfig().pageSize; for (int i = 0;; ++i) { diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/LectureCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/LectureCache.java index 6b4466c8..04debc3d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/LectureCache.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/cache/LectureCache.java @@ -5,7 +5,7 @@ import java.util.List; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.LectureSummary; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; +import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.dozmod.thrift.Session; import org.openslx.thrifthelper.ThriftManager; import org.openslx.util.GenericDataCache; @@ -17,7 +17,7 @@ public class LectureCache { private static final GenericDataCache<List<LectureSummary>> listCache = new GenericDataCache<List<LectureSummary>>(CACHE_TIME_LIST_MS) { @Override - protected List<LectureSummary> update() throws TAuthorizationException, TInternalServerError, TException { + protected List<LectureSummary> update() throws TAuthorizationException, TInvocationException, TException { List<LectureSummary> result = null; int pageSize = Session.getSatelliteConfig().pageSize; for (int i = 0;; ++i) { |