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

[WELD-2800] Don't use jar cache in ServiceLoader.loadServiceFile #3080

Merged
merged 2 commits into from
Nov 5, 2024
Merged
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
7 changes: 6 additions & 1 deletion impl/src/main/java/org/jboss/weld/util/ServiceLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
Expand Down Expand Up @@ -171,7 +172,11 @@ private List<URL> loadServiceFiles() {
private void loadServiceFile(URL serviceFile) {
InputStream is = null;
try {
is = serviceFile.openStream();
URLConnection jarConnection = serviceFile.openConnection();
//Don't cache the file; in combination with Windows OS, this can cause file leaks on some EE servers (GlassFish)
// See WELD-2800 for more details
jarConnection.setUseCaches(false);
is = jarConnection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String serviceClassName = null;
int i = 0;
Expand Down
Loading