TrueZIP
  1. TrueZIP
  2. TRUEZIP-318

KeyManagerLocator in truezip-driver-zip has runtime dependency on truezip-swing

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Won't Fix
    • Affects Version/s: TrueZIP 7.7.1
    • Fix Version/s: None
    • Component/s: TrueZIP Driver ZIP
    • Labels:
      None

      Description

      I'm building a non-swing project (http://github.com/hierynomus/scannit), which I wanted to upgrade to TrueZIP 7.7.1. However I now need to add truezip-swing as an extra dependency because it won't work otherwise. The stracktrace is:

      java.util.ServiceConfigurationError: de.schlichtherle.truezip.key.spi.KeyManagerService: Provider de.schlichtherle.truezip.fs.archive.zip.PromptingKeyManagerService could not be instantiated: java.lang.NoClassDefFoundError: de/schlichtherle/truezip/swing/EnhancedPanel
      	at java.util.ServiceLoader.fail(ServiceLoader.java:207) ~[na:1.6.0_37]
      	at java.util.ServiceLoader.access$100(ServiceLoader.java:164) ~[na:1.6.0_37]
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:360) ~[na:1.6.0_37]
      	at java.util.ServiceLoader$1.next(ServiceLoader.java:428) ~[na:1.6.0_37]
      	at de.schlichtherle.truezip.key.sl.KeyManagerLocator$Boot.<clinit>(KeyManagerLocator.java:60) ~[truezip-driver-zip-7.7.1.jar:na]
      	at de.schlichtherle.truezip.key.sl.KeyManagerLocator.get(KeyManagerLocator.java:41) ~[truezip-driver-zip-7.7.1.jar:na]
      	at de.schlichtherle.truezip.key.AbstractKeyManagerProvider.get(AbstractKeyManagerProvider.java:22) ~[truezip-driver-zip-7.7.1.jar:na]
      	at de.schlichtherle.truezip.fs.archive.zip.KeyController.getKeyManager(KeyController.java:62) ~[truezip-driver-zip-7.7.1.jar:na]
      	at de.schlichtherle.truezip.fs.archive.zip.KeyController.sync(KeyController.java:129) ~[truezip-driver-zip-7.7.1.jar:na]
      	at de.schlichtherle.truezip.fs.FsDecoratingController.sync(FsDecoratingController.java:131) ~[truezip-kernel-7.7.1.jar:na]
      	at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.sync(FsFalsePositiveArchiveController.java:480) ~[truezip-kernel-7.7.1.jar:na]
      	at de.schlichtherle.truezip.fs.FsManager.sync(FsManager.java:105) ~[truezip-kernel-7.7.1.jar:na]
      	at de.schlichtherle.truezip.file.TVFS.sync(TVFS.java:291) ~[truezip-file-7.7.1.jar:na]
      	at de.schlichtherle.truezip.file.TVFS.sync(TVFS.java:236) ~[truezip-file-7.7.1.jar:na]
      	at de.schlichtherle.truezip.file.TFile.sync(TFile.java:957) ~[truezip-file-7.7.1.jar:na]
      	at de.schlichtherle.truezip.file.TFile.umount(TFile.java:1005) ~[truezip-file-7.7.1.jar:na]
      	at nl.javadude.scannit.reader.TFiles.umountQuietly(TFiles.java:28) ~[scannit/:na]
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.closeTFile(ArchiveEntrySupplier.java:37) [scannit/:na]
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.gatherEntries(ArchiveEntrySupplier.java:72) [scannit/:na]
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.gatherEntries(ArchiveEntrySupplier.java:59) [scannit/:na]
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.list(ArchiveEntrySupplier.java:45) [scannit/:na]
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.withArchiveEntries(ArchiveEntrySupplier.java:25) [scannit/:na]
      	at nl.javadude.scannit.Worker.scanFiles(Worker.java:59) [scannit/:na]
      	at nl.javadude.scannit.Worker.scanURI(Worker.java:53) [scannit/:na]
      	at nl.javadude.scannit.Worker.scan(Worker.java:46) [scannit/:na]
      	at nl.javadude.scannit.Scannit.<init>(Scannit.java:40) [scannit/:na]
      	at nl.javadude.scannit.ScannitTest.init(ScannitTest.java:41) [scannit/:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
      	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-4.10.jar:na]
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na]
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-4.10.jar:na]
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [junit-4.10.jar:na]
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [junit-4.10.jar:na]
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
      	at org.junit.runners.Suite.runChild(Suite.java:128) [junit-4.10.jar:na]
      	at org.junit.runners.Suite.runChild(Suite.java:24) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [junit-4.10.jar:na]
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) [junit-rt.jar:na]
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) [junit-rt.jar:na]
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) [junit-rt.jar:na]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
      	at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) [idea_rt.jar:na]
      Caused by: java.lang.NoClassDefFoundError: de/schlichtherle/truezip/swing/EnhancedPanel
      	at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615) ~[na:1.6.0_37]
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[na:1.6.0_37]
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) ~[na:1.6.0_37]
      	at java.net.URLClassLoader.access$000(URLClassLoader.java:58) ~[na:1.6.0_37]
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:197) ~[na:1.6.0_37]
      	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_37]
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[na:1.6.0_37]
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_37]
      	at de.schlichtherle.truezip.fs.archive.zip.PromptingKeyManagerService.<init>(PromptingKeyManagerService.java:37) ~[truezip-driver-zip-7.7.1.jar:na]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.6.0_37]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) ~[na:1.6.0_37]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) ~[na:1.6.0_37]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:513) ~[na:1.6.0_37]
      	at java.lang.Class.newInstance0(Class.java:355) ~[na:1.6.0_37]
      	at java.lang.Class.newInstance(Class.java:308) ~[na:1.6.0_37]
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:356) ~[na:1.6.0_37]
      	... 58 common frames omitted
      Caused by: java.lang.ClassNotFoundException: de.schlichtherle.truezip.swing.EnhancedPanel
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:202) ~[na:1.6.0_37]
      	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_37]
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[na:1.6.0_37]
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) ~[na:1.6.0_37]
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_37]
      	... 78 common frames omitted
      

      After which the following stracktrace occurs which breaks things:

      java.lang.NoClassDefFoundError: Could not initialize class de.schlichtherle.truezip.key.sl.KeyManagerLocator$Boot
      	at de.schlichtherle.truezip.key.sl.KeyManagerLocator.get(KeyManagerLocator.java:41)
      	at de.schlichtherle.truezip.key.AbstractKeyManagerProvider.get(AbstractKeyManagerProvider.java:22)
      	at de.schlichtherle.truezip.fs.archive.zip.KeyController.getKeyManager(KeyController.java:62)
      	at de.schlichtherle.truezip.fs.archive.zip.KeyController.sync(KeyController.java:129)
      	at de.schlichtherle.truezip.fs.FsDecoratingController.sync(FsDecoratingController.java:131)
      	at de.schlichtherle.truezip.fs.FsFalsePositiveArchiveController.sync(FsFalsePositiveArchiveController.java:480)
      	at de.schlichtherle.truezip.fs.FsManager.sync(FsManager.java:105)
      	at de.schlichtherle.truezip.file.TVFS.sync(TVFS.java:291)
      	at de.schlichtherle.truezip.file.TVFS.sync(TVFS.java:236)
      	at de.schlichtherle.truezip.file.TFile.sync(TFile.java:957)
      	at de.schlichtherle.truezip.file.TFile.umount(TFile.java:1005)
      	at nl.javadude.scannit.reader.TFiles.umountQuietly(TFiles.java:28)
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.closeTFile(ArchiveEntrySupplier.java:37)
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.gatherEntries(ArchiveEntrySupplier.java:72)
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.gatherEntries(ArchiveEntrySupplier.java:59)
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.list(ArchiveEntrySupplier.java:45)
      	at nl.javadude.scannit.reader.ArchiveEntrySupplier.withArchiveEntries(ArchiveEntrySupplier.java:25)
      	at nl.javadude.scannit.Worker.scanFiles(Worker.java:59)
      	at nl.javadude.scannit.Worker.scanURI(Worker.java:53)
      	at nl.javadude.scannit.Worker.scan(Worker.java:46)
      	at nl.javadude.scannit.Scannit.<init>(Scannit.java:40)
      	at nl.javadude.scannit.ScannitTest.init(ScannitTest.java:41)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:24)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      

      I think the dependency on truezip-swing is unneeded, or its absence should not trigger failures.

        Activity

        Hide
        Christian Schlichtherle added a comment -

        I agree this is a bit nasty, but there is a trivial workaround - just include the TrueZIP Swing module. It won't get used until there's really a need to.

        If you absolutely can't tolerate this, please consider upgrading to TrueVFS. The module structure in TrueZIP is a bit flawed. This has been fixed in TrueVFS. Unfortunately, I can't fix it in TrueZIP without breaking binary compatibility and even then the result would be mirrored in TrueVFS.

        Show
        Christian Schlichtherle added a comment - I agree this is a bit nasty, but there is a trivial workaround - just include the TrueZIP Swing module. It won't get used until there's really a need to. If you absolutely can't tolerate this, please consider upgrading to TrueVFS. The module structure in TrueZIP is a bit flawed. This has been fixed in TrueVFS. Unfortunately, I can't fix it in TrueZIP without breaking binary compatibility and even then the result would be mirrored in TrueVFS.
        Hide
        Christian Schlichtherle added a comment -

        If you are afraid that users could get prompted for a password with a Swing dialog, then you could implement your own key management by following this tutorial: http://truezip.java.net/truezip-driver/truezip-driver-zip/key-management.html

        Show
        Christian Schlichtherle added a comment - If you are afraid that users could get prompted for a password with a Swing dialog, then you could implement your own key management by following this tutorial: http://truezip.java.net/truezip-driver/truezip-driver-zip/key-management.html

          People

          • Assignee:
            Christian Schlichtherle
            Reporter:
            jvanerp
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: