ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1660427 - in /webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom: message/ message/token/ processor/ transform/ validate/
Date Tue, 17 Feb 2015 15:56:58 GMT
Author: coheigea
Date: Tue Feb 17 15:56:58 2015
New Revision: 1660427

URL: http://svn.apache.org/r1660427
Log:
Multi catch work for ws-security-dom

Modified:
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/AttachmentContentSignatureTransform.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
Tue Feb 17 15:56:58 2015
@@ -273,11 +273,7 @@ public class WSSecEncryptedKey extends W
             } else {
                 cipher.init(Cipher.WRAP_MODE, remoteCert.getPublicKey(), oaepParameterSpec);
             }
-        } catch (InvalidKeyException e) {
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
-            );
-        } catch (InvalidAlgorithmParameterException e) {
+        } catch (InvalidKeyException | InvalidAlgorithmParameterException e) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.FAILED_ENCRYPTION, e
             );
@@ -291,15 +287,7 @@ public class WSSecEncryptedKey extends W
         
         try {
             encryptedEphemeralKey = cipher.wrap(secretKey);
-        } catch (IllegalStateException ex) {
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILED_ENCRYPTION, ex
-            );
-        } catch (IllegalBlockSizeException ex) {
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILED_ENCRYPTION, ex
-            );
-        } catch (InvalidKeyException ex) {
+        } catch (IllegalStateException | IllegalBlockSizeException | InvalidKeyException
ex) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.FAILED_ENCRYPTION, ex
             );

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
Tue Feb 17 15:56:58 2015
@@ -158,9 +158,7 @@ public class WSSecSignatureBase extends
                                 );
 
                         attachmentReferenceList.add(reference);
-                    } catch (InvalidAlgorithmParameterException e) {
-                        throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
e);
-                    } catch (NoSuchAlgorithmException e) {
+                    } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException
e) {
                         throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
e);
                     }
                 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
Tue Feb 17 15:56:58 2015
@@ -104,13 +104,9 @@ public class BinarySecurity {
 
         try {
             callbackHandler.handle(callback);
-        } catch (IOException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             throw new IllegalStateException(
-                "IOException while creating a token element", e
-            );
-        } catch (UnsupportedCallbackException e) {
-            throw new IllegalStateException(
-                "UnsupportedCallbackException while creating a token element", e
+                "Exception while creating a token element", e
             );
         }
         element = callback[0].getTokenElement();

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
Tue Feb 17 15:56:58 2015
@@ -120,11 +120,9 @@ public class KerberosSecurity extends Bi
         KerberosContextAndServiceNameCallback contextAndServiceNameCallback = new KerberosContextAndServiceNameCallback();
         try {
             callbackHandler.handle(new Callback[]{contextAndServiceNameCallback});
-        } catch (IOException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
-        } catch (UnsupportedCallbackException e) {
-            throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
-        } 
+        }
 
         String jaasLoginModuleName = contextAndServiceNameCallback.getContextName();
         if (jaasLoginModuleName == null) {

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
Tue Feb 17 15:56:58 2015
@@ -563,14 +563,7 @@ public class UsernameToken {
         }
         try {
             data.getCallbackHandler().handle(new Callback[]{pwCb});
-        } catch (IOException e) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(e.getMessage(), e);
-            }
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, e
-            );
-        } catch (UnsupportedCallbackException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug(e.getMessage(), e);
             }

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
Tue Feb 17 15:56:58 2015
@@ -392,16 +392,8 @@ public class ReferenceListProcessor impl
                 attachmentResultCallback.setAttachmentId(resultAttachment.getId());
                 attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
 
-            } catch (UnsupportedCallbackException e) {
-                throw new WSSecurityException(
-                        WSSecurityException.ErrorCode.FAILED_CHECK, e);
-            } catch (IOException e) {
-                throw new WSSecurityException(
-                        WSSecurityException.ErrorCode.FAILED_CHECK, e);
-            } catch (NoSuchAlgorithmException e) {
-                throw new WSSecurityException(
-                        WSSecurityException.ErrorCode.FAILED_CHECK, e);
-            } catch (NoSuchPaddingException e) {
+            } catch (UnsupportedCallbackException | IOException
+                | NoSuchAlgorithmException | NoSuchPaddingException e) {
                 throw new WSSecurityException(
                         WSSecurityException.ErrorCode.FAILED_CHECK, e);
             }

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
Tue Feb 17 15:56:58 2015
@@ -109,13 +109,7 @@ public class SecurityContextTokenProcess
         try {
             Callback[] callbacks = new Callback[]{callback};
             cb.handle(callbacks);
-        } catch (IOException e) {
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILURE, 
-                "noKey",
-                e,
-                identifier);
-        } catch (UnsupportedCallbackException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.FAILURE, 
                 "noKey",

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
Tue Feb 17 15:56:58 2015
@@ -102,13 +102,7 @@ public final class X509Util {
                 new WSPasswordCallback(keyName, WSPasswordCallback.SECRET_KEY);
         try {
             cb.handle(new Callback[]{pwCb});
-        } catch (IOException e) {
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILURE,
-                "noPassword",
-                e,
-                keyName);
-        } catch (UnsupportedCallbackException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.FAILURE,
                 "noPassword",

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/AttachmentContentSignatureTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/AttachmentContentSignatureTransform.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/AttachmentContentSignatureTransform.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/AttachmentContentSignatureTransform.java
Tue Feb 17 15:56:58 2015
@@ -230,15 +230,8 @@ public class AttachmentContentSignatureT
                         attachmentUri, mimeType);
             }
             return null;
-        } catch (IOException e) {
-            throw new TransformException(e);
-        } catch (InvalidCanonicalizerException e) {
-            throw new TransformException(e);
-        } catch (CanonicalizationException e) {
-            throw new TransformException(e);
-        } catch (ParserConfigurationException e) {
-            throw new TransformException(e);
-        } catch (SAXException e) {
+        } catch (IOException | InvalidCanonicalizerException | CanonicalizationException
+            | ParserConfigurationException | SAXException e) {
             throw new TransformException(e);
         }
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java?rev=1660427&r1=1660426&r2=1660427&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java
Tue Feb 17 15:56:58 2015
@@ -167,14 +167,7 @@ public class UsernameTokenValidator impl
             new WSPasswordCallback(user, null, pwType, WSPasswordCallback.USERNAME_TOKEN);
         try {
             data.getCallbackHandler().handle(new Callback[]{pwCb});
-        } catch (IOException e) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug(e.getMessage(), e);
-            }
-            throw new WSSecurityException(
-                WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, e
-            );
-        } catch (UnsupportedCallbackException e) {
+        } catch (IOException | UnsupportedCallbackException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug(e.getMessage(), e);
             }



Mime
View raw message