Skip to content

Commit

Permalink
Disable URL connection caching in SPIClassIterator (elastic#88586)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty authored and arteam committed Jul 22, 2022
1 parent 78ccd47 commit 233e391
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/changelog/88586.yaml
@@ -0,0 +1,6 @@
pr: 88586
summary: Disable URL connection caching in SPIClassIterator
area: Infra/Plugins
type: bug
issues:
- 88275
Expand Up @@ -26,6 +26,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -106,7 +107,9 @@ private boolean loadNextProfile() {
}
final URL url = profilesEnum.nextElement();
try {
final InputStream in = url.openStream();
URLConnection urlc = url.openConnection();
urlc.setUseCaches(false); // prevents retaining a handle to the underlying jar file, when the stream is closed
final InputStream in = urlc.getInputStream();
boolean success = false;
try {
final BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
Expand Down

0 comments on commit 233e391

Please sign in to comment.