Skip to content

Commit ca37484

Browse files
committed
getLocalName causes NPE if xml has \n
getLocalName causes NullPointerExceptions if the XML is fancy formatted with new lines. This is because getLocalName() will always return null if the node type is not Element or Attribute. The libraries treat new lines in SubjectConfirmation as child nodes which causes getLocalName() to be null.
1 parent 06984a3 commit ca37484

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/com/onelogin/saml/Response.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public boolean isValid(String... requestId){
193193

194194
NodeList subjectConfirmationDataNodes = scn.getChildNodes();
195195
for(int c = 0; c < subjectConfirmationDataNodes.getLength(); c++){
196-
if(subjectConfirmationDataNodes.item(c).getLocalName().equals("SubjectConfirmationData")){
196+
if(subjectConfirmationDataNodes.item(c).getLocalName() != null && subjectConfirmationDataNodes.item(c).getLocalName().equals("SubjectConfirmationData")){
197197

198198
Node recipient = subjectConfirmationDataNodes.item(c).getAttributes().getNamedItem("Recipient");
199199
if(recipient != null && !recipient.getNodeValue().isEmpty() && !recipient.getNodeValue().equals(currentUrl)){

0 commit comments

Comments
 (0)