use try-with-resources

This commit is contained in:
Unpublished
2019-02-22 16:59:23 +01:00
parent 72dcc50ea1
commit 0edc7a8629
16 changed files with 117 additions and 316 deletions

View File

@@ -616,8 +616,7 @@ public class FragmentIdentity extends FragmentBase {
// Create transport
String protocol = (starttls ? "smtp" : "smtps");
Transport itransport = isession.getTransport(protocol);
try {
try (Transport itransport = isession.getTransport(protocol)) {
try {
itransport.connect(host, Integer.parseInt(port), user, password);
} catch (AuthenticationFailedException ex) {
@@ -627,8 +626,6 @@ public class FragmentIdentity extends FragmentBase {
} else
throw ex;
}
} finally {
itransport.close();
}
}