Author: kkolinko Date: Sat Jun 21 22:45:28 2014 New Revision: 1604484 URL: http://svn.apache.org/r1604484 Log: Simplify code, no functional change.
This makes it clear that setting "mapRequired = true;" and "getMappingData().recycle();" call are always performed together. Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1604484&r1=1604483&r2=1604484&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Sat Jun 21 22:45:28 2014 @@ -862,11 +862,6 @@ public class CoyoteAdapter implements Ad connector.getService().getMapper().map(serverName, decodedURI, version, request.getMappingData()); - // Single contextVersion therefore no possibility of remap - if (request.getMappingData().contexts == null) { - mapRequired = false; - } - // If there is no context at this point, it is likely no ROOT context // has been deployed if (request.getContext() == null) { @@ -884,7 +879,7 @@ public class CoyoteAdapter implements Ad // Now we have the context, we can parse the session ID from the URL // (if any). Need to do this before we redirect in case we need to // include the session id in the redirect - String sessionID = null; + String sessionID; if (request.getServletContext().getEffectiveSessionTrackingModes() .contains(SessionTrackingMode.URL)) { @@ -905,32 +900,27 @@ public class CoyoteAdapter implements Ad sessionID = request.getRequestedSessionId(); if (mapRequired) { - if (sessionID == null) { - // No session means no possibility of needing to remap - mapRequired = false; - } else { + mapRequired = false; + Context[] contexts = request.getMappingData().contexts; + // Single contextVersion therefore no possibility of remap + // No session means no possibility of needing to remap + if (contexts != null && sessionID != null) { // Find the context associated with the session - Context[] contexts = request.getMappingData().contexts; for (int i = (contexts.length); i > 0; i--) { Context ctxt = contexts[i - 1]; if (ctxt.getManager().findSession(sessionID) != null) { // Was the correct context already mapped? - if (ctxt.equals(request.getMappingData().context)) { - mapRequired = false; - } else { + if (!ctxt.equals(request.getMappingData().context)) { // Set version so second time through mapping the // correct context is found version = ctxt.getWebappVersion(); // Reset mapping request.getMappingData().recycle(); + mapRequired = true; break; } } } - if (version == null) { - // No matching context found. No need to re-map - mapRequired = false; - } } } if (!mapRequired && request.getContext().getPaused()) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org