[cp-patches] FYI: Improve exception output from crypto key selection

Andrew John Hughes gnu_andrew at member.fsf.org
Sun Nov 16 02:56:17 UTC 2008


The exception for key selection reports an invalid key sizes,
but doesn't report what key sizes are valid.

ChangeLog:

2008-11-16  Andrew John Hughes  <gnu_andrew at member.fsf.org>

	* gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java:
	(init(int,SecureRandom)): Improve exception message.

-- 
Andrew :)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
-------------- next part --------------
Index: gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java,v
retrieving revision 1.3
diff -u -u -r1.3 SecretKeyGeneratorImpl.java
--- gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java	26 Jun 2006 13:30:14 -0000	1.3
+++ gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java	16 Nov 2008 02:49:06 -0000
@@ -97,7 +97,8 @@
   {
     keySize >>>= 3; // Use bytes.
     if (! keySizes.contains(Integer.valueOf(keySize)))
-      throw new InvalidParameterException("unsupported key size: " + keySize);
+      throw new InvalidParameterException("unsupported key size: " + keySize 
+					  + ", valid sizes are: " + keySizes);
     currentKeySize = keySize;
     this.random = random;
     init = true;


More information about the Classpath-patches mailing list