Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51447
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 28 Jun 2011 16:22:08 +0000 (16:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 28 Jun 2011 16:22:08 +0000 (16:22 +0000)
Viewing a back up session in the HTML Manager web application no longer changes the session to a primary session.
Based on a patch provided by Eiji Takahashi.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1140708 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/manager/HTMLManagerServlet.java
webapps/docs/changelog.xml

index d15dbf1..eb4ca97 100644 (file)
@@ -923,27 +923,18 @@ public final class HTMLManagerServlet extends ManagerServlet {
         }
         return sessions;
     }
+
     protected Session getSessionForNameAndId(ContextName cn, String id,
-            StringManager smClient) throws IOException {
-        if ((cn == null) || !(cn.getPath().startsWith("/") ||
-                cn.getPath().equals(""))) {
-            String path = null;
-            if (cn != null) {
-                path = cn.getPath();
+            StringManager smClient) {
+
+        List<Session> sessions = getSessionsForName(cn, smClient);
+        if (sessions == null || sessions.isEmpty()) return null;
+        for(Session session : sessions) {
+            if (session.getId().equals(id)) {
+                return session;
             }
-            throw new IllegalArgumentException(smClient.getString(
-                    "managerServlet.invalidPath",
-                    RequestUtil.filter(path)));
-        }
-        
-        Context ctxt = (Context) host.findChild(cn.getName());
-        if (null == ctxt) {
-            throw new IllegalArgumentException(smClient.getString(
-                    "managerServlet.noContext",
-                    RequestUtil.filter(cn.getDisplayName())));
         }
-        Session session = ctxt.getManager().findSession(id);
-        return session;
+        return null;
     }
 
     /**
index 827c236..30bcb4e 100644 (file)
         Add <code>session="false"</code> directive to the index page of the
         ROOT web application. (kkolinko)
       </fix>
+      <fix>
+        <bug>51447</bug>: Viewing a back up session in the HTML Manager web
+        application no longer changes the session to a primary session. Based on
+        a patch provided by Eiji Takahashi. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">