You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dominik Stadler (Jira)" <ji...@apache.org> on 2025/02/07 07:03:00 UTC

[jira] [Created] (BCEL-376) ClassPath.close() throws UnsupportedOperationException when created with system-classpath

Dominik Stadler created BCEL-376:
------------------------------------

             Summary: ClassPath.close() throws UnsupportedOperationException when created with system-classpath
                 Key: BCEL-376
                 URL: https://issues.apache.org/jira/browse/BCEL-376
             Project: Commons BCEL
          Issue Type: Bug
          Components: Parser
    Affects Versions: 6.10.0
            Reporter: Dominik Stadler


When instantiating {{ClassPath}} with {{{}ClassPath.getClassPath(){}}}, a {{UnsupportOperationException}} is thrown:
{code:java}
java.lang.UnsupportedOperationException
    at java.base/jdk.internal.jrtfs.JrtFileSystem.close(JrtFileSystem.java:104)
    at org.apache.bcel.util.ModularRuntimeImage.close(ModularRuntimeImage.java:83)
    at org.apache.bcel.util.ClassPath$JrtModules.close(ClassPath.java:373)
    at org.apache.bcel.util.ClassPath.close(ClassPath.java:576)
    at TestBCEL.testClose(TestBCEL.java:35){code}
 

The following test-case can be used to reproduce this:

 
{code:java}
    @Test
    void testClose() throws IOException {
        try (ClassPath cp = new ClassPath(ClassPath.getClassPath())) {
            assertNotNull(cp);
        }
    } {code}
 

It seems some Java filesystems will throw this, maybe the exception needs to be caught and ignored in {{{}ClassPath$JrtModules.close(){}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)