Skip to content

Commit

Permalink
Fix resource leak in RequestImplementationClassLoaderMatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mcculls committed Jun 4, 2024
1 parent 3ef9225 commit 22eb622
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ public static class RequestImplementationClassLoaderMatcher

@Override
protected boolean doMatch(ClassLoader cl) {
InputStream is = cl.getResourceAsStream("org/eclipse/jetty/server/Request.class");
if (is == null) {
return false;
}
try {
try (InputStream is = cl.getResourceAsStream("org/eclipse/jetty/server/Request.class")) {
if (is == null) {
return false;
}
ClassReader classReader = new ClassReader(is);
final boolean[] foundField = new boolean[1];
final boolean[] foundGetParameters = new boolean[1];
classReader.accept(new ClassLoaderMatcherClassVisitor(foundField, foundGetParameters), 0);
return !foundField[0] && foundGetParameters[0];

} catch (IOException e) {
return false;
}
Expand Down

0 comments on commit 22eb622

Please sign in to comment.