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

Add API VFS.setManager(FileSystemManager)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.2
    • 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

              ggregory Gary D. Gregory
              ggregory Gary D. Gregory
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: