You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/02/12 16:43:44 UTC

svn commit: r1445206 - /cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java

Author: coheigea
Date: Tue Feb 12 15:43:44 2013
New Revision: 1445206

URL: http://svn.apache.org/r1445206
Log:
Merged revisions 1445204 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1445204 | coheigea | 2013-02-12 15:40:57 +0000 (Tue, 12 Feb 2013) | 2 lines

  Throw an exception if there is an error trying to load a Crypto properties file

........

Modified:
    cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java

Modified: cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java?rev=1445206&r1=1445205&r2=1445206&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java (original)
+++ cxf/branches/2.7.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java Tue Feb 12 15:43:44 2013
@@ -371,13 +371,16 @@ public class PolicyBasedWSS4JInIntercept
         } else if (e != null) {
             URL propsURL = getPropertiesFileURL(e, message);
             Properties props = getProps(e, propsURL, message);
-            if (props != null) {
-                encrCrypto = CryptoFactory.getInstance(props);
-                
-                EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
-                synchronized (info) {
-                    info.setProperty(SecurityConstants.ENCRYPT_CRYPTO, encrCrypto);
-                }
+            if (props == null) {
+                LOG.fine("Cannot find Crypto Encryption properties: " + e);
+                throw new WSSecurityException("Cannot find Crypto Encryption properties: " + e);
+            }
+            
+            encrCrypto = CryptoFactory.getInstance(props);
+
+            EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
+            synchronized (info) {
+                info.setProperty(SecurityConstants.ENCRYPT_CRYPTO, encrCrypto);
             }
         }
         return encrCrypto;
@@ -390,13 +393,16 @@ public class PolicyBasedWSS4JInIntercept
         } else if (s != null) {
             URL propsURL = getPropertiesFileURL(s, message);
             Properties props = getProps(s, propsURL, message);
-            if (props != null) {
-                signCrypto = CryptoFactory.getInstance(props);
-                
-                EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
-                synchronized (info) {
-                    info.setProperty(SecurityConstants.SIGNATURE_CRYPTO, signCrypto);
-                }
+            if (props == null) {
+                LOG.fine("Cannot find Crypto Signature properties: " + s);
+                throw new WSSecurityException("Cannot find Crypto Signature properties: " + s);
+            }
+            
+            signCrypto = CryptoFactory.getInstance(props);
+
+            EndpointInfo info = message.getExchange().get(Endpoint.class).getEndpointInfo();
+            synchronized (info) {
+                info.setProperty(SecurityConstants.SIGNATURE_CRYPTO, signCrypto);
             }
         }
         return signCrypto;