Author: remm
Date: Fri Apr 22 12:27:02 2016
New Revision: 1740496

URL: http://svn.apache.org/viewvc?rev=1740496&view=rev
Log:
Trivial cleanup

Modified:
    tomcat/tc8.5.x/trunk/   (props changed)
    
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java

Propchange: tomcat/tc8.5.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Apr 22 12:27:02 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495

Modified: 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java?rev=1740496&r1=1740495&r2=1740496&view=diff
==============================================================================
--- 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 
(original)
+++ 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/openssl/OpenSSLEngine.java 
Fri Apr 22 12:27:02 2016
@@ -217,7 +217,7 @@ public final class OpenSSLEngine extends
     }
 
     /**
-     * Write plaintext data to the OpenSSL internal BIO
+     * Write plain text data to the OpenSSL internal BIO
      *
      * Calling this function with src.remaining == 0 is undefined.
      */
@@ -298,7 +298,7 @@ public final class OpenSSLEngine extends
     }
 
     /**
-     * Read plaintext data from the OpenSSL internal BIO
+     * Read plain text data from the OpenSSL internal BIO
      */
     private int readPlaintextData(final ByteBuffer dst) {
         if (dst.isDirect()) {
@@ -379,19 +379,14 @@ public final class OpenSSLEngine extends
         }
 
         // Throw required runtime exceptions
-        if (srcs == null) {
+        if (srcs == null || dst == null) {
             throw new 
IllegalArgumentException(sm.getString("engine.nullBuffer"));
         }
-        if (dst == null) {
-            throw new 
IllegalArgumentException(sm.getString("engine.nullBuffer"));
-        }
-
         if (offset >= srcs.length || offset + length > srcs.length) {
             throw new 
IndexOutOfBoundsException(sm.getString("engine.invalidBufferArray",
                     Integer.toString(offset), Integer.toString(length),
                     Integer.toString(srcs.length)));
         }
-
         if (dst.isReadOnly()) {
             throw new ReadOnlyBufferException();
         }
@@ -415,7 +410,7 @@ public final class OpenSSLEngine extends
         // Check for pending data in the network BIO
         pendingNet = SSL.pendingWrittenBytesInBIO(networkBIO);
         if (pendingNet > 0) {
-            // Do we have enough room in dst to write encrypted data?
+            // Do we have enough room in destination to write encrypted data?
             int capacity = dst.remaining();
             if (capacity < pendingNet) {
                 return new 
SSLEngineResult(SSLEngineResult.Status.BUFFER_OVERFLOW, handshakeStatus, 0, 0);
@@ -448,7 +443,7 @@ public final class OpenSSLEngine extends
             }
             while (src.hasRemaining()) {
 
-                // Write plaintext application data to the SSL engine
+                // Write plain text application data to the SSL engine
                 try {
                     bytesConsumed += writePlaintextData(src);
                 } catch (Exception e) {
@@ -486,11 +481,8 @@ public final class OpenSSLEngine extends
             return new SSLEngineResult(SSLEngineResult.Status.CLOSED, 
SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING, 0, 0);
         }
 
-        // Throw requried runtime exceptions
-        if (src == null) {
-            throw new 
IllegalArgumentException(sm.getString("engine.nullBuffer"));
-        }
-        if (dsts == null) {
+        // Throw required runtime exceptions
+        if (src == null || dsts == null) {
             throw new 
IllegalArgumentException(sm.getString("engine.nullBuffer"));
         }
         if (offset >= dsts.length || offset + length > dsts.length) {
@@ -498,7 +490,6 @@ public final class OpenSSLEngine extends
                     Integer.toString(offset), Integer.toString(length),
                     Integer.toString(dsts.length)));
         }
-
         int capacity = 0;
         final int endOffset = offset + length;
         for (int i = offset; i < endOffset; i++) {
@@ -744,7 +735,7 @@ public final class OpenSSLEngine extends
     @Override
     public String[] getEnabledProtocols() {
         List<String> enabled = new ArrayList<>();
-        // Seems like there is no way to explict disable SSLv2Hello in openssl 
so it is always enabled
+        // Seems like there is no way to explicitly disable SSLv2Hello in 
OpenSSL so it is always enabled
         enabled.add(Constants.SSL_PROTO_SSLv2Hello);
         int opts = SSL.getOptions(ssl);
         if ((opts & SSL.SSL_OP_NO_TLSv1) == 0) {
@@ -1066,7 +1057,7 @@ public final class OpenSSLEngine extends
 
         @Override
         public long getCreationTime() {
-            // We need ot multiple by 1000 as openssl uses seconds and we need 
milli-seconds.
+            // We need to multiply by 1000 as OpenSSL uses seconds and we need 
milliseconds.
             return SSL.getTime(ssl) * 1000L;
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to