Skip to content

Commit a7a2726

Browse files
hduelmegregturn
authored andcommitted
Remove null checks from instanceof checks.
As of Java 11, the Jave language officially declares that instanceof checks include a null check, hence no need to do them in our code. Resolves #1326.
1 parent 1b6fb7d commit a7a2726

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

spring-ws-core/src/main/java/org/springframework/ws/server/endpoint/MethodEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public boolean equals(Object o) {
156156
if (this == o) {
157157
return true;
158158
}
159-
if (o != null && o instanceof MethodEndpoint) {
159+
if (o instanceof MethodEndpoint) {
160160
MethodEndpoint other = (MethodEndpoint) o;
161161
return this.bean.equals(other.bean) && this.method.equals(other.method);
162162
}

spring-ws-core/src/main/java/org/springframework/ws/server/endpoint/adapter/XPathParamAnnotationMethodEndpointAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected void invokeInternal(MessageContext messageContext, MethodEndpoint meth
127127
Element payloadElement = getRootElement(messageContext.getRequest().getPayloadSource());
128128
Object[] args = getMethodArguments(payloadElement, methodEndpoint.getMethod());
129129
Object result = methodEndpoint.invoke(args);
130-
if (result != null && result instanceof Source) {
130+
if (result instanceof Source) {
131131
Source responseSource = (Source) result;
132132
WebServiceMessage response = messageContext.getResponse();
133133
transform(responseSource, response.getPayloadResult());

spring-ws-core/src/main/java/org/springframework/ws/soap/addressing/core/EndpointReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public boolean equals(Object o) {
9090
if (this == o) {
9191
return true;
9292
}
93-
if (o != null && o instanceof EndpointReference) {
93+
if (o instanceof EndpointReference) {
9494
EndpointReference other = (EndpointReference) o;
9595
return address.equals(other.address);
9696
}

spring-ws-security/src/main/java/org/springframework/ws/soap/security/wss4j2/Wss4jSecurityInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ private void processPrincipal(WSHandlerResult result) {
852852
if (!CollectionUtils.isEmpty(results)) {
853853
WSSecurityEngineResult actionResult = results.get(0);
854854
Principal principal = (Principal) actionResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
855-
if (principal != null && principal instanceof WSUsernameTokenPrincipalImpl) {
855+
if (principal instanceof WSUsernameTokenPrincipalImpl) {
856856
WSUsernameTokenPrincipalImpl usernameTokenPrincipal = (WSUsernameTokenPrincipalImpl) principal;
857857
UsernameTokenPrincipalCallback callback = new UsernameTokenPrincipalCallback(usernameTokenPrincipal);
858858
try {

spring-xml/src/main/java/org/springframework/xml/namespace/QNameEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void setAsText(String text) throws IllegalArgumentException {
6262
@Override
6363
public String getAsText() {
6464
Object value = getValue();
65-
if (value == null || !(value instanceof QName)) {
65+
if (!(value instanceof QName)) {
6666
return "";
6767
} else {
6868
QName qName = (QName) value;

0 commit comments

Comments
 (0)