[jboss-jira] [JBoss JIRA] Created: (JBCOMMON-17) org.jboss.util.file.JarUtils needs to be made more bullet-proof

Pete Bennett (JIRA) jira-events at lists.jboss.org
Wed Feb 28 07:20:35 EST 2007


org.jboss.util.file.JarUtils needs to be made more bullet-proof
---------------------------------------------------------------

                 Key: JBCOMMON-17
                 URL: http://jira.jboss.com/jira/browse/JBCOMMON-17
             Project: JBoss Common
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: core
         Environment: JBoss IDE 2.0.0beta2
Fedora Core 6 (2.6.18-1.2869.fc6 #1 SMP Wed Dec 20 14:51:19 EST 2006 i686 i686 i386 GNU/Linux)
J2SE6 (1.6.0-b105)
JBoss Portal 2.6alpha2 non-clustered with JBoss AS bundle
            Reporter: Pete Bennett
         Assigned To: Dimitris Andreadis


Deploying the attached WAR file creates the following stack trace, which is related to issue BIDE-124.

This file was created using the package builder in JBoss IDE.

11:17:04,216 ERROR [Tomcat5] Problem in init 
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:687)
        at org.jboss.util.file.JarUtils.unjar(JarUtils.java:273)
        at org.jboss.web.AbstractWebContainer.init(AbstractWebContainer.java:325)
...

I have re-raised this issue as BIDE-124 has been acted on and the file in question has moved considerably since then.

Having looked at http://anonsvn.jboss.org/repos/common/common-core/trunk/src/main/java/org/jboss/util/file/JarUtils.java I think that line 273 in the file needs to be modified to protect against the case where the first entry in a JAR file is simply "/" as in the attached WAR.

< if (fileName.charAt(0) == '/')
> if (fileName.length() > 0 && fileName.charAt(0) == '/')

Otherwise line 269 produces a fileName of length 0 which causes charAt(0) to fail.

Pete

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list