You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2021/03/02 12:27:32 UTC

[flink-statefun] 01/01: [hotfix] Check that incoming / outgoing invocation Messages are non-empty

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

tzulitai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 5a286c633358f64aee0ed258df52fa00538436b4
Author: Tzu-Li (Gordon) Tai <tz...@apache.org>
AuthorDate: Tue Mar 2 20:16:27 2021 +0800

    [hotfix] Check that incoming / outgoing invocation Messages are non-empty
    
    This closes #205.
---
 .../org/apache/flink/statefun/sdk/java/message/MessageWrapper.java    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/statefun-sdk-java/src/main/java/org/apache/flink/statefun/sdk/java/message/MessageWrapper.java b/statefun-sdk-java/src/main/java/org/apache/flink/statefun/sdk/java/message/MessageWrapper.java
index 74c5955..1eb5e2c 100644
--- a/statefun-sdk-java/src/main/java/org/apache/flink/statefun/sdk/java/message/MessageWrapper.java
+++ b/statefun-sdk-java/src/main/java/org/apache/flink/statefun/sdk/java/message/MessageWrapper.java
@@ -35,6 +35,10 @@ public final class MessageWrapper implements Message {
 
   public MessageWrapper(Address targetAddress, TypedValue typedValue) {
     this.targetAddress = Objects.requireNonNull(targetAddress);
+
+    if (!typedValue.getHasValue()) {
+      throw new IllegalStateException("Unset empty Messages are prohibited.");
+    }
     this.typedValue = Objects.requireNonNull(typedValue);
   }