Commons VFS
  1. Commons VFS
  2. VFS-337

AbstractFileObject ctor accepts FileName as a parameter, but actually requires AbstractFileName

    Details

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

      Description

      The AbstractFileObject constructor accepts FileName as a parameter, but actually requires an AbstractFileName.
      Anything else will generate a ClassCastException.

      The reason for the cast is to allow access to the package-protected method void AbstractFileName#setType(FileType type)

      Many of the AbstractFileObject methods rely on being able to invoke the setType method, so perhaps the parameter should be changed accordingly?
      This will change the API and require changes to subclasses.

      I'll add Javadoc to document the restriction.

        Activity

        Hide
        Ralph Goers added a comment -

        I suspect this issue was meant to refer to AbstractFileObject instead of AbstractFileName. AbstractFileName does not accept a FileName in the constructor while AbstractFileObject does. setType in AbstractFileName is only called from one place - setFiletype in AbstractFileObject while setFileType and injectType are called from many places.

        Show
        Ralph Goers added a comment - I suspect this issue was meant to refer to AbstractFileObject instead of AbstractFileName. AbstractFileName does not accept a FileName in the constructor while AbstractFileObject does. setType in AbstractFileName is only called from one place - setFiletype in AbstractFileObject while setFileType and injectType are called from many places.
        Hide
        Sebb added a comment -

        Sorry, don't know what happened there - you're right, wrong class. Reopening with new details

        Show
        Sebb added a comment - Sorry, don't know what happened there - you're right, wrong class. Reopening with new details
        Hide
        Ralph Goers added a comment -

        AbstractFileObject and classes that extend it now take an AbstractFileName instead of a FileName. This also applies to the FileSystem and FileProvider.

        Show
        Ralph Goers added a comment - AbstractFileObject and classes that extend it now take an AbstractFileName instead of a FileName. This also applies to the FileSystem and FileProvider.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sebb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development