Author: markt
Date: Fri Sep 14 18:07:05 2012
New Revision: 1384871
URL: http://svn.apache.org/viewvc?rev=1384871&view=rev
Log:
Fix some unit test failures when running the full test suite
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=1384871&r1=1384870&r2=1384871&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
Fri Sep 14 18:07:05 2012
@@ -97,7 +97,9 @@ public class JarResourceSet extends Abst
String pathInJar = internalPath + path.substring(
webAppMount.length(), path.length());
// Always strip off the leading '/' to get the JAR path
- pathInJar = pathInJar.substring(1);
+ if (pathInJar.charAt(0) == '/') {
+ pathInJar = pathInJar.substring(1);
+ }
if (pathInJar.equals("")) {
// Special case
return new JarResourceRoot(root, new File(base.getName()),
@@ -134,7 +136,9 @@ public class JarResourceSet extends Abst
String pathInJar =
internalPath + path.substring(webAppMount.length());
// Always strip off the leading '/' to get the JAR path
- pathInJar = pathInJar.substring(1);
+ if (pathInJar.charAt(0) == '/') {
+ pathInJar = pathInJar.substring(1);
+ }
Enumeration<JarEntry> entries = base.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
@@ -172,11 +176,13 @@ public class JarResourceSet extends Abst
internalPath + path.substring(webAppMount.length());
// Always strip off the leading '/' to get the JAR path and make
// sure it ends in '/'
- if (pathInJar.charAt(pathInJar.length() - 1) == '/') {
- pathInJar = pathInJar.substring(1);
- } else {
+ if (pathInJar.charAt(pathInJar.length() - 1) != '/') {
pathInJar = pathInJar.substring(1) + '/';
}
+ if (pathInJar.charAt(0) == '/') {
+ pathInJar = pathInJar.substring(1);
+ }
+
Enumeration<JarEntry> entries = base.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]