| author | Sidharth Singh | 2012-12-07 05:43:50 (EST) |
|---|---|---|
| committer | Stephan Born | 2013-01-25 12:34:46 (EST) |
| commit | aee0b744f70639da0676b6471d58a779b561391e (patch) (side-by-side diff) | |
| tree | 63be349594c5ec4d338f7096d8473928570d20be | |
| parent | 895937554e09fe9703ae00b29a35fb7d8bdce310 (diff) | |
| download | org.eclipse.stardust.ui.web-aee0b744f70639da0676b6471d58a779b561391e.zip org.eclipse.stardust.ui.web-aee0b744f70639da0676b6471d58a779b561391e.tar.gz org.eclipse.stardust.ui.web-aee0b744f70639da0676b6471d58a779b561391e.tar.bz2 | |
Jira-ID: CRNT-27166
Addded try/catch block in SessionContext initSession for ModelCache.reset.
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@61454 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
2 files changed, 40 insertions, 38 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/beans/SessionContext.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/beans/SessionContext.java index 8b2e09c..17517ea 100644 --- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/beans/SessionContext.java +++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/beans/SessionContext.java @@ -29,6 +29,7 @@ import javax.servlet.http.HttpSession; import org.eclipse.stardust.common.CollectionUtils;
import org.eclipse.stardust.common.StringUtils;
import org.eclipse.stardust.common.config.ExtensionProviderUtils;
+import org.eclipse.stardust.common.error.AccessForbiddenException; import org.eclipse.stardust.common.error.LoginFailedException; import org.eclipse.stardust.common.log.LogManager;
import org.eclipse.stardust.common.log.Logger;
@@ -384,55 +385,60 @@ public final class SessionContext implements Serializable // Service factory needs to be set already
throw new PortalException(PortalErrorClass.UNABLE_TO_INITIALIZE_SESSION);
}
-
- /* Reset model cache to ensure that the latest models are fetched */
- ModelCache modelCache = ModelCache.findModelCache();
- modelCache.reset();
-
- if (isModelRequired())
+ try {
- Collection models = modelCache.getAllModels();
- if (models.isEmpty())
+ /* Reset model cache to ensure that the latest models are fetched */ + ModelCache modelCache = ModelCache.findModelCache(); + modelCache.reset(); + + if (isModelRequired()) {
- logout();
- throw new PortalException(PortalErrorClass.NO_DEPLOYED_MODEL);
+ Collection models = modelCache.getAllModels(); + if (models.isEmpty()) + { + logout(); + throw new PortalException(PortalErrorClass.NO_DEPLOYED_MODEL); + } }
- }
-
- ApplicationContext.registerUser((HttpSession)FacesContext.getCurrentInstance().
- getExternalContext().getSession(false), loggedInUser);
-
- this.propertyMap = getPropertyMap(false);
- synchronized (propertyMap)
- {
- if(!propertyMap.isEmpty())
+ + ApplicationContext.registerUser((HttpSession) FacesContext.getCurrentInstance().getExternalContext() + .getSession(false), loggedInUser); + + this.propertyMap = getPropertyMap(false); + synchronized (propertyMap) {
- Iterator mapIter = propertyMap.entrySet().iterator();
- Map sessionListenerMap = CollectionUtils.newMap();
- while (mapIter.hasNext())
+ if (!propertyMap.isEmpty()) {
- Map.Entry mapEntry = (Map.Entry) mapIter.next();
- Object value = mapEntry.getValue();
- if(value instanceof ISessionListener)
+ Iterator mapIter = propertyMap.entrySet().iterator(); + Map sessionListenerMap = CollectionUtils.newMap(); + while (mapIter.hasNext()) {
- sessionListenerMap.put(mapEntry.getKey(), value);
+ Map.Entry mapEntry = (Map.Entry) mapIter.next(); + Object value = mapEntry.getValue(); + if (value instanceof ISessionListener) + { + sessionListenerMap.put(mapEntry.getKey(), value); + } }
+ propertyMap.clear(); + propertyMap.putAll(sessionListenerMap); + resetPropertyMap(propertyMap); }
- propertyMap.clear();
- propertyMap.putAll(sessionListenerMap);
- resetPropertyMap(propertyMap);
}
- }
-
- try
- {
+ propagateNewSession();
}
- catch(LoginFailedException e)
+ catch (LoginFailedException e) {
logout();
throw e;
}
+ catch (AccessForbiddenException ex) + { + // ModelCache throws AFE when user with no-role tries login + logout(); + throw ex; + } }
public void registerSessionListener(ISessionListener listener)
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelCache.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelCache.java index a8178b5..aadf817 100644 --- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelCache.java +++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelCache.java @@ -248,10 +248,6 @@ public class ModelCache implements Resetable, Serializable unusedModels=null;
}
- catch (Exception e)
- {
- ExceptionHandler.handleException(e);
- }
finally
{
//6)release write lock
|

