]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
Fixed bug: after trying to search and found nothing do login/logout and then crash.
authorrkv <rkv@opencascade.com>
Mon, 3 Dec 2012 12:42:01 +0000 (12:42 +0000)
committerrkv <rkv@opencascade.com>
Mon, 3 Dec 2012 12:42:01 +0000 (12:42 +0000)
Workspace/Siman/src/org/splat/simer/ConnectionAction.java

index ad7b0608671e915a03d0e7e4b33075f34b0fbbd2..ea5628612ea753ef5d0ca201ba8cc5c8663e5804 100644 (file)
@@ -11,11 +11,13 @@ import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.TextOutputCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.AccountNotFoundException;
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.login.LoginContext;
 
 import org.splat.dal.bo.kernel.User;
 import org.splat.som.ApplicationRights;
+import org.splat.wapp.Constants;
 
 /**
  * User login action.
@@ -100,7 +102,7 @@ public class ConnectionAction extends Action {
                                Subject identity = context.getSubject();
                                Set<User> table = identity.getPrincipals(User.class);
                                if (table.isEmpty()) {
-                                       throw new Exception();
+                                       throw new AccountNotFoundException();
                                }
 
                                User user = table.iterator().next(); // The user is (apparently...) the 1st principal
@@ -112,18 +114,24 @@ public class ConnectionAction extends Action {
                                        Map<String, Object> sfilter = (Map<String, Object>) session
                                                        .get("study.filter");
 
-                                       sfilter.put("state", "ANY");
-                                       sfilter.put("visibility", "PRIVATE");
-                                       if (logged.canCreateStudy()) {
-                                               sfilter.put("author", String.valueOf(user.getIndex()));
+                                       if (sfilter != null) {
+                                               sfilter.put("state", "ANY");
+                                               sfilter.put("visibility", "PRIVATE");
+                                               if (logged.canCreateStudy()) {
+                                                       sfilter.put("author", String.valueOf(user
+                                                                       .getIndex()));
+                                               }
                                        }
                                }
                                this.connect(context, user); // Updates the session context
 
-                               setMenuProperty("none");
+                               setMenuProperty(Constants.NONE);
                                initializationScreenContext(_menuProperty);
 
                                res = _backmenu;
+                               if (res == null || "null".equals(res)) {
+                                       res = Constants.NONE;
+                               }
                        } catch (FailedLoginException error) {
                                setErrorCode("message.error.login." + error.getMessage());
                                res = INPUT;
@@ -169,10 +177,13 @@ public class ConnectionAction extends Action {
 
                        this.disconnect(); // Updates the session context
 
-                       setMenuProperty("none");
+                       setMenuProperty(Constants.NONE);
                        initializationScreenContext(_menuProperty);
 
                        res = _backmenu;
+                       if (res == null || "null".equals(res)) {
+                               res = Constants.NONE;
+                       }
                } catch (Exception error) {
                        LOG.error("Reason:", error);
                        res = ERROR;