Skip to content

Fix JarFile leak in PackageScanner#getClasses#1415

Open
iamsanjaymalakar wants to merge 1 commit intowicketstuff:masterfrom
iamsanjaymalakar:master
Open

Fix JarFile leak in PackageScanner#getClasses#1415
iamsanjaymalakar wants to merge 1 commit intowicketstuff:masterfrom
iamsanjaymalakar:master

Conversation

@iamsanjaymalakar
Copy link

Problem

PackageScanner#getClasses() opens JarFile instances when scanning "jar"/"wsjar" resources but never closes them. If scanning or class loading throws, the opened JARs are also left unclosed.

Fix

Close all opened JarFiles in a finally block. The cleanup continues closing remaining JARs even if one close fails, and rethrows the first IOException with subsequent failures added as suppressed exceptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant