1
0
mirror of synced 2026-08-04 01:07:02 +00:00

Use try-with-resources instead of try-finally

This commit is contained in:
Lars Grefer
2019-08-06 00:50:47 +02:00
committed by Rob Winch
parent a17d66463d
commit f5cd0ec302
3 changed files with 4 additions and 32 deletions
@@ -99,17 +99,8 @@ public class LdapServerBeanDefinitionParserTests {
}
private int getDefaultPort() throws IOException {
ServerSocket server = null;
try {
server = new ServerSocket(0);
try (ServerSocket server = new ServerSocket(0)) {
return server.getLocalPort();
}
finally {
try {
server.close();
}
catch (IOException e) {
}
}
}
}