Skip to content

Commit f458ae9

Browse files
committed
Merge pull request #52803 from ShakilUrRehman21
Closes gh-52803 * pr/52803: Avoid premature close of cached connection in JarUrlClassLoader
2 parents af1aa21 + 9266c23 commit f458ae9

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

  • loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar

‎loader/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/JarUrlClassLoader.java‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,8 @@ private boolean hasEntry(JarFile jarFile, String name) {
221221
}
222222

223223
private Connection connect(URL url) {
224-
Connection connection = this.connections.computeIfPresent(url, (key, existing) -> existing.open());
225-
return (connection != null) ? connection : createAndConnect(url);
226-
}
227-
228-
private Connection createAndConnect(URL url) {
229-
Connection connection = Connection.create(url);
230224
return this.connections.compute(url, (key, existing) -> {
231-
Connection.closeIfNotNull(existing);
225+
Connection connection = (existing != null) ? existing : Connection.create(url);
232226
return connection.open();
233227
});
234228
}

0 commit comments

Comments
 (0)