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

AbstractFileObject.getChildren(): internal structures will be left inconsistent if the excepion is thrown

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 2.1
    • Labels:
      None

      Description

      AbstractFileObject.getChildren() creates children array and then fills it by resolving child names via FileSystemManager.resolveName(). If the latter method throws an exception (in my case it's "Invalid descendent file name "pci-0000:00:07.1-scsi-0:0:0:0""), children array is left as is with some of the entries = null, that inevitably results in NPE on the next getChildren() call:
      at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:319)
      at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:314)
      at org.apache.commons.vfs.provider.AbstractFileObject.resolveFile(AbstractFileObject.java:723)
      at org.apache.commons.vfs.provider.AbstractFileObject.resolveFiles(AbstractFileObject.java:715)
      at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:618)
      at org.apache.commons.vfs.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:412)

      since AbstractFileObject.getChildren() only checks that children instance is not null

        Attachments

        1. VFS-285.patch
          2 kB
          Thomas Neidhart

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ksafonov Kirill Safonov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: