Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E9A40DBB2 for ; Thu, 13 Sep 2012 09:41:19 +0000 (UTC) Received: (qmail 74538 invoked by uid 500); 13 Sep 2012 09:41:19 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 74447 invoked by uid 500); 13 Sep 2012 09:41:19 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 74421 invoked by uid 99); 13 Sep 2012 09:41:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2012 09:41:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_FRT_STOCK2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2012 09:41:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1ED572388A6C for ; Thu, 13 Sep 2012 09:40:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1384255 - /tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java Date: Thu, 13 Sep 2012 09:40:32 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120913094032.1ED572388A6C@eris.apache.org> Author: markt Date: Thu Sep 13 09:40:31 2012 New Revision: 1384255 URL: http://svn.apache.org/viewvc?rev=1384255&view=rev Log: Correct behaviour to take account of webAppMount and internalPath. Untested. Need some unit tests around all of this. Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java?rev=1384255&r1=1384254&r2=1384255&view=diff ============================================================================== --- tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java (original) +++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/webresources/JarResourceSet.java Thu Sep 13 09:40:31 2012 @@ -74,8 +74,8 @@ public class JarResourceSet implements W @Override public WebResource getResource(String path) { if (path.startsWith(webAppMount)) { - StringBuilder pathInJar = new StringBuilder(internalPath); - pathInJar.append(path.substring(webAppMount.length())); + String pathInJar = + internalPath + path.substring(webAppMount.length()); JarEntry jarEntry = base.getJarEntry(pathInJar.toString()); if (jarEntry == null) { return new EmptyResource(root, path); @@ -96,12 +96,17 @@ public class JarResourceSet implements W @Override public Set listWebAppPaths(String path) { ResourceSet result = new ResourceSet<>(); - Enumeration entries = base.entries(); - while (entries.hasMoreElements()) { - JarEntry entry = entries.nextElement(); - String name = entry.getName(); - if (name.startsWith(path)) { - result.add(name); + if (path.startsWith(webAppMount)) { + String pathInJar = + internalPath + path.substring(webAppMount.length()); + Enumeration entries = base.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + String name = entry.getName(); + if (name.startsWith(pathInJar)) { + result.add(webAppMount + + name.substring(internalPath.length())); + } } } result.setLocked(true); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org