commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anil Mahajan (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (VFS-408) CompressedFileFileObject Exception thrown when container file has no extension
Date Thu, 22 Mar 2012 19:04:22 GMT
CompressedFileFileObject Exception thrown when container file has no extension
------------------------------------------------------------------------------

                 Key: VFS-408
                 URL: https://issues.apache.org/jira/browse/VFS-408
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Anil Mahajan
            Priority: Minor


CompressedFileFileObject blindly performs a substring operation on an unchecked String index
lookup value.  If that value happens to be -1 (lookup not found), then an Index Out Of Bounds
error is thrown.  The lookup is for a "." to find the base file name.

This happens when trying to decompress a file with no file extension.

subversion revision: 1159220 for CompressedFileFileObject.java

code in repository: line 42:

        // todo, add getBaseName(String) to FileName
        String basename = container.getName().getBaseName();
        int pos = basename.lastIndexOf('.');
        basename = basename.substring(0, pos);


should alter that last line to something like:

if (pos > 0)
    basename = basename.substring(0, pos);



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message