You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2005/12/27 00:06:02 UTC

svn commit: r359123 - /portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java

Author: rwatler
Date: Mon Dec 26 15:06:00 2005
New Revision: 359123

URL: http://svn.apache.org/viewcvs?rev=359123&view=rev
Log:
correct portal site profile locator equivalence test: test now correctly allows for changing request paths; was broken in earlier bug fixes trying to correct other problems

Modified:
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=359123&r1=359122&r2=359123&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java (original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java Mon Dec 26 15:06:00 2005
@@ -590,14 +590,16 @@
             // detect stale session, modification of user
             // principal, or changed profile locators for
             // this session context
+            boolean userUpdate = false;
+            boolean locatorsUpdate = false;
             boolean updated = false;
             synchronized (this)
             {
-                if (stale ||
-                    ((userPrincipal == null) && (currentUserPrincipal != null)) ||
-                    ((userPrincipal != null) && !userPrincipal.equals(currentUserPrincipal)) ||
-                    (profileLocators == null) ||
-                    !locatorsEquals(profileLocators, requestProfileLocators))
+                userUpdate = (((userPrincipal == null) && (currentUserPrincipal != null)) ||
+                              ((userPrincipal != null) && !userPrincipal.equals(currentUserPrincipal)));
+                locatorsUpdate = ((profileLocators == null) ||
+                                  !locatorsEquals(profileLocators, requestProfileLocators));
+                if (stale || userUpdate || locatorsUpdate)
                 {
                     // reset cached session profile locators, view,
                     // folder page history, menu definition locators,
@@ -613,7 +615,31 @@
             if (updated && log.isDebugEnabled())
             {
                 StringBuffer debug = new StringBuffer();
-                debug.append("Updated context: user=" + userPrincipal + ", profileLocators=(");
+                if (userUpdate)
+                {
+                    debug.append("Updated user");
+                    if (locatorsUpdate)
+                    {
+                        debug.append("/locators");
+                    }
+                    if (stale)
+                    {
+                        debug.append("/stale");
+                    }
+                }
+                else if (locatorsUpdate)
+                {
+                    debug.append("Updated locators");
+                    if (stale)
+                    {
+                        debug.append("/stale");
+                    }
+                }
+                else
+                {
+                    debug.append("Updated stale");
+                }
+                debug.append(" context: user=" + userPrincipal + ", profileLocators=(");
                 if (profileLocators != null)
                 {
                     boolean firstEntry = true;
@@ -855,12 +881,17 @@
                 // compare ordered locator properties
                 for (int i = 0, limit = properties0.length; (i < limit); i++)
                 {
-                    // compare property names, control flags, navigation flags, and values
+                    // compare property names, control flags, navigation flags,
+                    // and values. note: properties values are compared only for
+                    // control or navigation properties; otherwise they are
+                    // assumed to contain variable request paths that should
+                    // be treated as equivalent
                     if (!properties0[i].getName().equals(properties1[i].getName()) ||
                         (properties0[i].isControl() && !properties1[i].isControl()) ||
                         (properties0[i].isNavigation() && !properties1[i].isNavigation()) ||
-                        ((properties0[i].getValue() == null) && (properties1[i].getValue() != null)) ||
-                        ((properties0[i].getValue() != null) && !properties0[i].getValue().equals(properties1[i].getValue())))
+                        ((properties0[i].isControl() || properties0[i].isNavigation()) && 
+                         (((properties0[i].getValue() == null) && (properties1[i].getValue() != null)) ||
+                          ((properties0[i].getValue() != null) && !properties0[i].getValue().equals(properties1[i].getValue())))))
                     {
                         return false;
                     }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org