Author: rwatler
Date: Mon Dec 26 14:49:56 2005
New Revision: 359118

URL: http://svn.apache.org/viewcvs?rev=359118&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/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java

Modified: 
portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=359118&r1=359117&r2=359118&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
 (original)
+++ 
portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
 Mon Dec 26 14:49:56 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to