harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r727683 [9/11] - in /harmony/enhanced/classlib/branches/java6: ./ doc/ make/ modules/accessibility/src/main/java/javax/accessibility/ modules/archive/src/main/java/java/util/jar/ modules/archive/src/main/java/java/util/zip/ modules/archive/...
Date Thu, 18 Dec 2008 09:46:26 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/TrustManagerFactorySpi.java Thu Dec 18 01:46:12 2008
@@ -15,46 +15,22 @@
  *  limitations under the License.
  */
 
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.security.InvalidAlgorithmParameterException;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
-
 public abstract class TrustManagerFactorySpi {
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
+
     public TrustManagerFactorySpi() {
+        super();
     }
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     protected abstract void engineInit(KeyStore ks) throws KeyStoreException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     protected abstract void engineInit(ManagerFactoryParameters spec)
             throws InvalidAlgorithmParameterException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     protected abstract TrustManager[] engineGetTrustManagers();
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509ExtendedKeyManager.java Thu Dec 18 01:46:12 2008
@@ -15,32 +15,22 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris V. Kuznetsov
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.security.Principal;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public abstract class X509ExtendedKeyManager implements X509KeyManager {
+
     protected X509ExtendedKeyManager() {
         super();
     }
 
-    public String chooseEngineClientAlias(String[] keyType,
-            Principal[] issuers, SSLEngine engine) {
+    public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) {
         return null;
     }
 
-    public String chooseEngineServerAlias(String keyType, Principal[] issuers,
-            SSLEngine engine) {
+    public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
         return null;
     }
 
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509KeyManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509KeyManager.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509KeyManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509KeyManager.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.net.Socket;
@@ -27,47 +22,17 @@
 import java.security.PrivateKey;
 import java.security.cert.X509Certificate;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public interface X509KeyManager extends KeyManager {
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public String chooseClientAlias(String[] keyType, Principal[] issuers,
-            Socket socket);
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
-    public String chooseServerAlias(String keyType, Principal[] issuers,
-            Socket socket);
-
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
+    public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket);
+
+    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket);
+
     public X509Certificate[] getCertificateChain(String alias);
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public String[] getClientAliases(String keyType, Principal[] issuers);
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public String[] getServerAliases(String keyType, Principal[] issuers);
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public PrivateKey getPrivateKey(String alias);
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509TrustManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509TrustManager.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509TrustManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/javax/net/ssl/X509TrustManager.java Thu Dec 18 01:46:12 2008
@@ -15,39 +15,18 @@
  *  limitations under the License.
  */
 
-/**
-* @author Vera Y. Petrashkova
-* @version $Revision$
-*/
-
 package javax.net.ssl;
 
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 
-/**
- * @com.intel.drl.spec_ref
- * 
- */
 public interface X509TrustManager extends TrustManager {
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public void checkClientTrusted(X509Certificate[] chain, String authType)
             throws CertificateException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public void checkServerTrusted(X509Certificate[] chain, String authType)
             throws CertificateException;
 
-    /**
-     * @com.intel.drl.spec_ref
-     *  
-     */
     public X509Certificate[] getAcceptedIssuers();
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertException.java Thu Dec 18 01:46:12 2008
@@ -15,21 +15,17 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import javax.net.ssl.SSLException;
 
 /**
- * This exception is used to signalize the fatal alert
- * occured during the work of protocol.
+ * This exception is used to signal that a fatal alert has occurred while working through the
+ * protocol.
  */
 public class AlertException extends RuntimeException {
 
+    private static final long serialVersionUID = -4448327177165687581L;
     // SSLException to be thrown to application side
     private final SSLException reason;
     // alert description code
@@ -37,11 +33,11 @@
 
     /**
      * Constructs the instance.
-     * @param   description:    The alert description code.
-     * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol
-     * @param   reason:  The SSLException to be thrown to application
-     * side after alert processing (sending the record with alert,
-     * shoutdown work, etc).
+     * 
+     * @param description The alert description code from {@link AlertProtocol}
+     * @param reason The SSLException to be thrown to application side after alert processing
+     *            (sending the record with alert, shutdown work, etc).
+     * @see AlertProtocol
      */
     protected AlertException(byte description, SSLException reason) {
         super(reason);
@@ -50,8 +46,8 @@
     }
 
     /**
-     * Returns the reason of alert. This reason should be rethrown
-     * after alert protcessin.
+     * Returns the reason of alert. This reason should be rethrown after alert processing.
+     * 
      * @return the reason of alert.
      */
     protected SSLException getReason() {
@@ -60,9 +56,9 @@
 
     /**
      * Returns alert's description code.
-     * @return byte value describing the occured alert.
-     * @see org.apache.harmony.xnet.provider.jsse.AlertProtocol for more information about possible
-     * reason codes.
+     * 
+     * @return alert description code from {@link AlertProtocol}
+     * @see AlertProtocol for more information about possible reason codes.
      */
     protected byte getDescriptionCode() {
         return description;

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/AlertProtocol.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.SSLRecordProtocol;
@@ -136,8 +131,6 @@
      * Defines the description code of the no_renegotiation alert
      */
     protected static final byte NO_RENEGOTIATION = 100;
-
-
     // holds level and description codes
     private final byte[] alert = new byte[2];
     // record protocol to be used to wrap the alerts
@@ -271,7 +264,7 @@
     /**
      * Returns the record with reported alert message.
      * The returned array of bytes is ready to be sent to another peer.
-     * Note, that this method does not automatically set the state of allert
+     * Note, that this method does not automatically set the state of alert
      * protocol in "no alert" state, so after wrapping the method setProcessed
      * should be called.
      */
@@ -281,7 +274,7 @@
     }
 
     /**
-     * Shutdownes the protocol. It will be impossiblke to use the instance
+     * Shutdown the protocol. It will be impossible to use the instance
      * after the calling of this method.
      */
     protected void shutdown() {

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Appendable.java Thu Dec 18 01:46:12 2008
@@ -15,24 +15,19 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 /**
- * This interface represents the ability of the input stream related
- * classes to provide additianal data to be read.
+ * This interface represents the ability of the input stream related classes to provide additional
+ * data to be read.
  */
 public interface Appendable {
 
     /**
      * Provides the additional data to be read.
-     * @param   src:  the source data to be appended.
+     * 
+     * @param src the source data to be appended.
      */
     public void append(byte[] src);
 
 }
-

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateMessage.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -28,6 +23,7 @@
 import org.apache.harmony.xnet.provider.jsse.AlertProtocol;
 
 import java.io.IOException;
+import java.security.cert.Certificate;
 import java.security.cert.CertificateEncodingException;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
@@ -35,7 +31,6 @@
 import java.util.Vector;
 
 /**
- * 
  * Represents server/client certificate message
  * @see TLS 1.0 spec., 7.4.2. Server certificate; 7.4.6. Client certificate
  * (http://www.ietf.org/rfc/rfc2246.txt)
@@ -80,7 +75,7 @@
             fatalAlert(AlertProtocol.INTERNAL_ERROR, "INTERNAL ERROR", e);
             return;
         }
-        Vector certs_vector = new Vector();
+        Vector<Certificate> certs_vector = new Vector<Certificate>();
         int size = 0;
         int enc_size = 0;
         while (l > 0) {
@@ -141,6 +136,7 @@
      * 
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
 
         int total_length = 0;
@@ -172,6 +168,7 @@
      * 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.CERTIFICATE;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateRequest.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -110,7 +105,7 @@
         certificate_authorities = new X500Principal[size];
         int totalPrincipalsLength = 0;
         int principalLength = 0;
-        Vector principals = new Vector();
+        Vector<X500Principal> principals = new Vector<X500Principal>();
         while (totalPrincipalsLength < size) {            
             principalLength = in.readUint16(); // encoded X500Principal size
             principals.add(new X500Principal(in));
@@ -119,7 +114,7 @@
         }
         certificate_authorities = new X500Principal[principals.size()];
         for (int i = 0; i < certificate_authorities.length; i++) {
-            certificate_authorities[i] = (X500Principal) principals.elementAt(i);
+            certificate_authorities[i] = principals.elementAt(i);
         }
         this.length = 3 + certificate_types.length + totalPrincipalsLength;
         if (this.length != length) {
@@ -134,6 +129,7 @@
      * 
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
 
         out.writeUint8(certificate_types.length);
@@ -156,6 +152,7 @@
      * 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.CERTIFICATE_REQUEST;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CertificateVerify.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -30,7 +25,6 @@
 import java.io.IOException;
 
 /**
- * 
  * Represents certificate verify message
  * @see TLS 1.0 spec., 7.4.8. Certificate verify
  * (http://www.ietf.org/rfc/rfc2246.txt)
@@ -83,6 +77,7 @@
      * 
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
         if (signedHash.length != 0) {
             out.writeUint16(signedHash.length);
@@ -95,6 +90,7 @@
      * 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.CERTIFICATE_VERIFY;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.security.GeneralSecurityException;
@@ -277,29 +272,29 @@
             };
 
     // hash for quick access to cipher suite by name 
-    private static Hashtable cuitesByName;
+    private static Hashtable<String, CipherSuite> cuitesByName;
 
     /**
-     * array of supported sipher suites.
+     * array of supported cipher suites.
      * Set of supported suites is defined at the moment provider's start 
      */
-//  TODO Dinamical supported suites: new providers may be dynamically 
-//  added/removed and the set of supportes suites may be changed
+//  TODO Dynamically supported suites: new providers may be dynamically 
+//  added/removed and the set of supported suites may be changed
     static CipherSuite[] supportedCipherSuites;
 
     /**
-     * array of supported sipher suites names
+     * array of supported cipher suites names
      */
     static String[] supportedCipherSuiteNames;
 
     /**
-     * default sipher suites
+     * default cipher suites
      */
     static CipherSuite[] defaultCipherSuites;
     
     static {
         int count = 0;
-        cuitesByName = new Hashtable();
+        cuitesByName = new Hashtable<String, CipherSuite>();
         for (int i = 0; i < cuitesByCode.length; i++) {
             cuitesByName.put(cuitesByCode[i].getName(), cuitesByCode[i]);
             if (cuitesByCode[i].supported) {
@@ -353,7 +348,7 @@
      * @return
      */
     public static CipherSuite getByName(String name) {
-        return (CipherSuite) cuitesByName.get(name);
+        return cuitesByName.get(name);
     }
 
     /**
@@ -365,7 +360,7 @@
      */
     public static CipherSuite getByCode(byte b1, byte b2) {
         if (b1 != 0 || (b2 & 0xFF) > cuitesByCode.length) {
-            // Unknoun
+            // Unknown
             return new CipherSuite("UNKNOUN_" + b1 + "_" + b2, false, 0, "",
                     "", new byte[] { b1, b2 });
         }
@@ -523,7 +518,7 @@
      * @return
      */
     public static String[] getSupportedCipherSuiteNames() {
-        return (String[]) supportedCipherSuiteNames.clone();
+        return supportedCipherSuiteNames.clone();
     }
 
     /**
@@ -545,6 +540,7 @@
     /**
      * Returns cipher suite description
      */
+    @Override
     public String toString() {
         return name + ": " + cipherSuiteCode[0] + " " + cipherSuiteCode[1];
     }
@@ -552,6 +548,7 @@
     /**
      * Compares this cipher suite to the specified object.
      */
+    @Override
     public boolean equals(Object obj) {
         if (obj instanceof CipherSuite
                 && this.cipherSuiteCode[0] == ((CipherSuite) obj).cipherSuiteCode[0]
@@ -610,3 +607,4 @@
     }
 
 }
+

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHandshakeImpl.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.IOException;
@@ -52,7 +47,7 @@
  * Handshake protocol operates on top of the Record Protocol.
  * It is responsible for session negotiating.
  * 
- * The implementation proceses inbound server handshake messages,
+ * The implementation processes inbound server handshake messages,
  * creates and sends respond messages. Outbound messages are supplied 
  * to Record Protocol. Detected errors are reported to the Alert protocol.
  * 
@@ -75,6 +70,7 @@
      * Starts handshake
      *
      */  
+    @Override
     public void start() {
         if (session == null) { // initial handshake
             session = findSessionToResume();
@@ -137,9 +133,10 @@
     }
 
     /**
-     * Proceses inbound handshake messages
+     * Processes inbound handshake messages
      * @param bytes
      */
+    @Override
     public void unwrap(byte[] bytes) {
         if (this.delegatedTaskErr != null) {
             Exception e = this.delegatedTaskErr;
@@ -244,7 +241,7 @@
                     session.protocol = servProt;
                     recordProtocol.setVersion(session.protocol.version);
                     session.cipherSuite = serverHello.cipher_suite;
-                    session.id = (byte[]) serverHello.session_id.clone();
+                    session.id = serverHello.session_id.clone();
                     session.serverRandom = serverHello.random;
                     break;
                 case 11: // CERTIFICATE
@@ -281,15 +278,12 @@
                     }
                     serverHelloDone = new ServerHelloDone(io_stream, length);
                     if (this.nonBlocking) {
-                        delegatedTasks.add(new DelegatedTask(
-                                new PrivilegedExceptionAction(){ 
-                            public Object run() throws Exception {
+                        delegatedTasks.add(new DelegatedTask(new PrivilegedExceptionAction<Void>() {
+                            public Void run() throws Exception {
                                 processServerHelloDone();
                                 return null;
-                                } 
-                            },
-                            this,
-                            AccessController.getContext()));
+                            }
+                        }, this, AccessController.getContext()));
                         return;
                     }
                     processServerHelloDone();
@@ -331,6 +325,7 @@
      * @ see TLS 1.0 spec., E.1. Version 2 client hello
      * @param bytes
      */
+    @Override
     public void unwrapSSLv2(byte[] bytes) {
         unexpectedMessage();
     }
@@ -338,6 +333,7 @@
     /**
      * Creates and sends Finished message
      */
+    @Override
     protected void makeFinished() {
         byte[] verify_data;
         if (serverHello.server_version[1] == 1) {
@@ -584,8 +580,9 @@
     }
 
     /**
-     * Proceses ChangeCipherSpec message
+     * Processes ChangeCipherSpec message
      */
+    @Override
     public void receiveChangeCipherSpec() {
         if (isResuming) {
             if (serverHello == null) {
@@ -615,7 +612,7 @@
         byte[] id;
         SSLSession ses;
         SSLSessionContext context = parameters.getClientSessionContext();
-        for (Enumeration en = context.getIds(); en.hasMoreElements();) {
+        for (Enumeration<?> en = context.getIds(); en.hasMoreElements();) {
             id = (byte[])en.nextElement();
             ses = context.getSession(id);
             if (host.equals(ses.getPeerHost()) && port == ses.getPeerPort()) {
@@ -626,3 +623,4 @@
     }
 
 }
+

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientHello.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.IOException;
@@ -27,7 +22,6 @@
 import java.util.Arrays;
 
 /**
- * 
  * Represents Client Hello message
  * @see TLS 1.0 spec., 7.4.1.2. Client hello
  * (http://www.ietf.org/rfc/rfc2246.txt)
@@ -176,6 +170,7 @@
      * Sends message
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
         out.write(client_version);
         out.write(random);
@@ -204,6 +199,7 @@
      * Returns message type 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.CLIENT_HELLO;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ClientKeyExchange.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -30,7 +25,6 @@
 import java.math.BigInteger;
 
 /**
- * 
  * Represents client key exchange message
  * @see TLS 1.0 spec., 7.4.7. Client key exchange message
  * (http://www.ietf.org/rfc/rfc2246.txt)
@@ -129,6 +123,7 @@
      * Sends message
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
         if (exchange_keys.length != 0) {    
             if (!isRSA || isTLS) {// DH or TLSv1 RSA
@@ -142,6 +137,7 @@
      * Returns message type 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.CLIENT_KEY_EXCHANGE;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionState.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Logger;

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateSSLv3.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.security.GeneralSecurityException;
@@ -31,7 +26,7 @@
 import javax.net.ssl.SSLProtocolException;
 
 /**
- * This class incapsulates the operating environment of the SSL v3
+ * This class encapsulates the operating environment of the SSL v3
  * (http://wp.netscape.com/eng/ssl3) Record Protocol and provides 
  * relating encryption/decryption functionality. 
  * The work functionality is based on the security
@@ -218,8 +213,9 @@
     /**
      * Creates the GenericStreamCipher or GenericBlockCipher
      * data structure for specified data of specified type.
-     * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+     * @throws AlertException if alert was occurred.
      */
+    @Override
     protected byte[] encrypt(byte type, byte[] fragment, int offset, int len) {
         try {
             int content_mac_length = len + hash_size;
@@ -282,6 +278,7 @@
      * the specified type from the provided data.
      * @throws AlertException if alert was occured.
      */
+    @Override
     protected byte[] decrypt(byte type, byte[] fragment,
             int offset, int len) {
         // plain data of the Generic[Stream|Block]Cipher structure
@@ -344,9 +341,10 @@
     }
 
     /**
-     * Shutdownes the protocol. It will be impossiblke to use the instance
+     * Shutdown the protocol. It will be impossible to use the instance
      * after the calling of this method.
      */
+    @Override
     protected void shutdown() {
         Arrays.fill(mac_write_secret, (byte) 0);
         Arrays.fill(mac_read_secret, (byte) 0);

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ConnectionStateTLS.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -36,7 +31,7 @@
 import javax.net.ssl.SSLProtocolException;
 
 /**
- * This class incapsulates the operating environment of the TLS v1
+ * This class encapsulates the operating environment of the TLS v1
  * (http://www.ietf.org/rfc/rfc2246.txt) Record Protocol and provides 
  * relating encryption/decryption functionality. 
  * The work functionality is based on the security
@@ -44,7 +39,7 @@
  */
 public class ConnectionStateTLS extends ConnectionState {
 
-    // Precomputed prf label values:
+    // Pre-calculated prf label values:
     // "key expansion".getBytes()
     private static byte[] KEY_EXPANSION_LABEL = {
         (byte) 0x6B, (byte) 0x65, (byte) 0x79, (byte) 0x20, (byte) 0x65, 
@@ -235,8 +230,9 @@
     /**
      * Creates the GenericStreamCipher or GenericBlockCipher
      * data structure for specified data of specified type.
-     * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+     * @throws AlertException if alert was occurred.
      */
+    @Override
     protected byte[] encrypt(byte type, byte[] fragment, int offset, int len) {
         try {
             int content_mac_length = len + hash_size;
@@ -298,8 +294,9 @@
      * Retrieves the fragment of the Plaintext structure of
      * the specified type from the provided data representing
      * the Generic[Stream|Block]Cipher structure.
-     * @throws org.apache.harmony.xnet.provider.jsse.AlertException if alert was occured.
+     * @throws AlertException if alert was occurred.
      */
+    @Override
     protected byte[] decrypt(byte type, byte[] fragment,
             int offset, int len) {
         // plain data of the Generic[Stream|Block]Cipher structure

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ContentType.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DHParameters.java Thu Dec 18 01:46:12 2008
@@ -14,11 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
 package org.apache.harmony.xnet.provider.jsse;
 
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DataStream.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DelegatedTask.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.HandshakeProtocol;
@@ -35,7 +30,7 @@
 public class DelegatedTask implements Runnable {
 
     private final HandshakeProtocol handshaker;
-    private final PrivilegedExceptionAction action;
+    private final PrivilegedExceptionAction<Void> action;
     private final AccessControlContext  context;
     
     /**
@@ -44,7 +39,7 @@
      * @param handshaker
      * @param context
      */
-    public DelegatedTask(PrivilegedExceptionAction action, HandshakeProtocol handshaker, AccessControlContext  context) {
+    public DelegatedTask(PrivilegedExceptionAction<Void> action, HandshakeProtocol handshaker, AccessControlContext  context) {
         this.action = action;
         this.handshaker = handshaker;
         this.context = context;

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/DigitalSignature.java Thu Dec 18 01:46:12 2008
@@ -14,26 +14,26 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
 package org.apache.harmony.xnet.provider.jsse;
 
-import org.apache.harmony.xnet.provider.jsse.AlertException;
-
+import java.security.DigestException;
+import java.security.InvalidKeyException;
 import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.security.Signature;
+import java.security.SignatureException;
 import java.security.cert.Certificate;
 import java.util.Arrays;
 
+import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
 import javax.net.ssl.SSLException;
 
 /**
- * This class represents Signature type, as descrybed in TLS v 1.0 Protocol
+ * This class represents Signature type, as described in TLS v 1.0 Protocol
  * specification, 7.4.3. It allow to init, update and sign hash. Hash algorithm
  * depends on SignatureAlgorithm.
  * 
@@ -56,10 +56,10 @@
  */
 public class DigitalSignature {
 
-    private MessageDigest md5 = null;
-    private MessageDigest sha = null;
-    private Signature signature = null;
-    private Cipher cipher = null;
+    private final MessageDigest md5;
+    private final MessageDigest sha;
+    private final Signature signature;
+    private final Cipher cipher;
     
     private byte[] md5_hash;
     private byte[] sha_hash;
@@ -69,33 +69,35 @@
      * @param keyExchange
      */
     public DigitalSignature(int keyExchange) {
-        try { 
+        try {
+            sha = MessageDigest.getInstance("SHA-1");
+            
             if (keyExchange == CipherSuite.KeyExchange_RSA_EXPORT ||
                     keyExchange == CipherSuite.KeyExchange_RSA ||
                     keyExchange == CipherSuite.KeyExchange_DHE_RSA ||
                     keyExchange == CipherSuite.KeyExchange_DHE_RSA_EXPORT) {
                 // SignatureAlgorithm is rsa
                 md5 = MessageDigest.getInstance("MD5");
-                sha = MessageDigest.getInstance("SHA-1");
                 cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
+                signature = null;
             } else if (keyExchange == CipherSuite.KeyExchange_DHE_DSS ||
                     keyExchange == CipherSuite.KeyExchange_DHE_DSS_EXPORT ) {
                 // SignatureAlgorithm is dsa
-                sha = MessageDigest.getInstance("SHA-1");
                 signature = Signature.getInstance("NONEwithDSA");
-// The Signature should be empty in case of anonimous signature algorithm:
-//            } else if (keyExchange == CipherSuite.KeyExchange_DH_anon ||
-//                    keyExchange == CipherSuite.KeyExchange_DH_anon_EXPORT) {            
-//
-            }
-        } catch (Exception e) {
-            throw new AlertException(
-                    AlertProtocol.INTERNAL_ERROR,
-                    new SSLException(
-                            "INTERNAL ERROR: Unexpected exception on digital signature",
-                            e));
-        }    
-            
+                cipher = null;
+                md5 = null;
+            } else {
+                cipher = null;
+                signature = null;
+                md5 = null;
+            }
+        } catch (NoSuchAlgorithmException e) {
+            // this should never happen
+            throw new AssertionError(e);
+        } catch (NoSuchPaddingException e) {
+            // this should never happen
+            throw new AssertionError(e);
+        }
     }
     
     /**
@@ -109,8 +111,9 @@
             } else if (cipher != null) {
                 cipher.init(Cipher.ENCRYPT_MODE, key);
             }
-        } catch (Exception e){
-            e.printStackTrace();
+        } catch (InvalidKeyException e){
+            throw new AlertException(AlertProtocol.BAD_CERTIFICATE,
+                    new SSLException("init - invalid private key", e));
         }
     }
     
@@ -125,8 +128,9 @@
             } else if (cipher != null) {
                 cipher.init(Cipher.DECRYPT_MODE, cert);
             }
-        } catch (Exception e){
-            e.printStackTrace();
+        } catch (InvalidKeyException e){
+            throw new AlertException(AlertProtocol.BAD_CERTIFICATE,
+                    new SSLException("init - invalid certificate", e));
         }
     }
     
@@ -135,16 +139,12 @@
      * @param data
      */
     public void update(byte[] data) {
-        try {
-            if (sha != null) {
-                sha.update(data);
-            }
-            if (md5 != null) {
-                md5.update(data);
-            }
-        } catch (Exception e){
-            e.printStackTrace();
-        }        
+        if (sha != null) {
+            sha.update(data);
+        }
+        if (md5 != null) {
+            md5.update(data);
+        }
     }
     
     /**
@@ -197,10 +197,15 @@
                 return cipher.doFinal();
             } 
             return new byte[0];
-        } catch (Exception e){
-            e.printStackTrace();
+        } catch (DigestException e){
+            return new byte[0];
+        } catch (SignatureException e){
+            return new byte[0];
+        } catch (BadPaddingException e){
             return new byte[0];
-        }    
+        } catch (IllegalBlockSizeException e){
+            return new byte[0];
+        }
     }
 
     /**
@@ -209,34 +214,40 @@
      * @return true if verified
      */
     public boolean verifySignature(byte[] data) {
-        try {
-            if (signature != null) {
+        if (signature != null) {
+            try {
                 return signature.verify(data);
-            } else if (cipher != null) {
-                byte[] decrypt = cipher.doFinal(data);
-                byte[] md5_sha;
-                if (md5_hash != null && sha_hash != null) {
-                    md5_sha = new byte[md5_hash.length + sha_hash.length];
-                    System.arraycopy(md5_hash, 0, md5_sha, 0, md5_hash.length);
-                    System.arraycopy(sha_hash, 0, md5_sha, md5_hash.length, sha_hash.length);
-                } else if (md5_hash != null) {
-                    md5_sha = md5_hash;
-                } else {
-                    md5_sha = sha_hash;
-                }
-                if (Arrays.equals(decrypt, md5_sha)) {
-                    return true;
-                } else {
-                    return false;
-                }
-            } else if (data == null || data.length == 0) {
-                return true;
-            } else {
+            } catch (SignatureException e) {
                 return false;
             }
-        } catch (Exception e){
-                e.printStackTrace();
+        }
+        
+        if (cipher != null) {
+            final byte[] decrypt;
+            try {
+                decrypt = cipher.doFinal(data);
+            } catch (IllegalBlockSizeException e) {
+                return false;
+            } catch (BadPaddingException e) {
                 return false;
+            }
+            
+            final byte[] md5_sha;
+            if (md5_hash != null && sha_hash != null) {
+                md5_sha = new byte[md5_hash.length + sha_hash.length];
+                System.arraycopy(md5_hash, 0, md5_sha, 0, md5_hash.length);
+                System.arraycopy(sha_hash, 0, md5_sha, md5_hash.length, sha_hash.length);
+            } else if (md5_hash != null) {
+                md5_sha = md5_hash;
+            } else {
+                md5_sha = sha_hash;
+            }
+            
+            return Arrays.equals(decrypt, md5_sha);
+        } else if (data == null || data.length == 0) {
+            return true;
+        } else {
+            return false;
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfBufferException.java Thu Dec 18 01:46:12 2008
@@ -15,25 +15,18 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.IOException;
 
 /**
- * This class represents the exception signalizing that
- * data could not be read from the stream because
- * underlying input stream reached its end.
+ * This exception indicates that data could not be read from the stream because the underlying input
+ * stream reached its end.
  */
 public class EndOfBufferException extends IOException {
 
-    /**
-     * Constructor
-     */
+    private static final long serialVersionUID = 1838636631255369519L;
+
     public EndOfBufferException() {
         super();
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/EndOfSourceException.java Thu Dec 18 01:46:12 2008
@@ -15,28 +15,20 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.IOException;
 
 /**
- * This class represents the exception signalizing that
- * data could not be read from the buffered stream because
- * underlying data buffer was exhausted.
+ * This exception indicates that data could not be read from the buffered stream because underlying
+ * data buffer was exhausted.
  */
 public class EndOfSourceException extends IOException {
 
-    /**
-     * Constructor
-     */
+    private static final long serialVersionUID = -4673611435974054413L;
+
     public EndOfSourceException() {
         super();
     }
 
 }
-

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Finished.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -63,6 +58,7 @@
         }
     }
 
+    @Override
     public void send(HandshakeIODataStream out) {
         out.write(data);
     }
@@ -71,6 +67,7 @@
      * Returns message type 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.FINISHED;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Handshake.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 /**

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeIODataStream.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -101,14 +96,17 @@
     // position of the last byte to read + 1
     private int read_pos_end;
 
+    @Override
     public int available() {
         return read_pos_end - read_pos;
     }
 
+    @Override
     public boolean markSupported() {
         return true;
     }
 
+    @Override
     public void mark(int limit) {
         marked_pos = read_pos;
     }
@@ -117,6 +115,7 @@
         marked_pos = read_pos;
     }
 
+    @Override
     public void reset() {
         read_pos = marked_pos;
     }
@@ -138,6 +137,7 @@
      * @param   byte:   byte
      * @return
      */
+    @Override
     public int read() throws IOException {
         if (read_pos == read_pos_end) {
             //return -1;
@@ -151,6 +151,7 @@
      * @param   new:    long
      * @return
      */
+    @Override
     public byte[] read(int length) throws IOException {
         if (length > available()) {
             throw new EndOfBufferException();
@@ -161,6 +162,7 @@
         return res;
     }
 
+    @Override
     public int read(byte[] dest, int offset, int length) throws IOException {
         if (length > available()) {
             throw new EndOfBufferException();

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HandshakeProtocol.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.math.BigInteger;
@@ -89,7 +84,7 @@
     /**
      * Delegated tasks for this handshake implementation
      */
-    protected Vector delegatedTasks = new Vector();
+    protected Vector<DelegatedTask> delegatedTasks = new Vector<DelegatedTask>();
     
     /**
      * Indicates non-blocking handshake
@@ -167,11 +162,11 @@
         if (owner instanceof SSLEngineImpl) {
             engineOwner = (SSLEngineImpl) owner;
             nonBlocking = true;
-            this.parameters = (SSLParameters) engineOwner.sslParameters;
+            this.parameters = engineOwner.sslParameters;
         } else if (owner instanceof SSLSocketImpl) {
             socketOwner = (SSLSocketImpl) owner;
             nonBlocking = false;
-            this.parameters = (SSLParameters) socketOwner.sslParameters;
+            this.parameters = socketOwner.sslParameters;
         }
     }
 
@@ -477,11 +472,8 @@
     public Runnable getTask() {
         if (delegatedTasks.isEmpty()) {
             return null;
-        } else {
-            Runnable task = (Runnable)delegatedTasks.firstElement();
-            delegatedTasks.remove(0);
-            return task;
         }
+        return delegatedTasks.remove(0);
     }
     
     /**
@@ -518,7 +510,7 @@
             mod = ((RSAKey) pk).getModulus();
         } else {
             KeyFactory kf = KeyFactory.getInstance("RSA");
-            mod = ((RSAPublicKeySpec) kf.getKeySpec(pk, RSAPublicKeySpec.class))
+            mod = kf.getKeySpec(pk, RSAPublicKeySpec.class)
                     .getModulus();
         }
         return mod.bitLength();

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/HelloRequest.java Thu Dec 18 01:46:12 2008
@@ -15,10 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.Message;
@@ -60,9 +56,11 @@
      * Sends message
      * @param out
      */
+    @Override
     public void send(HandshakeIODataStream out) {
     }
 
+    @Override
     public int length() {
         return 0;
     } 
@@ -71,6 +69,7 @@
      * Returns message type 
      * @return
      */
+    @Override
     public int getType() {
         return Handshake.HELLO_REQUEST;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/JSSEProvider.java Thu Dec 18 01:46:12 2008
@@ -15,14 +15,10 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.Provider;
 
 /**
@@ -104,20 +100,18 @@
  */
 public final class JSSEProvider extends Provider {
 
+    private static final long serialVersionUID = 3075686092260669675L;
+
     public JSSEProvider() {
         super("HarmonyJSSE", 1.0, "Harmony JSSE Provider");
-        AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
             public Void run() {
-                put("SSLContext.TLS",
-                        "org.apache.harmony.xnet.provider.jsse.SSLContextImpl");
+                put("SSLContext.TLS", SSLContextImpl.class.getName());
                 put("Alg.Alias.SSLContext.TLSv1", "TLS");
-                put("KeyManagerFactory.X509",
-                        "org.apache.harmony.xnet.provider.jsse.KeyManagerFactoryImpl");
-                put("TrustManagerFactory.X509",
-                        "org.apache.harmony.xnet.provider.jsse.TrustManagerFactoryImpl");
+                put("KeyManagerFactory.X509", KeyManagerFactoryImpl.class.getName());
+                put("TrustManagerFactory.X509", TrustManagerFactoryImpl.class.getName());
                 return null;
             }
         });
     }
 }
-

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerFactoryImpl.java Thu Dec 18 01:46:12 2008
@@ -14,11 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.File;
@@ -53,13 +48,14 @@
      * @see javax.net.ssl.KeyManagerFactorySpi.engineInit(KeyStore ks, char[]
      *      password)
      */
+    @Override
     public void engineInit(KeyStore ks, char[] password)
             throws KeyStoreException, NoSuchAlgorithmException,
             UnrecoverableKeyException {
         if (ks != null) {
             keyStore = ks;
             if (password != null) {
-                pwd = (char[]) password.clone();
+                pwd = password.clone();
             } else {
                 pwd = new char[0];
             }
@@ -115,6 +111,7 @@
      * @see javax.net.ssl.KeyManagerFactorySpi.engineInit(ManagerFactoryParameters
      *      spec)
      */
+    @Override
     public void engineInit(ManagerFactoryParameters spec)
             throws InvalidAlgorithmParameterException {
         throw new InvalidAlgorithmParameterException(
@@ -125,6 +122,7 @@
     /**
      * @see javax.net.ssl.KeyManagerFactorySpi.engineGetKeyManagers()
      */
+    @Override
     public KeyManager[] engineGetKeyManagers() {
         if (keyStore == null) {
             throw new IllegalStateException("KeyManagerFactory is not initialized");

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/KeyManagerImpl.java Thu Dec 18 01:46:12 2008
@@ -14,11 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.net.Socket;
@@ -28,6 +23,7 @@
 import java.security.Principal;
 import java.security.PrivateKey;
 import java.security.UnrecoverableEntryException;
+import java.security.KeyStore.PrivateKeyEntry;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.util.Enumeration;
@@ -40,11 +36,11 @@
 
 /**
  * KeyManager implementation.
- * This implementation uses hashed key store information.
- * It works faster than retrieving all of the data from the key store.
- * Any key store changes, that happen after key manager was created, have no effect.
- * The implementation does not use peer information (host, port)
- * that may be obtained from socket or engine.
+ * 
+ * This implementation uses hashed key store information. It works faster than retrieving all of the
+ * data from the key store. Any key store changes, that happen after key manager was created, have
+ * no effect. The implementation does not use peer information (host, port) that may be obtained
+ * from socket or engine.
  * 
  * @see javax.net.ssl.KeyManager
  * 
@@ -52,7 +48,7 @@
 public class KeyManagerImpl extends X509ExtendedKeyManager {
 
     // hashed key store information
-    private final Hashtable hash = new Hashtable();
+    private final Hashtable<String, PrivateKeyEntry> hash;
 
     /**
      * Creates Key manager
@@ -61,21 +57,20 @@
      * @param pwd
      */
     public KeyManagerImpl(KeyStore keyStore, char[] pwd) {
-        String alias;
-        KeyStore.PrivateKeyEntry entry;
-        Enumeration aliases;
+        super();
+        this.hash = new Hashtable<String, PrivateKeyEntry>();
+        final Enumeration<String> aliases;
         try {
             aliases = keyStore.aliases();
         } catch (KeyStoreException e) {
             return;
         }
         for (; aliases.hasMoreElements();) {
-            alias = (String) aliases.nextElement();          
+            final String alias = aliases.nextElement();
             try {
-                if (keyStore.entryInstanceOf(alias,
-                        KeyStore.PrivateKeyEntry.class)) {
-                    entry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias,
-                            new KeyStore.PasswordProtection(pwd));
+                if (keyStore.entryInstanceOf(alias, KeyStore.PrivateKeyEntry.class)) {
+                    final KeyStore.PrivateKeyEntry entry = (KeyStore.PrivateKeyEntry) keyStore
+                            .getEntry(alias, new KeyStore.PasswordProtection(pwd));
                     hash.put(alias, entry);
                 }
             } catch (KeyStoreException e) {
@@ -86,45 +81,21 @@
                 continue;
             }
         }
-
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.chooseClientAlias(String[]
-     *      keyType, Principal[] issuers, Socket socket)
-     */
-    public String chooseClientAlias(String[] keyType, Principal[] issuers,
-            Socket socket) {
-        String[] al = chooseAlias(keyType, issuers);
-        if (al != null) {
-            return al[0];
-        } else {
-            return null;
-        }
+    public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) {
+        final String[] al = chooseAlias(keyType, issuers);
+        return (al == null ? null : al[0]);
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.chooseServerAlias(String
-     *      keyType, Principal[] issuers, Socket socket)
-     */
-    public String chooseServerAlias(String keyType, Principal[] issuers,
-            Socket socket) {
-        String[] al = chooseAlias(new String[] { keyType }, issuers);
-        if (al != null) {
-            return al[0];
-        } else {
-            return null;
-        }
+    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) {
+        final String[] al = chooseAlias(new String[] { keyType }, issuers);
+        return (al == null ? null : al[0]);
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.getCertificateChain(String
-     *      alias)
-     */
     public X509Certificate[] getCertificateChain(String alias) {
         if (hash.containsKey(alias)) {
-            Certificate[] certs = ((KeyStore.PrivateKeyEntry) hash.get(alias))
-                    .getCertificateChain();
+            Certificate[] certs = hash.get(alias).getCertificateChain();
             if (certs[0] instanceof X509Certificate) {
                 X509Certificate[] xcerts = new X509Certificate[certs.length];
                 for (int i = 0; i < certs.length; i++) {
@@ -137,74 +108,43 @@
 
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.getClientAliases(String
-     *      keyType, Principal[] issuers)
-     */
     public String[] getClientAliases(String keyType, Principal[] issuers) {
         return chooseAlias(new String[] { keyType }, issuers);
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.getServerAliases(String
-     *      keyType, Principal[] issuers)
-     */
     public String[] getServerAliases(String keyType, Principal[] issuers) {
         return chooseAlias(new String[] { keyType }, issuers);
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.getPrivateKey(String alias)
-     */
     public PrivateKey getPrivateKey(String alias) {
         if (hash.containsKey(alias)) {
-            return ((KeyStore.PrivateKeyEntry) hash.get(alias)).getPrivateKey();
+            return hash.get(alias).getPrivateKey();
         }
         return null;
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.chooseEngineClientAlias(String[]
-     *      keyType, Principal[] issuers, SSLEngine engine)
-     */
-    public String chooseEngineClientAlias(String[] keyType,
-            Principal[] issuers, SSLEngine engine) {
-        String[] al = chooseAlias(keyType, issuers);
-        if (al != null) {
-            return al[0];
-        } else {
-            return null;
-        }
+    @Override
+    public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) {
+        final String[] al = chooseAlias(keyType, issuers);
+        return (al == null ? null : al[0]);
     }
 
-    /**
-     * @see javax.net.ssl.X509ExtendedKeyManager.chooseEngineServerAlias(String
-     *      keyType, Principal[] issuers, SSLEngine engine)
-     */
-    public String chooseEngineServerAlias(String keyType, Principal[] issuers,
-            SSLEngine engine) {
-        String[] al = chooseAlias(new String[] { keyType }, issuers);
-        if (al != null) {
-            return al[0];
-        } else {
-            return null;
-        }
+    @Override
+    public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) {
+        final String[] al = chooseAlias(new String[] { keyType }, issuers);
+        return (al == null ? null : al[0]);
     }
 
     private String[] chooseAlias(String[] keyType, Principal[] issuers) {
-        String alias;
-        KeyStore.PrivateKeyEntry entry;
-        
         if (keyType == null || keyType.length == 0) {
             return null;
         }
-        Vector found = new Vector();
-        int count = 0;
-        for (Enumeration aliases = hash.keys(); aliases.hasMoreElements();) {
-            alias = (String) aliases.nextElement();
-            entry = (KeyStore.PrivateKeyEntry) hash.get(alias);
-            Certificate[] certs = entry.getCertificateChain();
-            String alg = certs[0].getPublicKey().getAlgorithm();
+        Vector<String> found = new Vector<String>();
+        for (Enumeration<String> aliases = hash.keys(); aliases.hasMoreElements();) {
+            final String alias = aliases.nextElement();
+            final KeyStore.PrivateKeyEntry entry = hash.get(alias);
+            final Certificate[] certs = entry.getCertificateChain();
+            final String alg = certs[0].getPublicKey().getAlgorithm();
             for (int i = 0; i < keyType.length; i++) {
                 if (alg.equals(keyType[i])) {
                     if (issuers != null && issuers.length != 0) {
@@ -216,7 +156,6 @@
                                 for (int iii = 0; iii < issuers.length; iii++) {
                                     if (issuer.equals(issuers[iii])) {
                                         found.add(alias);
-                                        count++;
                                         break loop;
                                     }
                                 }
@@ -225,18 +164,13 @@
                         }
                     } else {
                         found.add(alias);
-                        count++;
                     }
                 }
             }
         }
-        if (count > 0) {
-            String[] result = new String[count];
-            found.toArray(result);
-            return result;
-        } else {
-            return null;
+        if (!found.isEmpty()) {
+            return found.toArray(new String[found.size()]);
         }
+        return null;
     }
-
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Logger.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.io.PrintStream;
@@ -41,6 +36,7 @@
             prefix = name + "["+Thread.currentThread().getName()+"] ";
         }
 
+        @Override
         public void print(String msg) {
             for (int i=0; i<indent; i++) {
                 super.print("  ");
@@ -56,6 +52,7 @@
             indent --;
         }
 
+        @Override
         public void println(String msg) {
             print(prefix);
             super.println(msg);

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/Message.java Thu Dec 18 01:46:12 2008
@@ -15,10 +15,6 @@
  *  limitations under the License.
  */
 
-/**
-* @author Boris Kuznetsov
-* @version $Revision$
-*/
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.AlertException;

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/PRF.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.AlertException;

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ProtocolVersion.java Thu Dec 18 01:46:12 2008
@@ -14,11 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Boris Kuznetsov
- * @version $Revision$
- */
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.util.Hashtable;
@@ -28,41 +23,13 @@
  * Represents Protocol Version
  */
 public class ProtocolVersion {
-
     /**
-     * Protocol name
-     */
-    public final String name;
-
-    /**
-     * Protocol version as byte array
-     */
-    public final byte[] version;
-
-    /**
-     * Protocols supported by this provider implementaton
+     * Protocols supported by this provider implementation
      */
     public static final String[] supportedProtocols = new String[] { "TLSv1",
             "SSLv3" };
 
-    private static Hashtable protocolsByName = new Hashtable(4);
-
-    private ProtocolVersion(String name, byte[] version) {
-        this.name = name;
-        this.version = version;
-    }
-
-    /**
-     * Compares this ProtocolVersion to the specified object.
-     */
-    public boolean equals(Object o) {
-        if (o instanceof ProtocolVersion
-                && this.version[0] == ((ProtocolVersion) o).version[0]
-                && this.version[1] == ((ProtocolVersion) o).version[1]) {
-            return true;
-        }
-        return false;
-    }
+    private static Hashtable<String, ProtocolVersion> protocolsByName = new Hashtable<String, ProtocolVersion>(4);
 
     /**
      * 
@@ -112,7 +79,7 @@
      * @return
      */
     public static ProtocolVersion getByName(String name) {
-        return (ProtocolVersion) protocolsByName.get(name);
+        return protocolsByName.get(name);
     }
 
     /**
@@ -161,4 +128,31 @@
         protocolsByName.put("TLS", TLSv1);
     }
 
+    /**
+     * Protocol name
+     */
+    public final String name;
+
+    /**
+     * Protocol version as byte array
+     */
+    public final byte[] version;
+
+    private ProtocolVersion(String name, byte[] version) {
+        this.name = name;
+        this.version = version;
+    }
+
+    /**
+     * Compares this ProtocolVersion to the specified object.
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof ProtocolVersion
+                && this.version[0] == ((ProtocolVersion) o).version[0]
+                && this.version[1] == ((ProtocolVersion) o).version[1]) {
+            return true;
+        }
+        return false;
+    }
 }
\ No newline at end of file

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLBufferedInput.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.SSLInputStream;
@@ -57,6 +52,7 @@
     /**
      * Returns the number of bytes available for reading.
      */
+    @Override
     public int available() throws IOException {
         // in assumption that the buffer has been set
         return in.remaining();
@@ -73,6 +69,7 @@
      * Reads the following byte value. If there are no bytes in the source 
      * buffer, method throws java.nio.BufferUnderflowException.
      */
+    @Override
     public int read() throws IOException {
         // TODO: implement optimized read(int) 
         // and read(byte[], int, int) methods

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLContextImpl.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.SSLSocketFactoryImpl;
@@ -58,12 +53,14 @@
         super();
     }
 
+    @Override
     public void engineInit(KeyManager[] kms, TrustManager[] tms,
             SecureRandom sr) throws KeyManagementException {
         sslParameters = new SSLParameters(kms, tms, sr, clientSessionContext,
                 serverSessionContext);
     }
 
+    @Override
     public SSLSocketFactory engineGetSocketFactory() {
         if (sslParameters == null) {
             throw new IllegalStateException("SSLContext is not initiallized.");
@@ -71,6 +68,7 @@
         return new SSLSocketFactoryImpl(sslParameters);
     }
 
+    @Override
     public SSLServerSocketFactory engineGetServerSocketFactory() {
         if (sslParameters == null) {
             throw new IllegalStateException("SSLContext is not initiallized.");
@@ -78,6 +76,7 @@
         return new SSLServerSocketFactoryImpl(sslParameters);
     }
 
+    @Override
     public SSLEngine engineCreateSSLEngine(String host, int port) {
         if (sslParameters == null) {
             throw new IllegalStateException("SSLContext is not initiallized.");
@@ -86,6 +85,7 @@
                 (SSLParameters) sslParameters.clone());
     }
 
+    @Override
     public SSLEngine engineCreateSSLEngine() {
         if (sslParameters == null) {
             throw new IllegalStateException("SSLContext is not initiallized.");
@@ -93,43 +93,14 @@
         return new SSLEngineImpl((SSLParameters) sslParameters.clone());
     }
 
+    @Override
     public SSLSessionContext engineGetServerSessionContext() {
         return serverSessionContext;
     }
 
+    @Override
     public SSLSessionContext engineGetClientSessionContext() {
         return clientSessionContext;
     }
-
-    @Override
-    protected javax.net.ssl.SSLParameters engineGetDefaultSSLParameters() {
-        SSLParameters providerSSLParameters = null;
-        try {
-            providerSSLParameters = SSLParameters.getDefault();
-        } catch (KeyManagementException e) {
-            
-        }
-        if (providerSSLParameters == null)
-            return null;
-
-        javax.net.ssl.SSLParameters sslParameters = new javax.net.ssl.SSLParameters();
-        sslParameters.setCipherSuites(providerSSLParameters
-                .getEnabledCipherSuites());
-        sslParameters.setProtocols(providerSSLParameters.getEnabledProtocols());
-        sslParameters.setNeedClientAuth(sslParameters.getNeedClientAuth());
-        sslParameters.setWantClientAuth(providerSSLParameters
-                .getWantClientAuth());
-        return sslParameters;
-    }
-
-    @Override
-    protected javax.net.ssl.SSLParameters engineGetSupportedSSLParameters() {
-        javax.net.ssl.SSLParameters sslParameters = new javax.net.ssl.SSLParameters();
-        sslParameters.setCipherSuites(CipherSuite
-                .getSupportedCipherSuiteNames());
-        sslParameters
-                .setProtocols((String[]) ProtocolVersion.supportedProtocols
-                        .clone());
-        return sslParameters;
-    }
 }
+

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineAppData.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import org.apache.harmony.xnet.provider.jsse.AlertException;
@@ -77,11 +72,10 @@
                 pos = len;
                 // data was written, exit
                 break;
-            } else {
-                // write chunk of data
-                dsts[i].put(buffer, pos, rem);
-                pos += rem;
             }
+            // write chunk of data
+            dsts[i].put(buffer, pos, rem);
+            pos += rem;
         }
         if (pos != len) {
             // The data did not feet into the buffers,

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/SSLEngineDataStream.java Thu Dec 18 01:46:12 2008
@@ -15,11 +15,6 @@
  *  limitations under the License.
  */
 
-/**
- * @author Alexander Y. Kleymenov
- * @version $Revision$
- */
-
 package org.apache.harmony.xnet.provider.jsse;
 
 import java.nio.ByteBuffer;



Mime
View raw message