jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1379938 - /jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/TrustAllSSLSocketFactory.java
Date Sun, 02 Sep 2012 10:41:34 GMT
Author: sebb
Date: Sun Sep  2 10:41:34 2012
New Revision: 1379938

URL: http://svn.apache.org/viewvc?rev=1379938&view=rev
Log:
Simplify

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

Modified: jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/TrustAllSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/TrustAllSSLSocketFactory.java?rev=1379938&r1=1379937&r2=1379938&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/TrustAllSSLSocketFactory.java
(original)
+++ jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/TrustAllSSLSocketFactory.java
Sun Sep  2 10:41:34 2012
@@ -21,6 +21,7 @@ package org.apache.jmeter.protocol.smtp.
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.Socket;
+import java.security.cert.X509Certificate;
 
 import javax.net.SocketFactory;
 import javax.net.ssl.SSLContext;
@@ -35,6 +36,9 @@ import javax.net.ssl.X509TrustManager;
 public class TrustAllSSLSocketFactory extends SSLSocketFactory  {
 
     private final SSLSocketFactory factory;
+    
+    // Empty arrays are immutable
+    private static final X509Certificate[] EMPTY_X509Certificate = new X509Certificate[0];
 
     /**
      * Standard constructor
@@ -45,14 +49,14 @@ public class TrustAllSSLSocketFactory ex
             sslcontext = SSLContext.getInstance("TLS"); // $NON-NLS-1$
             sslcontext.init( null, new TrustManager[]{
                     new X509TrustManager() {
-                        public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
-                            return new java.security.cert.X509Certificate[0];
+                        public X509Certificate[] getAcceptedIssuers() {
+                            return EMPTY_X509Certificate;
                         }
                         public void checkClientTrusted(
-                                java.security.cert.X509Certificate[] certs, String authType)
{
+                                X509Certificate[] certs, String authType) {
                         }
                         public void checkServerTrusted(
-                                java.security.cert.X509Certificate[] certs, String authType)
{
+                                X509Certificate[] certs, String authType) {
                         }
                     }
                 },



Mime
View raw message