Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-408

CompressedFileFileObject Exception thrown when container file has no extension

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.1
    • None

    Description

      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);

      Attachments

        Activity

          People

            Unassigned Unassigned
            anilm2@yahoo.com Anil Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: