diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/Header.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/Header.java index 864cec2127..86699845c2 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/Header.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/Header.java @@ -49,7 +49,7 @@ public Header(int code, String desc, String seq, Map properties) } public void putProperty(final String name, final Object value) { - if (null == this.properties) { + if (this.properties == null) { this.properties = new HashMap<>(); } @@ -57,7 +57,7 @@ public void putProperty(final String name, final Object value) { } public Object getProperty(final String name) { - if (null == this.properties) { + if (this.properties == null) { return null; } return this.properties.get(name); @@ -65,7 +65,7 @@ public Object getProperty(final String name) { public String getStringProperty(final String name) { Object property = getProperty(name); - if (null == property) { + if (property == null) { return null; } return property.toString(); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java index c24ef94a8e..a593a837e7 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java @@ -132,7 +132,7 @@ protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception try { target = (ByteBuf) super.decode(ctx, in); - if (null == target) { + if (target == null) { return null; } byte[] flagBytes = parseFlag(target); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java index f22389ffde..998735181e 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/IPUtils.java @@ -161,7 +161,7 @@ private static String normalizeHostAddress(final InetAddress localHost) { } public static String parseChannelRemoteAddr(final Channel channel) { - if (null == channel) { + if (channel == null) { return ""; } SocketAddress remote = channel.remoteAddress(); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ThreadUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ThreadUtils.java index 002530a542..72447509e1 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ThreadUtils.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/ThreadUtils.java @@ -56,7 +56,7 @@ public static void sleep(long timeout, TimeUnit timeUnit) { } public static void sleepWithThrowException(long timeout, TimeUnit timeUnit) throws InterruptedException { - if (null == timeUnit) { + if (timeUnit == null) { return; } timeUnit.sleep(timeout); diff --git a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java index ff41855e36..754461875f 100644 --- a/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java +++ b/eventmesh-connectors/eventmesh-connector-dingtalk/src/main/java/org/apache/eventmesh/connector/dingtalk/sink/connector/DingDingSinkConnector.java @@ -127,7 +127,7 @@ public void put(List sinkRecords) { orgGroupSendHeaders.xAcsDingtalkAccessToken = accessToken; String templateTypeKey = record.getExtension(ConnectRecordExtensionKeys.DINGTALK_TEMPLATE_TYPE); - if (null == templateTypeKey || "null".equals(templateTypeKey)) { + if (templateTypeKey == null || "null".equals(templateTypeKey)) { templateTypeKey = DingDingMessageTemplateType.PLAIN_TEXT.getTemplateType(); } DingDingMessageTemplateType templateType = DingDingMessageTemplateType.of(templateTypeKey); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java index 014af30868..acd8730c2e 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/dialect/mysql/MysqlDatabaseDialect.java @@ -162,7 +162,7 @@ public String getDefaultDatabase() { @Override public boolean databaseExists(String databaseName) throws CatalogException { - if (null == databaseName || databaseName.trim().isEmpty()) { + if (databaseName == null || databaseName.trim().isEmpty()) { return false; } List databases = listDatabases(); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java index 49e9c53a15..be38ffb75a 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/SourceJdbcTaskManager.java @@ -64,7 +64,7 @@ public void init() { } private void doHandleEvent(Event event) { - if (null == event) { + if (event == null) { return; } JdbcConnectData jdbcConnectData = event.getJdbcConnectData(); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java index 147509e12d..645e5c9eca 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java @@ -289,7 +289,7 @@ public EventMeshGtidSet filterGtidSet(MysqlJdbcContext offsetContext, EventMeshG */ private void eventMeshMysqlEventListener(Event event, MysqlJdbcContext context) { - if (null == event) { + if (event == null) { return; } final EventHeader eventHeader = event.getHeader(); @@ -366,7 +366,7 @@ public void run() { Event event = null; try { event = eventQueue.poll(5, TimeUnit.SECONDS); - if (null == event) { + if (event == null) { continue; } eventHandlers.getOrDefault(event.getHeader().getEventType(), ignore -> ignoreEvent(context, ignore)).accept(event); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/mysql/MysqlDataTypeConvertor.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/mysql/MysqlDataTypeConvertor.java index f187e71fbd..322e4f5f18 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/mysql/MysqlDataTypeConvertor.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/mysql/MysqlDataTypeConvertor.java @@ -116,7 +116,7 @@ public EventMeshDataType toEventMeshType(MysqlType connectorDataType, MapMysql doc */ - if (null == dataTypeProperties) { + if (dataTypeProperties == null) { return BytesEventMeshDataType.INSTANCE; } Integer precision = (Integer) dataTypeProperties.get(MysqlDataTypeConvertor.PRECISION); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/mysql/MysqlSnapshotEngine.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/mysql/MysqlSnapshotEngine.java index a707029012..e76ab49a3e 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/mysql/MysqlSnapshotEngine.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/snapshot/mysql/MysqlSnapshotEngine.java @@ -311,7 +311,7 @@ public void run() { while (isRunning) { try { Event event = eventQueue.poll(5, TimeUnit.SECONDS); - if (null == event) { + if (event == null) { continue; } consumers.forEach(consumer -> consumer.accept(event)); diff --git a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/table/catalog/mysql/MysqlDefaultValueConvertorImpl.java b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/table/catalog/mysql/MysqlDefaultValueConvertorImpl.java index 699f4fd4f5..1832f17d77 100644 --- a/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/table/catalog/mysql/MysqlDefaultValueConvertorImpl.java +++ b/eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/table/catalog/mysql/MysqlDefaultValueConvertorImpl.java @@ -60,7 +60,7 @@ public class MysqlDefaultValueConvertorImpl implements DefaultValueConvertor { @Override public Object parseDefaultValue(Column column, String defaultValueExpression) { - if (null == defaultValueExpression) { + if (defaultValueExpression == null) { return null; } defaultValueExpression = defaultValueExpression.trim(); diff --git a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java index e61940ce3d..4797d58ef9 100644 --- a/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java +++ b/eventmesh-connectors/eventmesh-connector-lark/src/main/java/org/apache/eventmesh/connector/lark/sink/ImServiceHandler.java @@ -230,7 +230,7 @@ private CreateMessageReq convertCreateMessageReq(ConnectRecord connectRecord) { .uuid(UUID.randomUUID().toString()); String templateTypeKey = connectRecord.getExtension(ConnectRecordExtensionKeys.TEMPLATE_TYPE_4_LARK); - if (null == templateTypeKey || "null".equals(templateTypeKey)) { + if (templateTypeKey == null || "null".equals(templateTypeKey)) { templateTypeKey = LarkMessageTemplateType.PLAIN_TEXT.getTemplateKey(); } LarkMessageTemplateType templateType = LarkMessageTemplateType.of(templateTypeKey); diff --git a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/EventMeshListenerBeanPostProcessor.java b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/EventMeshListenerBeanPostProcessor.java index b36e308412..f6c9605f6e 100644 --- a/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/EventMeshListenerBeanPostProcessor.java +++ b/eventmesh-connectors/eventmesh-connector-spring/src/main/java/org/apache/eventmesh/connector/spring/sink/EventMeshListenerBeanPostProcessor.java @@ -97,7 +97,7 @@ public void run(String... args) throws Exception { while (sinkConnector.isRunning()) { try { poll = sinkConnector.getQueue().poll(annotation.requestTimeout(), TimeUnit.SECONDS); - if (null == poll || null == poll.getData()) { + if (poll == null || poll.getData() == null) { continue; } String messageBody = new String((byte[]) poll.getData()); diff --git a/eventmesh-examples/src/main/java/org/apache/eventmesh/tcp/demo/pub/cloudevents/SyncRequest.java b/eventmesh-examples/src/main/java/org/apache/eventmesh/tcp/demo/pub/cloudevents/SyncRequest.java index 4be5e2569d..1fe1371b37 100644 --- a/eventmesh-examples/src/main/java/org/apache/eventmesh/tcp/demo/pub/cloudevents/SyncRequest.java +++ b/eventmesh-examples/src/main/java/org/apache/eventmesh/tcp/demo/pub/cloudevents/SyncRequest.java @@ -65,7 +65,7 @@ public static void main(String[] args) throws Exception { final Package response = client.rr(event, EventMeshCommon.DEFAULT_TIME_OUT_MILLS); // check-NPE EventFormat final EventFormat eventFormat = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE); - if (null == eventFormat) { + if (eventFormat == null) { log.error("eventFormat is null. end the process"); return; } @@ -75,7 +75,7 @@ public static void main(String[] args) throws Exception { // check-NPE CloudEventData final CloudEventData cloudEventData = replyEvent.getData(); - if (null == cloudEventData) { + if (cloudEventData == null) { log.error("replyEvent.data is null. end the process"); return; } diff --git a/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdMetaService.java b/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdMetaService.java index bde4e08704..9d56db249c 100644 --- a/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdMetaService.java +++ b/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdMetaService.java @@ -93,7 +93,7 @@ public void init() throws MetaException { eventMeshRegisterInfoMap = new ConcurrentHashMap<>(ConfigurationContextUtil.KEYS.size()); for (String key : ConfigurationContextUtil.KEYS) { CommonConfiguration commonConfiguration = ConfigurationContextUtil.get(key); - if (null == commonConfiguration) { + if (commonConfiguration == null) { continue; } if (StringUtils.isBlank(commonConfiguration.getMetaStorageAddr())) { diff --git a/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java b/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java index ca612ae07f..92abcf837e 100644 --- a/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java +++ b/eventmesh-meta/eventmesh-meta-nacos/src/main/java/org/apache/eventmesh/meta/nacos/service/NacosMetaService.java @@ -109,7 +109,7 @@ public void init() throws MetaException { eventMeshRegisterInfoMap = new ConcurrentHashMap<>(ConfigurationContextUtil.KEYS.size()); for (String key : ConfigurationContextUtil.KEYS) { CommonConfiguration commonConfiguration = ConfigurationContextUtil.get(key); - if (null == commonConfiguration) { + if (commonConfiguration == null) { continue; } if (StringUtils.isBlank(commonConfiguration.getMetaStorageAddr())) { diff --git a/eventmesh-meta/eventmesh-meta-zookeeper/src/main/java/org/apache/eventmesh/meta/zookeeper/service/ZookeeperMetaService.java b/eventmesh-meta/eventmesh-meta-zookeeper/src/main/java/org/apache/eventmesh/meta/zookeeper/service/ZookeeperMetaService.java index 844ab18047..359e7427f0 100644 --- a/eventmesh-meta/eventmesh-meta-zookeeper/src/main/java/org/apache/eventmesh/meta/zookeeper/service/ZookeeperMetaService.java +++ b/eventmesh-meta/eventmesh-meta-zookeeper/src/main/java/org/apache/eventmesh/meta/zookeeper/service/ZookeeperMetaService.java @@ -86,7 +86,7 @@ public void init() throws MetaException { eventMeshRegisterInfoMap = new ConcurrentHashMap<>(ConfigurationContextUtil.KEYS.size()); for (String key : ConfigurationContextUtil.KEYS) { CommonConfiguration commonConfiguration = ConfigurationContextUtil.get(key); - if (null == commonConfiguration) { + if (commonConfiguration == null) { continue; } if (StringUtils.isBlank(commonConfiguration.getMetaStorageAddr())) { @@ -285,7 +285,7 @@ public void removeMetaData(String key) { public boolean register(EventMeshRegisterInfo eventMeshRegisterInfo) throws MetaException { try { String[] ipPort = eventMeshRegisterInfo.getEndPoint().split(ZookeeperConstant.IP_PORT_SEPARATOR); - if (null == ipPort || ipPort.length < 2) { + if (ipPort == null || ipPort.length < 2) { return false; } String ip = ipPort[0]; diff --git a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java index 787adbc3f7..8d4e9dade8 100644 --- a/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java +++ b/eventmesh-openconnect/eventmesh-openconnect-offsetmgmt-plugin/eventmesh-openconnect-offsetmgmt-nacos/src/main/java/org/apache/eventmesh/openconnect/offsetmgmt/nacos/NacosConfigService.java @@ -69,7 +69,7 @@ public void start() { // merge the updated connectorRecord & recordOffset to memory store public void mergeOffset(ConnectorRecordPartition connectorRecordPartition, RecordOffset recordOffset) { - if (null == connectorRecordPartition || connectorRecordPartition.getPartition().isEmpty()) { + if (connectorRecordPartition == null || connectorRecordPartition.getPartition().isEmpty()) { return; } if (positionStore.getKVMap().containsKey(connectorRecordPartition)) { @@ -172,7 +172,7 @@ public void putPosition(ConnectorRecordPartition partition, RecordOffset positio @Override public void removePosition(List partitions) { - if (null == partitions) { + if (partitions == null) { return; } for (ConnectorRecordPartition partition : partitions) { diff --git a/eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java b/eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java index a00d1852a9..ad48ad59dd 100644 --- a/eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java +++ b/eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java @@ -52,7 +52,7 @@ public static List buildBatchEvents(CloudEventBatch c } public static EventMeshCloudEventWrapper buildEventMeshCloudEvent(io.cloudevents.CloudEvent cloudEvent) { - if (null == cloudEvent) { + if (cloudEvent == null) { return new EventMeshCloudEventWrapper(null); } try { diff --git a/eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java b/eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java index d07760f91e..19a1cbc43e 100644 --- a/eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java +++ b/eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/grpc/GrpcEventMeshCloudEventProtocolResolver.java @@ -39,7 +39,7 @@ public class GrpcEventMeshCloudEventProtocolResolver { private static final EventFormat eventFormat = EventFormatProvider.getInstance().resolveFormat(ProtobufFormat.PROTO_CONTENT_TYPE); public static io.cloudevents.CloudEvent buildEvent(CloudEvent cloudEvent) { - if (null == cloudEvent) { + if (cloudEvent == null) { return null; } io.cloudevents.CloudEvent event = eventFormat.deserialize(cloudEvent.toByteArray()); @@ -47,7 +47,7 @@ public static io.cloudevents.CloudEvent buildEvent(CloudEvent cloudEvent) { } public static EventMeshCloudEventWrapper buildEventMeshCloudEvent(io.cloudevents.CloudEvent cloudEvent) { - if (null == cloudEvent) { + if (cloudEvent == null) { return new EventMeshCloudEventWrapper(null); } try { diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java index c59c7e3570..5920103009 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java @@ -66,7 +66,7 @@ public static boolean validateCloudEventAttributes(CloudEvent cloudEvent) { } public static boolean validateCloudEventBatchAttributes(CloudEventBatch cloudEventBatch) { - if (null == cloudEventBatch || cloudEventBatch.getEventsCount() < 1) { + if (cloudEventBatch == null || cloudEventBatch.getEventsCount() < 1) { return false; } List eventsList = cloudEventBatch.getEventsList(); @@ -99,7 +99,7 @@ public static boolean validateCloudEventData(CloudEvent cloudEvent) { } public static boolean validateCloudEventBatchData(CloudEventBatch cloudEventBatch) { - if (null == cloudEventBatch || cloudEventBatch.getEventsCount() < 1) { + if (cloudEventBatch == null || cloudEventBatch.getEventsCount() < 1) { return false; } List eventsList = cloudEventBatch.getEventsList(); diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java index f8dc942fa6..38d3019de3 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/HttpTinyClient.java @@ -35,7 +35,7 @@ public class HttpTinyClient { public static HttpResult httpGet(String url, List headers, List paramValues, String encoding, long readTimeoutMs) throws IOException { String encodedContent = encodingParams(paramValues, encoding); - url += (null == encodedContent) ? "" : ("?" + encodedContent); + url += (encodedContent == null) ? "" : ("?" + encodedContent); HttpURLConnection conn = null; try { @@ -65,7 +65,7 @@ public static HttpResult httpGet(String url, List headers, List private static String encodingParams(Collection paramValues, String encoding) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); - if (null == paramValues) { + if (paramValues == null) { return null; } diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java index 2e365c0534..de20617318 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/RemotingHelper.java @@ -48,7 +48,7 @@ public static SocketAddress string2SocketAddress(final String addr) { } public static String parseChannelRemoteAddr(final Channel channel) { - if (null == channel) { + if (channel == null) { return ""; } @@ -67,7 +67,7 @@ public static String parseChannelRemoteAddr(final Channel channel) { } public static String parseChannelLocalAddr(final Channel channel) { - if (null == channel) { + if (channel == null) { return ""; } diff --git a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/common/Codec.java b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/common/Codec.java index ee57b78bcc..26670754df 100644 --- a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/common/Codec.java +++ b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/client/common/Codec.java @@ -94,7 +94,7 @@ public void decode(ChannelHandlerContext ctx, ByteBuf in, List out) thro int bodyLength = 0; try { - if (null == in) { + if (in == null) { return; } diff --git a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/EventMeshMessageProducer.java b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/EventMeshMessageProducer.java index 229fb29715..95740a4664 100644 --- a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/EventMeshMessageProducer.java +++ b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/producer/EventMeshMessageProducer.java @@ -51,7 +51,7 @@ public EventMeshMessageProducer(EventMeshGrpcClientConfig clientConfig, Publishe @Override public Response publish(EventMeshMessage message) { - if (null == message) { + if (message == null) { return null; } diff --git a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/util/EventMeshCloudEventBuilder.java b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/util/EventMeshCloudEventBuilder.java index f89715054b..f7ab40c20a 100644 --- a/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/util/EventMeshCloudEventBuilder.java +++ b/eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/util/EventMeshCloudEventBuilder.java @@ -236,7 +236,7 @@ public static CloudEventBatch buildEventMeshCloudEventBatch(final List me @SuppressWarnings("unchecked") public static T buildMessageFromEventMeshCloudEvent(final CloudEvent cloudEvent, final EventMeshProtocolType protocolType) { - if (null == cloudEvent) { + if (cloudEvent == null) { return null; } final String seq = EventMeshCloudEventUtils.getSeqNum(cloudEvent); @@ -251,7 +251,7 @@ public static T buildMessageFromEventMeshCloudEvent(final CloudEvent cloudEv }); } - if (null == protocolType) { + if (protocolType == null) { return null; } diff --git a/eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java b/eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java index ac55f88c9d..41ceca5490 100644 --- a/eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java +++ b/eventmesh-security-plugin/eventmesh-security-auth-token/src/main/java/org/apache/eventmesh/auth/token/impl/auth/AuthTokenUtils.java @@ -55,7 +55,7 @@ public static void authTokenByPublicKey(AclProperties aclProperties) { token = token.replace("Bearer ", ""); for (String key : ConfigurationContextUtil.KEYS) { CommonConfiguration commonConfiguration = ConfigurationContextUtil.get(key); - if (null == commonConfiguration) { + if (commonConfiguration == null) { continue; } if (StringUtils.isBlank(commonConfiguration.getEventMeshSecurityPublickey())) { @@ -98,7 +98,7 @@ public static void helloTaskAuthTokenByPublicKey(AclProperties aclProperties) { token = token.replace("Bearer ", ""); for (String key : ConfigurationContextUtil.KEYS) { CommonConfiguration commonConfiguration = ConfigurationContextUtil.get(key); - if (null == commonConfiguration) { + if (commonConfiguration == null) { continue; } if (StringUtils.isBlank(commonConfiguration.getEventMeshSecurityPublickey())) { diff --git a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java index d332a6c7b3..4a7e0869c9 100644 --- a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java +++ b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/eventmesh/storage/rocketmq/consumer/PushConsumerImpl.java @@ -72,7 +72,7 @@ public PushConsumerImpl(final Properties properties) { } this.rocketmqPushConsumer.setNamesrvAddr(accessPoints.replace(',', ';')); String consumerGroup = clientConfig.getConsumerId(); - if (null == consumerGroup || consumerGroup.isEmpty()) { + if (consumerGroup == null || consumerGroup.isEmpty()) { throw new StorageRuntimeException( "Consumer Group is necessary for RocketMQ, please set it."); } diff --git a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java index f58a20ceae..08b7b4aaf8 100644 --- a/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java +++ b/eventmesh-storage-plugin/eventmesh-storage-rocketmq/src/main/java/org/apache/rocketmq/client/impl/consumer/ConsumeMessageConcurrentlyService.java @@ -441,7 +441,7 @@ public void run() { hasException = true; } long consumeRT = System.currentTimeMillis() - beginTimestamp; - if (null == status) { + if (status == null) { if (hasException) { returnType = ConsumeReturnType.EXCEPTION; } else { @@ -457,7 +457,7 @@ public void run() { Objects.requireNonNull(consumeMessageContext).getProps().put(MixAll.CONSUME_CONTEXT_TYPE, returnType.name()); } - if (null == status) { + if (status == null) { log.warn("consumeMessage return null, Group: {} Msgs: {} MQ: {}", ConsumeMessageConcurrentlyService.this.consumerGroup, msgs,