You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2016/12/27 18:46:51 UTC

svn commit: r1776184 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java

Author: fschumacher
Date: Tue Dec 27 18:46:51 2016
New Revision: 1776184

URL: http://svn.apache.org/viewvc?rev=1776184&view=rev
Log:
Use try-with statement.

Modified:
    jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java?rev=1776184&r1=1776183&r2=1776184&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java (original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/LocalTrustStoreSSLSocketFactory.java Tue Dec 27 18:46:51 2016
@@ -46,12 +46,9 @@ public class LocalTrustStoreSSLSocketFac
         SSLContext sslcontext = null;
         try {
             KeyStore ks = KeyStore.getInstance("JKS"); // $NON-NLS-1$
-            InputStream stream = null;
-            try {
-                stream = new BufferedInputStream(new FileInputStream(truststore));
+            try (FileInputStream fileStream = new FileInputStream(truststore);
+                    InputStream stream = new BufferedInputStream(fileStream)) {
                 ks.load(stream, null);
-            } finally {
-                IOUtils.closeQuietly(stream);
             }
 
             TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());