You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/02/14 20:41:43 UTC
[incubator-streampipes] 02/03: [STREAMPIPES-494] Avoid NullPointer in transform output strategy
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch experimental-module-federation-494
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit f9db920af7e65721e242b098f82c32efbe55a165
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Mon Feb 14 21:23:34 2022 +0100
[STREAMPIPES-494] Avoid NullPointer in transform output strategy
---
.../output/TransformOutputSchemaGenerator.java | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/TransformOutputSchemaGenerator.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/TransformOutputSchemaGenerator.java
index 269c59f..370740b 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/TransformOutputSchemaGenerator.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/output/TransformOutputSchemaGenerator.java
@@ -60,14 +60,20 @@ public class TransformOutputSchemaGenerator extends OutputSchemaGenerator<Transf
staticProperties);
if (mappingPropertyOpt.isPresent()) {
- Optional<EventProperty> eventPropertyOpt = findEventProperty(mappingPropertyOpt.get().getSelectedProperty()
- , inSchema
- .getEventProperties());
-
- if (eventPropertyOpt.isPresent()) {
- EventProperty eventProperty = eventPropertyOpt.get();
- modifiedEventProperties.put(eventProperty.getElementId(), modifyEventProperty(cloneEp(eventProperty), to,
- staticProperties));
+ MappingPropertyUnary mappingProperty = mappingPropertyOpt.get();
+ String selectedProperty = mappingProperty.getSelectedProperty();
+
+ if (selectedProperty != null) {
+ Optional<EventProperty> eventPropertyOpt = findEventProperty(
+ mappingPropertyOpt.get().getSelectedProperty(),
+ inSchema.getEventProperties()
+ );
+
+ if (eventPropertyOpt.isPresent()) {
+ EventProperty eventProperty = eventPropertyOpt.get();
+ modifiedEventProperties.put(eventProperty.getElementId(), modifyEventProperty(cloneEp(eventProperty), to,
+ staticProperties));
+ }
}
}
});