Author: kkolinko Date: Sun Jun 22 22:24:03 2014 New Revision: 1604662 URL: http://svn.apache.org/r1604662 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56657#c2 Ensure that re-mapping selects the context version that we expect. Merged r1604661 from tomcat/trunk.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1604661 Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1604662&r1=1604661&r2=1604662&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Sun Jun 22 22:24:03 2014 @@ -703,14 +703,13 @@ public class CoyoteAdapter implements Ad request.getMappingData().recycle(); } - boolean mapRequired = true; + // Version for the second mapping loop and + // Context that we expect to get for that version String version = null; + Context versionContext = null; + boolean mapRequired = true; while (mapRequired) { - if (version != null) { - // Once we have a version - that is it - mapRequired = false; - } // This will map the the latest version by default connector.getMapper().map(serverName, decodedURI, version, request.getMappingData()); @@ -754,8 +753,13 @@ public class CoyoteAdapter implements Ad sessionID = request.getRequestedSessionId(); - if (mapRequired) { - mapRequired = false; + mapRequired = false; + if (version != null && request.getContext() == versionContext) { + // We got the version that we asked for. That is it. + } else { + version = null; + versionContext = null; + Object[] contexts = request.getMappingData().contexts; // Single contextVersion means no need to remap // No session ID means no possibility of remap @@ -764,11 +768,13 @@ public class CoyoteAdapter implements Ad for (int i = (contexts.length); i > 0; i--) { Context ctxt = (Context) contexts[i - 1]; if (ctxt.getManager().findSession(sessionID) != null) { - // We found a context. Is it the one that has already been mapped? + // We found a context. Is it the one that has + // already been mapped? if (!ctxt.equals(request.getMappingData().context)) { - // Set version so second time through mapping the - // correct context is found + // Set version so second time through mapping + // the correct context is found version = ctxt.getWebappVersion(); + versionContext = ctxt; // Reset mapping request.getMappingData().recycle(); mapRequired = true; @@ -778,6 +784,7 @@ public class CoyoteAdapter implements Ad } } } + if (!mapRequired && request.getContext().getPaused()) { // Found a matching context but it is paused. Mapping data will // be wrong since some Wrappers may not be registered at this Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1604662&r1=1604661&r2=1604662&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Sun Jun 22 22:24:03 2014 @@ -109,7 +109,8 @@ <fix> <bug>56657</bug>: When using parallel deployment, if the same session id matches different versions of a web application, prefer the latest - version. (kkolinko) + version. Ensure that remapping selects the version that we expect. + (kkolinko) </fix> </changelog> </subsection> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org