This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository
https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git
The following commit(s) were added to refs/heads/dev by this push:
new 95a4ac2 [STREAMPIPES-170] Null pointer in JSEvaluator
95a4ac2 is described below
commit 95a4ac2698f64fa0d98beb576ea98036f0b2213a
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Jul 7 17:13:50 2020 +0200
[STREAMPIPES-170] Null pointer in JSEvaluator
---
.../processors/enricher/jvm/processor/jseval/JSEval.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/jseval/JSEval.java
b/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/jseval/JSEval.java
index fcb0e93..9f9b44e 100644
---
a/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/jseval/JSEval.java
+++
b/streampipes-processors-enricher-jvm/src/main/java/org/apache/streampipes/processors/enricher/jvm/processor/jseval/JSEval.java
@@ -55,8 +55,11 @@ public class JSEval implements
EventProcessor<JSEvalParameters> {
try {
final Map<String, Object> eventData = event.getRaw();
Object result = ((Invocable) engine).invokeFunction("process",
eventData);
- Map<String, Object> output = (Map<String, Object>) result;
- output.forEach(outEvent::addField);
+ if (result != null) {
+ Map<String, Object> output = (Map<String, Object>) result;
+ output.forEach(outEvent::addField);
+ outputCollector.collect(outEvent);
+ }
} catch (ScriptException e) {
throw new SpRuntimeException("Error in script: " + e.getMessage());
} catch (ClassCastException e) {
@@ -64,7 +67,6 @@ public class JSEval implements
EventProcessor<JSEvalParameters> {
} catch (NoSuchMethodException e) {
throw new SpRuntimeException("`process(event){ return {}; };`
method not found in script: " + code);
}
- outputCollector.collect(outEvent);
}
@Override