- if (e.getCause() != null) {
- Throwable firstCause = e.getCause();
- // log.error("Cause", firstCause);
- if (firstCause instanceof LoginException
- && firstCause.getCause() != null) {
- Throwable secondCause = firstCause.getCause();
- if (secondCause instanceof BadCredentialsException) {
- MessageDialog.openInformation(
- display.getActiveShell(),
- "Bad Credentials",
- "Your credentials are incorrect");
- // retry login
- continue tryLogin;
- } else if (secondCause instanceof ThreadDeath) {
- // rethrow thread death caused by dialog UI timeout
- throw (ThreadDeath) secondCause;
- }
-
- } else if (firstCause instanceof ThreadDeath) {
- throw (ThreadDeath) firstCause;
- }
+ BadCredentialsException bce = wasCausedByBadCredentials(e);
+ if (bce != null) {
+ MessageDialog.openInformation(display.getActiveShell(),
+ "Bad Credentials", bce.getMessage());
+ // retry login
+ continue tryLogin;
+ }
+
+ // check thread death
+ ThreadDeath td = wasCausedByThreadDeath(e);
+ if (td != null) {
+ display.dispose();
+ throw td;
+ }
+
+ // if (e.getCause() != null) {
+ // Throwable firstCause = e.getCause();
+ // // log.error("Cause", firstCause);
+ // if (firstCause instanceof LoginException
+ // && firstCause.getCause() != null) {
+ // Throwable secondCause = firstCause.getCause();
+ // if (secondCause instanceof BadCredentialsException) {
+ // MessageDialog.openInformation(
+ // display.getActiveShell(),
+ // "Bad Credentials",
+ // "Your credentials are incorrect");
+ // // retry login
+ // continue tryLogin;
+ // } else if (secondCause instanceof ThreadDeath) {
+ // // rethrow thread death caused by dialog UI timeout
+ // throw (ThreadDeath) secondCause;
+ // }
+ //
+ // } else if (firstCause instanceof ThreadDeath) {
+ // throw (ThreadDeath) firstCause;
+ // }
+ // }
+
+ if (!display.isDisposed()) {
+ org.argeo.eclipse.ui.Error.show(
+ "Unexpected exception during authentication", e);
+ // this was not just bad credentials or death thread
+ RWT.getRequest().getSession().setMaxInactiveInterval(1);
+ display.dispose();
+ return -1;
+ } else {
+ throw new ArgeoException(
+ "Unexpected exception during authentication", e);