harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r389435 [2/2] - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc: java/security/KeyStore.java java/security/MessageDigestSpi.java java/security/SignatureSpi.java javax/crypto/spec/SecretKeySpec.java
Date Tue, 28 Mar 2006 08:19:09 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java?rev=389435&r1=389434&r2=389435&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/common/javasrc/javax/crypto/spec/SecretKeySpec.java
Tue Mar 28 00:19:07 2006
@@ -40,17 +40,20 @@
     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.");
-
     /**
      * @com.intel.drl.spec_ref
      */
     public SecretKeySpec(byte[] key, String algorithm) {
-        if ((key == null) || (key.length == 0) || (algorithm == null)) {
-            throw BADPARAMS_EXC;
+    	if (key == null) {
+    		throw new IllegalArgumentException("key is null");
+    	}
+    	if (key.length == 0) {
+    		throw new IllegalArgumentException("key is empty");
+    	}
+        if (algorithm == null) {
+            throw new IllegalArgumentException("algorithm is null");
         }
+
         this.algorithm = algorithm;
         this.key = new byte[key.length];
         System.arraycopy(key, 0, this.key, 0, key.length);
@@ -60,9 +63,17 @@
      * @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 (key == null) {
+    		throw new IllegalArgumentException("key is null");
+    	}
+    	if (key.length == 0) {
+    		throw new IllegalArgumentException("key is empty");
+    	}
+    	if ((key.length - offset < len)) {
+    		throw new IllegalArgumentException("key is too short");
+    	}
+        if (algorithm == null) {
+            throw new IllegalArgumentException("algorithm is null");
         }
         this.algorithm = algorithm;
         this.key = new byte[len];



Mime
View raw message