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 19:14:00 UTC
[jira] [Commented] (BCEL-376) ClassPath.close() throws UnsupportedOperationException when created with system-classpath
[ https://issues.apache.org/jira/browse/BCEL-376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17925005#comment-17925005 ]
Dominik Stadler commented on BCEL-376:
--------------------------------------
Thanks for the quick fix, I verified with the latest snapshot that it works now.
> 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
> Assignee: Gary D. Gregory
> Priority: Major
> Fix For: 6.11.0
>
>
> 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)