Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid file leak in JavaSPIExtensionLoader #637

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Collection;
import java.util.Enumeration;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -166,7 +167,11 @@ private <T> Set<Class<? extends T>> load(Class<T> serviceClass, ClassLoader load
Enumeration<URL> enumeration = loader.getResources(serviceFile);
while (enumeration.hasMoreElements()) {
final URL url = enumeration.nextElement();
final InputStream is = url.openStream();
URLConnection jarConnection = url.openConnection();
// Avoid caching the file; in combination with Windows OS, this can cause file leaks on some EE servers (GlassFish)
// See https://github.com/arquillian/arquillian-core/pull/637 for more details
jarConnection.setUseCaches(false);
final InputStream is = jarConnection.getInputStream();
BufferedReader reader = null;

try {
Expand Down