Fix compiler warning by using try-with-resources. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/47e899db Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/47e899db Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/47e899db
Branch: refs/heads/LOG4J-1181 Commit: 47e899dbbe905d453610316b506df70c26a44792 Parents: 71c863d Author: ggregory <ggreg...@apache.org> Authored: Tue Nov 3 10:55:53 2015 -0800 Committer: ggregory <ggreg...@apache.org> Committed: Tue Nov 3 10:55:53 2015 -0800 ---------------------------------------------------------------------- .../logging/log4j/core/net/ssl/SslConfigurationTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/47e899db/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/SslConfigurationTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/SslConfigurationTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/SslConfigurationTest.java index 5283535..6e5773c 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/SslConfigurationTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/net/ssl/SslConfigurationTest.java @@ -40,9 +40,10 @@ public class SslConfigurationTest { public void emptyConfigurationHasDefaultTrustStore() throws IOException { final SslConfiguration sc = SslConfiguration.createSSLConfiguration(null, null, null); final SSLSocketFactory factory = sc.getSslSocketFactory(); - final SSLSocket clientSocket = (SSLSocket) factory.createSocket(TLS_TEST_HOST, TLS_TEST_PORT); - clientSocket.close(); - Assert.assertNotNull(clientSocket); + try (final SSLSocket clientSocket = (SSLSocket) factory.createSocket(TLS_TEST_HOST, TLS_TEST_PORT)) { + Assert.assertNotNull(clientSocket); + clientSocket.close(); + } } @Test