Skip to content

Commit 09840bb

Browse files
committed
Apply JSpecify null safety annotation improvements
- Use proper array nullability: `WebServiceMessageSender @nullable []` - Fix inner class annotation placement: `DefaultUriBuilderFactory.@nullable EncodingMode` - Set default Jaxb2Marshaller for gatewayMarshaller field Signed-off-by: Jooyoung Pyoung <[email protected]>
1 parent 9c94058 commit 09840bb

File tree

3 files changed

+19
-29
lines changed

3 files changed

+19
-29
lines changed

spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/BaseWsOutboundGatewaySpec.java

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.springframework.integration.dsl.MessageHandlerSpec;
2727
import org.springframework.integration.ws.AbstractWebServiceOutboundGateway;
2828
import org.springframework.integration.ws.SoapHeaderMapper;
29-
import org.springframework.web.util.DefaultUriBuilderFactory.EncodingMode;
29+
import org.springframework.web.util.DefaultUriBuilderFactory;
3030
import org.springframework.ws.WebServiceMessageFactory;
3131
import org.springframework.ws.client.core.FaultMessageResolver;
3232
import org.springframework.ws.client.core.WebServiceMessageCallback;
@@ -53,37 +53,27 @@ public abstract class BaseWsOutboundGatewaySpec<
5353

5454
private final Map<String, Expression> uriVariableExpressions = new HashMap<>();
5555

56-
@Nullable
57-
protected WebServiceTemplate template; // NOSONAR
56+
protected @Nullable WebServiceTemplate template; // NOSONAR
5857

59-
@Nullable
60-
protected DestinationProvider destinationProvider; // NOSONAR
58+
protected @Nullable DestinationProvider destinationProvider; // NOSONAR
6159

62-
@Nullable
63-
protected String uri; // NOSONAR
60+
protected @Nullable String uri; // NOSONAR
6461

65-
@Nullable
66-
protected WebServiceMessageFactory webServiceMessageFactory; // NOSONAR
62+
protected @Nullable WebServiceMessageFactory webServiceMessageFactory; // NOSONAR
6763

68-
@Nullable
69-
private SoapHeaderMapper headerMapper;
64+
private @Nullable SoapHeaderMapper headerMapper;
7065

71-
@Nullable
72-
private EncodingMode encodingMode;
66+
private DefaultUriBuilderFactory.@Nullable EncodingMode encodingMode;
7367

7468
private boolean ignoreEmptyResponses = true;
7569

76-
@Nullable
77-
private WebServiceMessageCallback requestCallback;
70+
private @Nullable WebServiceMessageCallback requestCallback;
7871

79-
@Nullable
80-
protected FaultMessageResolver faultMessageResolver; // NOSONAR
72+
protected @Nullable FaultMessageResolver faultMessageResolver; // NOSONAR
8173

82-
@SuppressWarnings("NullAway.Init")
83-
protected WebServiceMessageSender[] messageSenders; // NOSONAR
74+
protected WebServiceMessageSender @Nullable [] messageSenders; // NOSONAR
8475

85-
@SuppressWarnings("NullAway.Init")
86-
protected ClientInterceptor[] gatewayInterceptors; // NOSONAR
76+
protected ClientInterceptor @Nullable [] gatewayInterceptors; // NOSONAR
8777

8878
protected boolean extractPayload = true; // NOSONAR
8979

@@ -129,11 +119,11 @@ public S uriVariableExpressions(Map<String, Expression> uriVariableExpressions)
129119
}
130120

131121
/**
132-
* Specify a {@link EncodingMode} for uri construction.
122+
* Specify a {@link DefaultUriBuilderFactory.EncodingMode} for uri construction.
133123
* @param encodingMode to use for uri construction.
134124
* @return the spec
135125
*/
136-
public S encodingMode(EncodingMode encodingMode) {
126+
public S encodingMode(DefaultUriBuilderFactory.EncodingMode encodingMode) {
137127
this.encodingMode = encodingMode;
138128
return _this();
139129
}

spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/MarshallingWsOutboundGatewaySpec.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818

1919
import java.util.Arrays;
2020

21+
import org.jspecify.annotations.Nullable;
22+
2123
import org.springframework.integration.JavaUtils;
2224
import org.springframework.integration.ws.MarshallingWebServiceOutboundGateway;
2325
import org.springframework.oxm.Marshaller;
2426
import org.springframework.oxm.Unmarshaller;
27+
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
2528
import org.springframework.ws.WebServiceMessageFactory;
2629
import org.springframework.ws.client.core.FaultMessageResolver;
2730
import org.springframework.ws.client.core.WebServiceTemplate;
@@ -63,11 +66,9 @@ public static class MarshallingWsOutboundGatewayNoTemplateSpec
6366
extends BaseWsOutboundGatewaySpec<MarshallingWsOutboundGatewayNoTemplateSpec,
6467
MarshallingWebServiceOutboundGateway> {
6568

66-
@SuppressWarnings("NullAway.Init")
67-
protected Marshaller gatewayMarshaller; // NOSONAR
69+
protected Marshaller gatewayMarshaller = new Jaxb2Marshaller(); // NOSONAR
6870

69-
@SuppressWarnings("NullAway.Init")
70-
protected Unmarshaller gatewayUnmarshaller; // NOSONAR
71+
protected @Nullable Unmarshaller gatewayUnmarshaller; // NOSONAR
7172

7273
/**
7374
* Configure the marshaller to use.

spring-integration-ws/src/main/java/org/springframework/integration/ws/dsl/SimpleWsOutboundGatewaySpec.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
public class SimpleWsOutboundGatewaySpec
4242
extends BaseWsOutboundGatewaySpec<SimpleWsOutboundGatewaySpec, SimpleWebServiceOutboundGateway> {
4343

44-
@Nullable
45-
protected SourceExtractor<?> sourceExtractor; // NOSONAR
44+
protected @Nullable SourceExtractor<?> sourceExtractor; // NOSONAR
4645

4746
protected SimpleWsOutboundGatewaySpec(WebServiceTemplate template) {
4847
this.template = template;

0 commit comments

Comments
 (0)