This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new 96a719501 Use try-with for resource in test HttpServer (#1521) (#1686)
96a719501 is described below
commit 96a719501da482b7f74950ac7c9d4f1465b7e52e
Author: Mārtiņš Avots <[email protected]>
AuthorDate: Thu Nov 27 11:58:47 2025 +0100
Use try-with for resource in test HttpServer (#1521) (#1686)
---
.../eclipse/aether/internal/test/util/http/HttpServer.java | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git
a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpServer.java
b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpServer.java
index dd938040d..26928b071 100644
---
a/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpServer.java
+++
b/maven-resolver-test-http/src/main/java/org/eclipse/aether/internal/test/util/http/HttpServer.java
@@ -424,9 +424,7 @@ public class HttpServer {
if (HttpMethod.HEAD.is(req.getMethod())) {
return;
}
- FileInputStream is = null;
- try {
- is = new FileInputStream(file);
+ try (FileInputStream is = new FileInputStream(file)) {
if (offset > 0L) {
long skipped = is.skip(offset);
while (skipped < offset && is.read() >= 0) {
@@ -434,16 +432,6 @@ public class HttpServer {
}
}
IO.copy(is, response.getOutputStream());
- is.close();
- is = null;
- } finally {
- try {
- if (is != null) {
- is.close();
- }
- } catch (final IOException e) {
- // Suppressed due to an exception already thrown in
the try block.
- }
}
} else if (HttpMethod.PUT.is(req.getMethod())) {
if (!webDav) {