This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b059c6f5 [ISSUE #3725]Not annotated parameter overrides 
@ParametersAreNonnullByDefault parameter[PravegaCloudEventWriter]
7b059c6f5 is described below

commit 7b059c6f58b3b3f23a9ed4792b556aa4c32d0998
Author: pandaapo <[email protected]>
AuthorDate: Wed May 3 23:56:41 2023 +0800

    [ISSUE #3725]Not annotated parameter overrides 
@ParametersAreNonnullByDefault parameter[PravegaCloudEventWriter]
---
 .../storage/knative/cloudevent/impl/KnativeMessageWriter.java  | 10 +++++++---
 .../storage/pravega/client/PravegaCloudEventWriter.java        |  7 +++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/cloudevent/impl/KnativeMessageWriter.java
 
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/cloudevent/impl/KnativeMessageWriter.java
index 5c8df1b5f..273ee30d6 100644
--- 
a/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/cloudevent/impl/KnativeMessageWriter.java
+++ 
b/eventmesh-storage-plugin/eventmesh-storage-knative/src/main/java/org/apache/eventmesh/storage/knative/cloudevent/impl/KnativeMessageWriter.java
@@ -17,10 +17,14 @@
 
 package org.apache.eventmesh.storage.knative.cloudevent.impl;
 
+import org.apache.commons.lang3.ObjectUtils;
+
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
 import java.util.Properties;
 
+import javax.annotation.Nullable;
+
 import io.cloudevents.CloudEvent;
 import io.cloudevents.CloudEventData;
 import io.cloudevents.SpecVersion;
@@ -57,19 +61,19 @@ public class KnativeMessageWriter implements 
MessageWriter<CloudEventWriter<Stri
 
     @Override
     public String end() throws CloudEventRWException {
-        if (message != null && message.getData() != null) {
+        if (ObjectUtils.allNotNull(message, message.getData())) {
             return message.getData().toString();
         }
         throw CloudEventRWException.newOther(new 
IllegalArgumentException("message data is null"));
     }
 
     @Override
-    public CloudEventContextWriter withContextAttribute(String name, String 
value) throws CloudEventRWException {
+    public CloudEventContextWriter withContextAttribute(@Nullable String name, 
@Nullable String value) throws CloudEventRWException {
         return null;
     }
 
     @Override
-    public String setEvent(EventFormat format, byte[] value) throws 
CloudEventRWException {
+    public String setEvent(@Nullable EventFormat format, @Nullable byte[] 
value) throws CloudEventRWException {
         return null;
     }
 
diff --git 
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/client/PravegaCloudEventWriter.java
 
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/client/PravegaCloudEventWriter.java
index ebc2c70e3..25c59edea 100644
--- 
a/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/client/PravegaCloudEventWriter.java
+++ 
b/eventmesh-storage-plugin/eventmesh-storage-pravega/src/main/java/org/apache/eventmesh/storage/pravega/client/PravegaCloudEventWriter.java
@@ -19,6 +19,9 @@ package org.apache.eventmesh.storage.pravega.client;
 
 import java.nio.charset.StandardCharsets;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import io.cloudevents.CloudEventData;
 import io.cloudevents.SpecVersion;
 import io.cloudevents.core.format.EventFormat;
@@ -39,7 +42,7 @@ public class PravegaCloudEventWriter
     }
 
     @Override
-    public PravegaEvent setEvent(EventFormat format, byte[] value) throws 
CloudEventRWException {
+    public PravegaEvent setEvent(@Nullable EventFormat format, @Nonnull byte[] 
value) throws CloudEventRWException {
         pravegaEvent.setData(new String(value, StandardCharsets.UTF_8));
         return pravegaEvent;
     }
@@ -57,7 +60,7 @@ public class PravegaCloudEventWriter
     }
 
     @Override
-    public CloudEventContextWriter withContextAttribute(String name, String 
value) throws CloudEventRWException {
+    public CloudEventContextWriter withContextAttribute(@Nonnull String name, 
@Nonnull String value) throws CloudEventRWException {
         pravegaEvent.getExtensions().put(name, value);
         return this;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to