Index: modules/security/src/common/javasrc/java/security/KeyStore.java =================================================================== --- modules/security/src/common/javasrc/java/security/KeyStore.java.orig 2006-03-20 18:38:23.000000000 +0000 +++ modules/security/src/common/javasrc/java/security/KeyStore.java 2006-03-24 18:15:12.000000000 +0000 @@ -489,9 +489,11 @@ */ public final boolean entryInstanceOf(String alias, Class entryClass) throws KeyStoreException { - if ((alias == null) || (entryClass == null)) { - throw new NullPointerException("alias or entryClass is null"); - } + if (alias == null) + throw new NullPointerException("alias is null"); + if (entryClass == null) + throw new NullPointerException("entryClass is null"); + if (!isInit) { throw new KeyStoreException(NOTINITKEYSTORE); } @@ -530,10 +532,11 @@ */ public static Builder newInstance(KeyStore keyStore, ProtectionParameter protectionParameter) { - if ((keyStore == null) || (protectionParameter == null)) { - throw new NullPointerException( - "keystore or protectionParameter is null"); - } + if (keyStore == null) + throw new NullPointerException("keystore is null"); + if (protectionParameter == null) + throw new NullPointerException("protectionParameter is null"); + if (!keyStore.isInit) { throw new IllegalArgumentException(NOTINITKEYSTORE); } @@ -894,9 +897,11 @@ * */ public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain) { - if ((privateKey == null) || (chain == null)) { - throw new NullPointerException("privateKey or chain is null"); - } + if (privateKey == null) + throw new NullPointerException("privateKey is null"); + if (chain == null) + throw new NullPointerException("chain is null"); + if (chain.length == 0) { throw new IllegalArgumentException("chain length equals 0"); } @@ -1042,4 +1047,4 @@ .toString()); } } -} \ No newline at end of file +} Index: modules/security/src/common/javasrc/java/security/MessageDigestSpi.java =================================================================== --- modules/security/src/common/javasrc/java/security/MessageDigestSpi.java.orig 2006-03-20 18:38:23.000000000 +0000 +++ modules/security/src/common/javasrc/java/security/MessageDigestSpi.java 2006-03-24 18:50:57.000000000 +0000 @@ -89,7 +89,11 @@ engineReset(); throw new DigestException("The value of len parameter is less than the actual digest length"); } - if ((offset < 0) || (offset + len > buf.length)) { + if (offset < 0) { + engineReset(); + throw new DigestException("Invalid negative offset"); + } + if (offset + len > buf.length) { engineReset(); throw new DigestException("Incorrect offset or len value"); } Index: modules/security/src/common/javasrc/java/security/SignatureSpi.java =================================================================== --- modules/security/src/common/javasrc/java/security/SignatureSpi.java.orig 2006-03-20 18:38:23.000000000 +0000 +++ modules/security/src/common/javasrc/java/security/SignatureSpi.java 2006-03-24 19:03:16.000000000 +0000 @@ -127,7 +127,10 @@ throw new SignatureException( "The value of len parameter is less than the actual signature length"); } - if ((offset < 0) || (offset + len > outbuf.length)) { + if (offset < 0) { + throw new SignatureException("Invalid negative offset"); + } + if (offset + len > outbuf.length) { throw new SignatureException("Incorrect offset or len value"); } System.arraycopy(tmp, 0, outbuf, offset, tmp.length); @@ -197,4 +200,4 @@ throw new CloneNotSupportedException(); } } -} \ No newline at end of file +} Index: modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java =================================================================== --- modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java.orig 2006-03-20 18:38:37.000000000 +0000 +++ modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java 2006-03-24 18:57:30.000000000 +0000 @@ -35,17 +35,21 @@ private final String algorithm; private final String format = "RAW"; - private static final IllegalArgumentException BADPARAMS_EXC = - new IllegalArgumentException( - "algorithm is null or key is null, empty, or too short."); + private static final IllegalArgumentException ALG_NULL_EXC = + new IllegalArgumentException("algorithm is null"); + private static final IllegalArgumentException KEY_NULL_EXC = + new IllegalArgumentException("key is null"); + private static final IllegalArgumentException KEY_TOO_SHORT_EXC = + new IllegalArgumentException("key is too short"); /** * @com.intel.drl.spec_ref */ public SecretKeySpec(byte[] key, String algorithm) { - if ((key == null) || (key.length == 0) || (algorithm == null)) { - throw BADPARAMS_EXC; - } + if (algorithm == null) throw ALG_NULL_EXC; + if (key == null) throw KEY_NULL_EXC; + if (key.length == 0) throw KEY_TOO_SHORT_EXC; + this.algorithm = algorithm; this.key = new byte[key.length]; System.arraycopy(key, 0, this.key, 0, key.length); @@ -55,10 +59,11 @@ * @com.intel.drl.spec_ref */ public SecretKeySpec(byte[] key, int offset, int len, String algorithm) { - if ((key == null) || (key.length == 0) - || (key.length - offset < len) || (algorithm == null)) { - throw BADPARAMS_EXC; - } + if (algorithm == null) throw ALG_NULL_EXC; + if (key == null) throw KEY_NULL_EXC; + if (key.length == 0 || (key.length - offset < len)) + throw KEY_TOO_SHORT_EXC; + this.algorithm = algorithm; this.key = new byte[len]; System.arraycopy(key, offset, this.key, 0, len); @@ -113,4 +118,3 @@ && (Arrays.equals(key, ks.key)); } } -