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 14:50:22 UTC
[ws-wss4j] 01/02: 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 master
in repository https://gitbox.apache.org/repos/asf/ws-wss4j.git
commit 70c768d571ffec3347691c392d9bf5dead44e18d
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 8468424..9135ecf 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
@@ -283,7 +283,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;
@@ -460,7 +460,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();