You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Anil Mahajan (Created) (JIRA)" <ji...@apache.org> on 2012/03/22 20:04:22 UTC
[jira] [Created] (VFS-408) CompressedFileFileObject Exception
thrown when container file has no extension
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
[jira] [Resolved] (VFS-408) CompressedFileFileObject Exception
thrown when container file has no extension
Posted by "Gary D. Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved VFS-408.
---------------------------------
Resolution: Fixed
Committed revision 1339256.
> 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