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 2020/04/15 15:00:23 UTC

[ws-wss4j] branch 2_2_x-fixes updated: Fixing potential NPEs when searching for elements, if the Ids are null

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 2_2_x-fixes
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git


The following commit(s) were added to refs/heads/2_2_x-fixes by this push:
     new 44431e3  Fixing potential NPEs when searching for elements, if the Ids are null
44431e3 is described below

commit 44431e36c6ae3d32c9a641ebc4dd6f74324ccea3
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Apr 15 15:22:37 2020 +0100

    Fixing potential NPEs when searching for elements, if the Ids are null
---
 .../src/main/java/org/apache/wss4j/common/util/XMLUtils.java          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java b/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
index 93bfde0..482202b 100755
--- a/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
+++ b/ws-security-common/src/main/java/org/apache/wss4j/common/util/XMLUtils.java
@@ -275,7 +275,7 @@ public final class XMLUtils {
         Element foundElement = null;
         String id = XMLUtils.getIDFromReference(value);
 
-        while (startNode != null) {
+        while (startNode != null && id != null) {
             // start node processing at this point
             if (startNode.getNodeType() == Node.ELEMENT_NODE) {
                 Element se = (Element) startNode;
@@ -452,7 +452,7 @@ public final class XMLUtils {
         // Replace the formerly recursive implementation with a depth-first-loop
         // lookup
         //
-        if (startNode == null) {
+        if (startNode == null || value == null) {
             return null;
         }
         Node startParent = startNode.getParentNode();