Mercurial > dive4elements > river
changeset 3698:8e69aca69074
Catch MissingResourceException on unexpected server exceptions.
flys-client/trunk@5408 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sun, 09 Sep 2012 10:03:19 +0000 |
parents | 2e12518ff5b4 |
children | 42cd7df8d989 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java |
diffstat | 3 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Sat Sep 08 12:22:53 2012 +0000 +++ b/flys-client/ChangeLog Sun Sep 09 10:03:19 2012 +0000 @@ -1,3 +1,11 @@ +2012-09-09 Christian Lins <christian.lins@intevation.de> + + * src/main/java/de/intevation/flys/client/server/UserServiceImpl.java: + Remove blank line. + + * src/main/java/de/intevation/flys/client/client/FLYS.java: + Catch MissingResourceException on unexpected server exceptions (#843). + 2012-09-08 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Sat Sep 08 12:22:53 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Sun Sep 09 10:03:19 2012 +0000 @@ -40,6 +40,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.MissingResourceException; import java.util.Set; @@ -137,13 +138,22 @@ Config config = Config.getInstance(); String locale = config.getLocale(); - getRivers(); // Useless call? - userService.getCurrentUser(locale, new AsyncCallback<User>() { @Override public void onFailure(Throwable caught) { GWT.log("Could not find a logged in user."); - SC.warn(MSG.getString(caught.getMessage())); + String msg = caught.getLocalizedMessage(); + try { + msg = MSG.getString(caught.getMessage()); + } + catch(MissingResourceException ex) { + // There are some server error exceptions with + // varying text messages that cannot be localized + // easily. In this rare cases, use the plain + // exception message. + GWT.log("Missing resource for: " + caught.getMessage()); + } + SC.warn(msg); } @Override
--- a/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java Sat Sep 08 12:22:53 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java Sun Sep 09 10:03:19 2012 +0000 @@ -23,7 +23,6 @@ { private static final Logger logger = Logger.getLogger(UserServiceImpl.class); - public static final String ERROR_NO_SUCH_USER = "error_no_such_user"; public User getCurrentUser(String locale)