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

VfsClassLoaderTests and JarProviderTestCase fails on Java 9 and up

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds, 2.1, 2.2
    • Fix Version/s: 2.3
    • Labels:
      None
    • Environment:

      Description

      Running the build with Oracle Java 9 on Windows 10 fails. The same failures happen with version 2.1.

      Tests run: 84, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 4.01 sec <<< FAILURE! - in org.apache.commons.vfs2.provider.jar.test.NestedJarTestCase
      testSealing(org.apache.commons.vfs2.impl.test.VfsClassLoaderTests)  Time elapsed: 0 sec  <<< ERROR!
      java.lang.ClassNotFoundException: code.sealed.AnotherClass
              at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:152)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
              at org.apache.commons.vfs2.impl.test.VfsClassLoaderTests.testSealing(VfsClassLoaderTests.java:88)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:564)
              at org.apache.commons.vfs2.test.AbstractProviderTestCase.runTest(AbstractProviderTestCase.java:190)
              at junit.framework.TestCase.runBare(TestCase.java:141)
              at junit.framework.TestResult$1.protect(TestResult.java:122)
              at junit.framework.TestResult.runProtected(TestResult.java:142)
              at junit.framework.TestResult.run(TestResult.java:125)
              at junit.framework.TestCase.run(TestCase.java:129)
              at junit.framework.TestSuite.runTest(TestSuite.java:252)
              at junit.framework.TestSuite.run(TestSuite.java:247)
              at junit.extensions.TestDecorator.basicRun(TestDecorator.java:23)
              at org.apache.commons.vfs2.test.AbstractTestSuite$1.protect(AbstractTestSuite.java:132)
              at junit.framework.TestResult.runProtected(TestResult.java:142)
              at org.apache.commons.vfs2.test.AbstractTestSuite.run(AbstractTestSuite.java:137)
              at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
      Caused by: org.apache.commons.vfs2.FileSystemException: Could not retrieve the certificates of "jar:jar:file:///C:/vcs/svn/apache/commons/trunks-proper/vfs/commons-vfs2/target/test-classes/test-data/nested.jar!/test.jar!/code/sealed/AnotherClass.class".
              at org.apache.commons.vfs2.provider.DefaultFileContent.getCertificates(DefaultFileContent.java:331)
              at org.apache.commons.vfs2.impl.VFSClassLoader.defineClass(VFSClassLoader.java:180)
              at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:150)
              ... 27 more
      Caused by: java.lang.IllegalStateException: zip file closed
              at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:664)
              at java.base/java.util.zip.ZipFile.getInputStream(ZipFile.java:334)
              at java.base/java.util.jar.JarFile.getBytes(JarFile.java:761)
              at java.base/java.util.jar.JarFile.checkForSpecialAttributes(JarFile.java:970)
              at java.base/java.util.jar.JarFile.isMultiRelease(JarFile.java:366)
              at java.base/java.util.jar.JarFile$JarFileEntry.realEntry(JarFile.java:642)
              at java.base/java.util.jar.JarFile$JarFileEntry.getCertificates(JarFile.java:626)
              at org.apache.commons.vfs2.provider.jar.JarFileObject.doGetCertificates(JarFileObject.java:120)
              at org.apache.commons.vfs2.provider.DefaultFileContent.getCertificates(DefaultFileContent.java:325)
              ... 29 more
      
      testLoadClass(org.apache.commons.vfs2.impl.test.VfsClassLoaderTests)  Time elapsed: 0 sec  <<< ERROR!
      java.lang.ClassNotFoundException: code.ClassToLoad
              at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:152)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
              at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
              at org.apache.commons.vfs2.impl.test.VfsClassLoaderTests.testLoadClass(VfsClassLoaderTests.java:61)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:564)
              at org.apache.commons.vfs2.test.AbstractProviderTestCase.runTest(AbstractProviderTestCase.java:190)
              at junit.framework.TestCase.runBare(TestCase.java:141)
              at junit.framework.TestResult$1.protect(TestResult.java:122)
              at junit.framework.TestResult.runProtected(TestResult.java:142)
              at junit.framework.TestResult.run(TestResult.java:125)
              at junit.framework.TestCase.run(TestCase.java:129)
              at junit.framework.TestSuite.runTest(TestSuite.java:252)
              at junit.framework.TestSuite.run(TestSuite.java:247)
              at junit.extensions.TestDecorator.basicRun(TestDecorator.java:23)
              at org.apache.commons.vfs2.test.AbstractTestSuite$1.protect(AbstractTestSuite.java:132)
              at junit.framework.TestResult.runProtected(TestResult.java:142)
              at org.apache.commons.vfs2.test.AbstractTestSuite.run(AbstractTestSuite.java:137)
              at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
              at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
      Caused by: org.apache.commons.vfs2.FileSystemException: Could not retrieve the certificates of "jar:jar:file:///C:/vcs/svn/apache/commons/trunks-proper/vfs/commons-vfs2/target/test-classes/test-data/nested.jar!/test.jar!/code/ClassToLoad.class".
              at org.apache.commons.vfs2.provider.DefaultFileContent.getCertificates(DefaultFileContent.java:331)
              at org.apache.commons.vfs2.impl.VFSClassLoader.defineClass(VFSClassLoader.java:180)
              at org.apache.commons.vfs2.impl.VFSClassLoader.findClass(VFSClassLoader.java:150)
              ... 27 more
      Caused by: java.lang.IllegalStateException: zip file closed
              at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:664)
              at java.base/java.util.zip.ZipFile.getInputStream(ZipFile.java:334)
              at java.base/java.util.jar.JarFile.getBytes(JarFile.java:761)
              at java.base/java.util.jar.JarFile.checkForSpecialAttributes(JarFile.java:970)
              at java.base/java.util.jar.JarFile.isMultiRelease(JarFile.java:366)
              at java.base/java.util.jar.JarFile$JarFileEntry.realEntry(JarFile.java:642)
              at java.base/java.util.jar.JarFile$JarFileEntry.getCertificates(JarFile.java:626)
              at org.apache.commons.vfs2.provider.jar.JarFileObject.doGetCertificates(JarFileObject.java:120)
              at org.apache.commons.vfs2.provider.DefaultFileContent.getCertificates(DefaultFileContent.java:325)
              ... 29 more
      

      Also, we get these warnings:

      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by org.apache.commons.vfs2.test.AbstractTestSuite (file:/C:/vcs/svn/apache/commons/trunks-proper/vfs/commons-vfs2/target/test-classes/) to field java.lang.Thread.target
      WARNING: Please consider reporting this to the maintainers of org.apache.commons.vfs2.test.AbstractTestSuite
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release
      

      We get the same kind of failures on Java 11 using:

      Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
      Maven home: C:\Java\apache-maven-3.6.0\bin\..
      Java version: 11.0.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.1
      Default locale: en_US, platform encoding: Cp1252
      OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
      

      The test org.apache.commons.vfs2.provider.jar.test.JarProviderTestCase also fails.

        Attachments

          Activity

            People

            • Assignee:
              ggregory Gary Gregory
              Reporter:
              ggregory Gary Gregory
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: