Skip to content

Commit 6ef212a

Browse files
committed
Add missed NullMarked to the xml.router package
* Fix NullAway for the `xPathExpression.evaluateAsString()` call in the `XPathRouter`
1 parent 8e51516 commit 6ef212a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spring-integration-xml/src/main/java/org/springframework/integration/xml/router/XPathRouter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.HashMap;
2121
import java.util.List;
2222
import java.util.Map;
23+
import java.util.Objects;
2324

2425
import org.jspecify.annotations.Nullable;
2526
import org.w3c.dom.DOMException;
@@ -42,9 +43,9 @@
4243
*/
4344
public class XPathRouter extends AbstractMappingMessageRouter {
4445

45-
private final XPathExpression xPathExpression;
46+
private final NodeMapper<Object> nodeMapper = new TextContentNodeMapper();
4647

47-
private NodeMapper<Object> nodeMapper = new TextContentNodeMapper();
48+
private final XPathExpression xPathExpression;
4849

4950
private XmlPayloadConverter converter = new DefaultXmlPayloadConverter();
5051

@@ -116,7 +117,7 @@ public String getComponentType() {
116117
protected List<Object> getChannelKeys(Message<?> message) {
117118
Node node = this.converter.convertToNode(message.getPayload());
118119
if (this.evaluateAsString) {
119-
return Collections.singletonList(this.xPathExpression.evaluateAsString(node));
120+
return Collections.singletonList(Objects.requireNonNull(this.xPathExpression.evaluateAsString(node)));
120121
}
121122
else {
122123
return this.xPathExpression.evaluate(node, this.nodeMapper);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* Provides XML message routers.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.xml.router;

0 commit comments

Comments
 (0)