tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1428084 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/util/ExtensionValidator.java webapps/docs/changelog.xml
Date Wed, 02 Jan 2013 21:57:28 GMT
Author: markt
Date: Wed Jan  2 21:57:27 2013
New Revision: 1428084

URL: http://svn.apache.org/viewvc?rev=1428084&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54256
Improve error reporting when a JAR file fails extension validation by including the name of
the JAR file in the exception.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1428079

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java?rev=1428084&r1=1428083&r2=1428084&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ExtensionValidator.java Wed Jan  2
21:57:27 2013
@@ -175,15 +175,18 @@ public final class ExtensionValidator {
 
         // Locate the Manifests for all bundled JARs
         NamingEnumeration<Binding> ne = null;
+        // Primarily used for error reporting
+        String jarName = null;
         try {
             ne = dirContext.listBindings("WEB-INF/lib/");
             while ((ne != null) && ne.hasMoreElements()) {
                 Binding binding = ne.nextElement();
-                if (!binding.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
+                jarName = binding.getName();
+                if (!jarName.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
                     continue;
                 }
                 Object obj =
-                    dirContext.lookup("/WEB-INF/lib/" + binding.getName());
+                    dirContext.lookup("/WEB-INF/lib/" + jarName);
                 if (!(obj instanceof Resource)) {
                     // Probably a directory named xxx.jar - ignore it
                     continue;
@@ -192,16 +195,16 @@ public final class ExtensionValidator {
                 inputStream = resource.streamContent();
                 Manifest jmanifest = getManifest(inputStream);
                 if (jmanifest != null) {
-                    ManifestResource mre = new ManifestResource(
-                                                binding.getName(),
-                                                jmanifest, 
-                                                ManifestResource.APPLICATION);
+                    ManifestResource mre = new ManifestResource(jarName,
+                            jmanifest, ManifestResource.APPLICATION);
                     appManifestResources.add(mre);
                 }
             }
         } catch (NamingException nex) {
             // Jump out of the check for this application because it 
             // has no resources
+        } catch (IOException ioe) {
+            throw new IOException("Jar: " + jarName, ioe);
         } finally {
             if (inputStream != null) {
                 try {

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=1428084&r1=1428083&r2=1428084&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jan  2 21:57:27 2013
@@ -65,6 +65,11 @@
         context path contains encoded characters such as a space. This triggered
         compilation issues in Jasper. Patch provided by Polina Genova. (markt)
       </fix>
+      <fix>
+        <bug>54256</bug>: Improve error reporting when a JAR file fails
+        extension validation by including the name of the JAR file in the
+        exception. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message