You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2022/07/06 14:56:10 UTC
[httpcomponents-client] branch master updated: Use try-with-resources
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
The following commit(s) were added to refs/heads/master by this push:
new dca910835 Use try-with-resources
dca910835 is described below
commit dca91083522269128bb9e4eb3e22f322677d8dca
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jul 6 10:56:04 2022 -0400
Use try-with-resources
---
.../org/apache/hc/client5/http/impl/cache/BasicIdGenerator.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicIdGenerator.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicIdGenerator.java
index c49a36aed..928c4f37f 100644
--- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicIdGenerator.java
+++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicIdGenerator.java
@@ -65,9 +65,9 @@ class BasicIdGenerator {
final int rndnum = this.rnd.nextInt();
buffer.append(System.currentTimeMillis());
buffer.append('.');
- final Formatter formatter = new Formatter(buffer, Locale.ROOT);
- formatter.format("%1$016x-%2$08x", this.count, rndnum);
- formatter.close();
+ try (Formatter formatter = new Formatter(buffer, Locale.ROOT)) {
+ formatter.format("%1$016x-%2$08x", this.count, rndnum);
+ }
buffer.append('.');
buffer.append(this.hostname);
}