Author: coheigea
Date: Tue Feb 12 15:40:57 2013
New Revision: 1445204
URL: http://svn.apache.org/r1445204
Log:
Throw an exception if there is an error trying to load a Crypto properties file
Modified:
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
Modified:
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java?rev=1445204&r1=1445203&r2=1445204&view=diff
==============================================================================
---
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
(original)
+++
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
Tue Feb 12 15:40:57 2013
@@ -366,13 +366,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;
@@ -385,13 +388,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;