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

Add API VFS.setManager(FileSystemManager)

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Labels:
      None

      Description

      Add API VFS.setManager(FileSystemManager).

      Initialize VFS with the right class loader for OSGi types of scenarios to work. Must be called before any VFS APIs are called.

      Instead of:

              final StandardFileSystemManager fsm = new StandardFileSystemManager();
              final ClassLoader classLoader = fsm.getClass().getClassLoader();
              fsm.setClassLoader(classLoader);
              try {
                  FieldUtils.writeDeclaredStaticField(VFS.class, "instance", fsm, true);
                  fsm.init();
              } catch (final FileSystemException | IllegalAccessException e) {
                  ...
              }
      

      do:

              final StandardFileSystemManager fsm = new StandardFileSystemManager();
              final ClassLoader classLoader = fsm.getClass().getClassLoader();
              fsm.setClassLoader(classLoader);
              VFS.setManager(fsm);
              fsm.init();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ggregory Gary Gregory
                Reporter:
                ggregory Gary Gregory
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: