You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/05/14 18:59:55 UTC
[incubator-pulsar] branch master updated: check record returned by
source is not null (#1767)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 5d6fee3 check record returned by source is not null (#1767)
5d6fee3 is described below
commit 5d6fee39864c4446321dd3a353bb47d4cf6fb945
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Mon May 14 11:59:53 2018 -0700
check record returned by source is not null (#1767)
---
.../pulsar/functions/instance/JavaInstanceRunnable.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
index aec1e8e..4f66d41 100644
--- a/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
+++ b/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java
@@ -321,12 +321,21 @@ public class JavaInstanceRunnable implements AutoCloseable, Runnable {
}
private Record readInput() {
+ Record record;
try {
- return this.source.read();
+ record = this.source.read();
} catch (Exception e) {
- log.info("Encountered exception in source write: ", e);
+ log.info("Encountered exception in source read: ", e);
throw new RuntimeException(e);
}
+
+ // check record is valid
+ if (record == null) {
+ throw new IllegalArgumentException("The record returned by the source cannot be null");
+ } else if (record.getValue() == null) {
+ throw new IllegalArgumentException("The value in the record returned by the source cannot be null");
+ }
+ return record;
}
@Override
--
To stop receiving notification emails like this one, please contact
sijie@apache.org.