Skip to content

Commit 0f6a8af

Browse files
GH-10083: Apply Nullability to syslog module
Related to: #10083 Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
1 parent a065eb8 commit 0f6a8af

File tree

8 files changed

+25
-13
lines changed

8 files changed

+25
-13
lines changed

spring-integration-syslog/src/main/java/org/springframework/integration/syslog/DefaultMessageConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.util.Map.Entry;
2424
import java.util.Set;
2525

26+
import org.jspecify.annotations.Nullable;
27+
2628
import org.springframework.beans.factory.BeanFactory;
2729
import org.springframework.beans.factory.BeanFactoryAware;
2830
import org.springframework.integration.support.DefaultMessageBuilderFactory;
@@ -53,7 +55,7 @@ public class DefaultMessageConverter implements MessageConverter, BeanFactoryAwa
5355

5456
private volatile boolean asMap = true;
5557

56-
private BeanFactory beanFactory;
58+
private @Nullable BeanFactory beanFactory;
5759

5860
/**
5961
* Set false will leave the payload as the original complete syslog.

spring-integration-syslog/src/main/java/org/springframework/integration/syslog/RFC5424SyslogParser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24+
import org.jspecify.annotations.Nullable;
25+
2426
import org.springframework.integration.JavaUtils;
2527
import org.springframework.util.Assert;
2628

@@ -131,7 +133,7 @@ public RFC5424SyslogParser(boolean retainOriginal) {
131133
* @param r the reader.
132134
* @return the timestamp.
133135
*/
134-
protected Object getTimestamp(Reader r) {
136+
protected @Nullable Object getTimestamp(Reader r) {
135137

136138
int c = r.getc();
137139

@@ -152,7 +154,7 @@ protected Object getTimestamp(Reader r) {
152154
return dateBuilder.toString();
153155
}
154156

155-
private Object getStructuredData(Reader r) {
157+
private @Nullable Object getStructuredData(Reader r) {
156158
if (r.is(NILVALUE)) {
157159
r.getc();
158160
return null;

spring-integration-syslog/src/main/java/org/springframework/integration/syslog/config/SyslogReceivingChannelAdapterFactoryBean.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.integration.syslog.config;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.beans.factory.BeanNameAware;
2022
import org.springframework.beans.factory.config.AbstractFactoryBean;
2123
import org.springframework.context.ApplicationEventPublisher;
@@ -47,31 +49,31 @@ public enum Protocol {
4749
udp, tcp
4850
}
4951

50-
private volatile SyslogReceivingChannelAdapterSupport syslogAdapter;
52+
private volatile @Nullable SyslogReceivingChannelAdapterSupport syslogAdapter;
5153

5254
private final Protocol protocol;
5355

54-
private volatile MessageChannel outputChannel;
56+
private volatile @Nullable MessageChannel outputChannel;
5557

5658
private volatile boolean autoStartup = true;
5759

58-
private volatile MessageChannel errorChannel;
60+
private volatile @Nullable MessageChannel errorChannel;
5961

6062
private volatile int phase;
6163

62-
private volatile Long sendTimeout;
64+
private volatile @Nullable Long sendTimeout;
6365

64-
private volatile AbstractServerConnectionFactory connectionFactory;
66+
private volatile @Nullable AbstractServerConnectionFactory connectionFactory;
6567

66-
private volatile UnicastReceivingChannelAdapter udpAdapter;
68+
private volatile @Nullable UnicastReceivingChannelAdapter udpAdapter;
6769

68-
private volatile Integer port;
70+
private volatile @Nullable Integer port;
6971

70-
private volatile MessageConverter converter;
72+
private volatile @Nullable MessageConverter converter;
7173

72-
private volatile String beanName;
74+
private volatile @Nullable String beanName;
7375

74-
private volatile ApplicationEventPublisher applicationEventPublisher;
76+
private volatile @Nullable ApplicationEventPublisher applicationEventPublisher;
7577

7678
/**
7779
* Instantiates a factory bean that creates a {@link UdpSyslogReceivingChannelAdapter}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* Provides classes for configuration - parsers, namespace handlers, factory beans.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.syslog.config;

spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/TcpSyslogReceivingChannelAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636
public class TcpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdapterSupport
3737
implements TcpListener, ApplicationEventPublisherAware {
3838

39+
@SuppressWarnings("NullAway.Init")
3940
private volatile AbstractServerConnectionFactory connectionFactory;
4041

42+
@SuppressWarnings("NullAway.Init")
4143
private volatile ApplicationEventPublisher applicationEventPublisher;
4244

4345
/**

spring-integration-syslog/src/main/java/org/springframework/integration/syslog/inbound/UdpSyslogReceivingChannelAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*/
3131
public class UdpSyslogReceivingChannelAdapter extends SyslogReceivingChannelAdapterSupport {
3232

33+
@SuppressWarnings("NullAway.Init")
3334
private volatile UnicastReceivingChannelAdapter udpAdapter;
3435

3536
private volatile boolean udpAdapterSet;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* Provides classes for inbound endpoints.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.syslog.inbound;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
22
* Base package for Syslog Support.
33
*/
4+
@org.jspecify.annotations.NullMarked
45
package org.springframework.integration.syslog;

0 commit comments

Comments
 (0)