[java-xmltooling COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/xml/encryption/Decrypte...

noreply at shibboleth.net noreply at shibboleth.net
Thu Jun 6 01:13:53 EDT 2013


Author: putmanb
Date: Thu Jun  6 01:13:52 2013
New Revision: 810

URL: http://svn.shibboleth.net/view/java-xmltooling?rev=810&view=rev
Log:
JXT-102: Decrypter should be defensive about Santuario and Java crypto classes throwing unchecked exceptions 

Modified:
    branches/REL_1/doc/RELEASE-NOTES.txt
    branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java

Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/doc/RELEASE-NOTES.txt?rev=810&r1=809&r2=810&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt Thu Jun  6 01:13:52 2013
@@ -1,3 +1,7 @@
+Changes in Release 1.4.1
+=============================================
+[JXT-102] - Decrypter should be defensive about Santuario and Java crypto classes throwing unchecked exceptions 
+
 Changes in Release 1.4.0
 =============================================
 [JXT-24] - Support for CDATA content

Modified: branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java?rev=810&r1=809&r2=810&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java (original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/encryption/Decrypter.java Thu Jun  6 01:13:52 2013
@@ -586,6 +586,11 @@
         } catch (XMLEncryptionException e) {
             log.error("Error decrypting the encrypted data element", e);
             throw new DecryptionException("Error decrypting the encrypted data element", e);
+        } catch (Exception e) {
+            // Catch anything else, esp. unchecked RuntimeException, and convert to our checked type.
+            // BouncyCastle in particular is known to throw unchecked exceptions for what we would 
+            // consider "routine" failures.
+            throw new DecryptionException("Probable runtime exception on decryption:" + e.getMessage(), e);
         }
         if (bytes == null) {
             throw new DecryptionException("EncryptedData could not be decrypted");
@@ -693,6 +698,11 @@
         } catch (XMLEncryptionException e) {
             log.error("Error decrypting encrypted key", e);
             throw new DecryptionException("Error decrypting encrypted key", e);
+        }  catch (Exception e) {
+            // Catch anything else, esp. unchecked RuntimeException, and convert to our checked type.
+            // BouncyCastle in particular is known to throw unchecked exceptions for what we would 
+            // consider "routine" failures.
+            throw new DecryptionException("Probable runtime exception on decryption:" + e.getMessage(), e);
         }
         if (key == null) {
             throw new DecryptionException("Key could not be decrypted");



More information about the commits mailing list