You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2013/04/12 11:50:49 UTC

svn commit: r1467227 - in /webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom: handler/WSHandler.java message/WSSecSignature.java

Author: coheigea
Date: Fri Apr 12 09:50:49 2013
New Revision: 1467227

URL: http://svn.apache.org/r1467227
Log:
Better Logging + error handling when a Signature Crypto instance isn't specified or cannot be loaded

Modified:
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java?rev=1467227&r1=1467226&r2=1467227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java Fri Apr 12 09:50:49 2013
@@ -925,6 +925,11 @@ public abstract class WSHandler {
                     cryptos.put(refId, crypto);
                 }
             }
+            if (crypto == null) {
+                log.warn("The Crypto reference " + refId + " specified by "
+                    + cryptoPropertyRefId + " could not be loaded"
+                );
+            }
         }
         
         //
@@ -939,7 +944,21 @@ public abstract class WSHandler {
                     cryptos.put(propFile, crypto);
                 }
             } 
+            if (crypto == null) {
+                if (propFile == null) {
+                    log.warn(
+                         "The Crypto properties file specified by "
+                         + cryptoPropertyFile + " is null"
+                    );
+                } else {
+                    log.warn(
+                         "The Crypto properties file " + propFile + " specified by "
+                         + cryptoPropertyFile + " could not be loaded or found"
+                    );
+                }
+            }
         }
+
         return crypto;
     }
 

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java?rev=1467227&r1=1467226&r2=1467227&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java Fri Apr 12 09:50:49 2013
@@ -781,6 +781,9 @@ public class WSSecSignature extends WSSe
             if (useThisCert == null) {
                 CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
                 cryptoType.setAlias(user);
+                if (crypto == null) {
+                    throw new WSSecurityException(WSSecurityException.FAILURE, "noSigCryptoFile");
+                }
                 certs = crypto.getX509Certificates(cryptoType);
             } else {
                 certs = new X509Certificate[] {useThisCert};