jdk/src/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java
changeset 16067 36055e4b5305
parent 16045 9d08c3b9a6a0
child 16913 a6f4d1626ad9
--- a/jdk/src/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java	Tue Mar 12 10:35:44 2013 -0400
+++ b/jdk/src/share/classes/sun/security/internal/spec/TlsKeyMaterialSpec.java	Tue Mar 12 15:31:49 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,8 +58,9 @@
      * <code>new TlsKeymaterialSpec(clientMacKey, serverMacKey,
      * null, null, null, null)</code>.
      *
-     * @param clientMacKey the client MAC key (or null)
-     * @param serverMacKey the server MAC key (or null)
+     * @param clientMacKey the client MAC key
+     * @param serverMacKey the server MAC key
+     * @throws NullPointerException if clientMacKey or serverMacKey is null
      */
     public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey) {
         this(clientMacKey, serverMacKey, null, null, null, null);
@@ -72,10 +73,11 @@
      * <code>new TlsKeymaterialSpec(clientMacKey, serverMacKey,
      * clientCipherKey, serverCipherKey, null, null)</code>.
      *
-     * @param clientMacKey the client MAC key (or null)
-     * @param serverMacKey the server MAC key (or null)
+     * @param clientMacKey the client MAC key
+     * @param serverMacKey the server MAC key
      * @param clientCipherKey the client cipher key (or null)
      * @param serverCipherKey the server cipher key (or null)
+     * @throws NullPointerException if clientMacKey or serverMacKey is null
      */
     public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey,
             SecretKey clientCipherKey, SecretKey serverCipherKey) {
@@ -88,17 +90,21 @@
      * keys, client and server cipher keys, and client and server
      * initialization vectors.
      *
-     * @param clientMacKey the client MAC key (or null)
-     * @param serverMacKey the server MAC key (or null)
+     * @param clientMacKey the client MAC key
+     * @param serverMacKey the server MAC key
      * @param clientCipherKey the client cipher key (or null)
      * @param clientIv the client initialization vector (or null)
      * @param serverCipherKey the server cipher key (or null)
      * @param serverIv the server initialization vector (or null)
+     *
+     * @throws NullPointerException if clientMacKey or serverMacKey is null
      */
     public TlsKeyMaterialSpec(SecretKey clientMacKey, SecretKey serverMacKey,
             SecretKey clientCipherKey, IvParameterSpec clientIv,
             SecretKey serverCipherKey, IvParameterSpec serverIv) {
-
+        if ((clientMacKey == null) || (serverMacKey == null)) {
+            throw new NullPointerException("MAC keys must not be null");
+        }
         this.clientMacKey = clientMacKey;
         this.serverMacKey = serverMacKey;
         this.clientCipherKey = clientCipherKey;
@@ -137,7 +143,7 @@
     /**
      * Returns the client MAC key.
      *
-     * @return the client MAC key (or null).
+     * @return the client MAC key.
      */
     public SecretKey getClientMacKey() {
         return clientMacKey;
@@ -146,7 +152,7 @@
     /**
      * Return the server MAC key.
      *
-     * @return the server MAC key (or null).
+     * @return the server MAC key.
      */
     public SecretKey getServerMacKey() {
         return serverMacKey;