ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [ws-wss4j] branch 2_2_x-fixes updated: Fixing potential NPEs when searching for elements, if the Ids are null
Date Wed, 15 Apr 2020 15:00:23 GMT
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 <coheigea@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();


Mime
View raw message