ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1340057 - /webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java
Date Fri, 18 May 2012 09:58:11 GMT
Author: coheigea
Date: Fri May 18 09:58:10 2012
New Revision: 1340057

URL: http://svn.apache.org/viewvc?rev=1340057&view=rev
Log:
Avoid some NPEs in the OpenSAMLUtil

Modified:
    webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java?rev=1340057&r1=1340056&r2=1340057&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/saml/ext/OpenSAMLUtil.java
Fri May 18 09:58:10 2012
@@ -83,7 +83,15 @@ public final class OpenSAMLUtil {
      * @throws UnmarshallingException
      */
     public static XMLObject fromDom(Element root) throws WSSecurityException {
+        if (root == null) {
+            LOG.debug("Attempting to unmarshal a null element!");
+            throw new WSSecurityException("Error unmarshalling a SAML assertion");
+        }
         Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(root);
+        if (unmarshaller == null) {
+            LOG.debug("Unable to find an unmarshaller for element: " + root.getLocalName());
+            throw new WSSecurityException("Error unmarshalling a SAML assertion");
+        }
         try {
             return unmarshaller.unmarshall(root);
         } catch (UnmarshallingException ex) {



Mime
View raw message