Commons VFS
  1. Commons VFS
  2. VFS-408

CompressedFileFileObject Exception thrown when container file has no extension

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Labels:
      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);

        Activity

        Anil Mahajan created issue -
        Gary Gregory made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Anil Mahajan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development