You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by od...@apache.org on 2010/09/06 18:09:03 UTC

svn commit: r993080 - /harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java

Author: odeakin
Date: Mon Sep  6 16:09:03 2010
New Revision: 993080

URL: http://svn.apache.org/viewvc?rev=993080&view=rev
Log:
Only get peer certs when SSL is not null.

Modified:
    harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java

Modified: harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java?rev=993080&r1=993079&r2=993080&view=diff
==============================================================================
--- harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java (original)
+++ harmony/enhanced/java/branches/omd/classlib/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLSessionImpl.java Mon Sep  6 16:09:03 2010
@@ -228,30 +228,30 @@ public class SSLSessionImpl implements S
                 peerPort = socket.getPort();
                 peerHost = socket.getInetAddress().getHostName();
             }
-        }
 
-        lastAccessedTime = creationTime;
-        localCertificates = parms.getCertificateChain();
-
-        // Get the list of DER encoded peer certificates from OpenSSL
-        Object[] DERCerts = getPeerCertificatesImpl(SSL);
-        if (DERCerts != null) {
-            // If we have got an array of DER certificates, generate X509Certificates from them
-            CertificateFactory cf;
-            try {
-                cf = CertificateFactory.getInstance("X.509");
-            } catch (CertificateException e) {
-                throw new Error(e);
-            }
-            peerCertificates = new X509Certificate[DERCerts.length];
-            for (int i=0; i<peerCertificates.length; i++) {
+            // Get the list of DER encoded peer certificates from OpenSSL
+            Object[] DERCerts = getPeerCertificatesImpl(SSL);
+            if (DERCerts != null) {
+                // If we have got an array of DER certificates, generate X509Certificates from them
+                CertificateFactory cf;
                 try {
-                    peerCertificates[i] = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream((byte[])DERCerts[i]));
+                    cf = CertificateFactory.getInstance("X.509");
                 } catch (CertificateException e) {
-                    // Do nothing
+                    throw new Error(e);
+                }
+                peerCertificates = new X509Certificate[DERCerts.length];
+                for (int i=0; i<peerCertificates.length; i++) {
+                    try {
+                        peerCertificates[i] = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream((byte[])DERCerts[i]));
+                    } catch (CertificateException e) {
+                        // Do nothing
+                    }
                 }
             }
         }
+
+        lastAccessedTime = creationTime;
+        localCertificates = parms.getCertificateChain();
     }
 
     public int getApplicationBufferSize() {