jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java
changeset 10336 0bb1999251f8
parent 9246 c459f79af46b
child 10917 becbe249e46b
--- a/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Mon Aug 15 12:56:01 2011 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/SSLEngineImpl.java	Mon Aug 15 11:48:20 2011 -0700
@@ -27,8 +27,6 @@
 
 import java.io.*;
 import java.nio.*;
-import java.nio.ReadOnlyBufferException;
-import java.util.LinkedList;
 import java.security.*;
 
 import javax.crypto.BadPaddingException;
@@ -36,7 +34,6 @@
 import javax.net.ssl.*;
 import javax.net.ssl.SSLEngineResult.*;
 
-import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
 
 /**
  * Implementation of an non-blocking SSLEngine.
@@ -574,8 +571,7 @@
             readMAC = handshaker.newReadMAC();
         } catch (GeneralSecurityException e) {
             // "can't happen"
-            throw (SSLException)new SSLException
-                                ("Algorithm missing:  ").initCause(e);
+            throw new SSLException("Algorithm missing:  ", e);
         }
 
         /*
@@ -611,8 +607,7 @@
             writeMAC = handshaker.newWriteMAC();
         } catch (GeneralSecurityException e) {
             // "can't happen"
-            throw (SSLException)new SSLException
-                                ("Algorithm missing:  ").initCause(e);
+            throw new SSLException("Algorithm missing:  ", e);
         }
 
         // See comment above.
@@ -877,9 +872,7 @@
         } catch (SSLException e) {
             throw e;
         } catch (IOException e) {
-            SSLException ex = new SSLException("readRecord");
-            ex.initCause(e);
-            throw ex;
+            throw new SSLException("readRecord", e);
         }
 
         /*
@@ -1151,7 +1144,7 @@
          * For now, force it to be large enough to handle any
          * valid SSL/TLS record.
          */
-        if (netData.remaining() < outputRecord.maxRecordSize) {
+        if (netData.remaining() < EngineOutputRecord.maxRecordSize) {
             return new SSLEngineResult(
                 Status.BUFFER_OVERFLOW, getHSStatus(null), 0, 0);
         }
@@ -1248,9 +1241,7 @@
         } catch (SSLException e) {
             throw e;
         } catch (IOException e) {
-            SSLException ex = new SSLException("Write problems");
-            ex.initCause(e);
-            throw ex;
+            throw new SSLException("Write problems", e);
         }
 
         /*
@@ -1624,10 +1615,7 @@
             } else if (cause instanceof SSLException) {
                 throw (SSLException)cause;
             } else if (cause instanceof Exception) {
-                SSLException ssle = new SSLException(
-                    "fatal SSLEngine condition");
-                ssle.initCause(cause);
-                throw ssle;
+                throw new SSLException("fatal SSLEngine condition", cause);
             }
         }
 
@@ -1875,6 +1863,7 @@
      * client or server mode.  Must be called before any SSL
      * traffic has started.
      */
+    @SuppressWarnings("fallthrough")
     synchronized public void setUseClientMode(boolean flag) {
         switch (connectionState) {