Commons VFS
  1. Commons VFS
  2. VFS-259

Http and Webdav FIleContentInfoFactory: undress to AbstractFileObject before casting

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None

      Description

      HttpFileContentInfoFactory and WebdavFileContentInfoFactory assume that FileContent#getFile() will always return AbstractFileObject subclass for them.
      However, it may be false assumption: HttpFileObject or WebdavFileObject may be decorated, so even AbstractFileObject#getFileContent() may be decorated, and this FileContent#getFile() too.

      Patch proposal for HttpFileContentInfoFactory/WebdavFileContentInfoFactory: instead of direct casting FIleObject to AbstractFileObject subclass, use FileObjectUtils.getAbstractFileObject() before casting. This way it is non-intrusive: decorating FileObject#getFileContent() is allowed while no regression occurs.

        Activity

        Ralph Goers made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Marek Zawirski made changes -
        Field Original Value New Value
        Attachment FileContentInfoFactory_undress_AbstractFileObject.patch [ 12408483 ]
        Marek Zawirski created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Marek Zawirski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development