Commit dc865458 authored by R.W.Majeed's avatar R.W.Majeed

fixed NPE

parent c31aa56b
......@@ -40,6 +40,7 @@ import de.sekmi.histream.Observation;
import de.sekmi.histream.ObservationException;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.ObservationHandler;
import de.sekmi.histream.ObservationProvider;
import de.sekmi.histream.ObservationSupplier;
import de.sekmi.histream.Plugin;
import de.sekmi.histream.conf.Configuration;
......@@ -123,8 +124,11 @@ public class RunConfiguration implements Closeable{
}
public void processFile(ObservationSupplier provider){
for( ObservationHandler h : destinationHandlers ){
h.setMeta("etl.strategy", provider.getMeta("etl.strategy"));
String etlStrategy = provider.getMeta(ObservationSupplier.META_ETL_STRATEGY);
if( etlStrategy != null ){
for( ObservationHandler h : destinationHandlers ){
h.setMeta(ObservationSupplier.META_ETL_STRATEGY, etlStrategy);
}
}
Streams.nonNullStream(provider).forEach(destinationChain);
}
......
......@@ -402,7 +402,12 @@ public class I2b2Inserter extends AbstractObservationHandler implements Observat
@Override
public void setMeta(String key, String value) {
Objects.requireNonNull(key);
if( key.equals("etl.strategy") ){
// use default strategy 'insert' for null values
if( value == null ){
value = "insert";
}
switch( value ){
case "replace-visit":
etlPreprocessor = new DistinctVisitPurge();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment