Use try-with-resources
This commit is contained in:
parent
1cd12fc1dc
commit
dca9108352
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue