Source:
<code>protected void process (Tuple input, StreamlineEvent event) { try { StreamlineEvent toProcess = null; <START> if (inputSchemaMap == null || inputSchemaMap.isEmpty() || !inputSchemaMap.containsKey(input.getSourceStreamId())) { <END> toProcess = event; } else { Map<String, Object> mappedEvent = new HashMap<>(); for (Map.Entry<String, String> entry: inputSchemaMap.get(input.getSourceStreamId()).entrySet()) { if (event.get(entry.getValue()) != null) { mappedEvent.put(entry.getKey(), event.get(entry.getValue())); } } toProcess = new StreamlineEventImpl(mappedEvent, event.getDataSourceId(), event.getId(), event.getHeader(), input.getSourceStreamId(), event .getAuxiliaryFieldsAndValues()); } List<StreamlineEvent> results = customProcessorRuntime.process(toProcess); if (results != null) { Schema schema = outputSchema.values().iterator().next(); String outputStream = outputSchema.keySet().iterator().next(); for (StreamlineEvent e : results) { Map<String, Object> newFieldsAndValues = new HashMap<>(); for (Schema.Field field: schema.getFields()) { newFieldsAndValues.put(field.getName(), e.containsKey(field.getName()) ? e.get(field.getName()) : event.get(field.getName())); } StreamlineEvent toEmit = new StreamlineEventImpl(newFieldsAndValues, e.getDataSourceId(), e.getId(), e.getHeader(), outputStream, e.getAuxiliaryFieldsAndValues()); collector.emit(outputStream, input, new Values(toEmit)); } } } catch (ProcessingException e) { LOG.error("Custom Processor threw a ProcessingException. ", e); throw new RuntimeException(e); } }</code><technical_language>1. empty null? This a private final initialized empty map. 2. get retrieve mapping based stream id if check for null reuse in else</technical_language>

Target:
protected void process (Tuple input, StreamlineEvent event) { try { StreamlineEvent toProcess = null; if (inputSchemaMap == null || inputSchemaMap.isEmpty() || !inputSchemaMap.containsKey(input.getSourceStreamId())) { toProcess = event; } else { Map<String, Object> mappedEventMap = new HashMap<>(); for (Map.Entry<String, String> entry: inputSchemaMap.get(input.getSourceStreamId()).entrySet()) { if (event.get(entry.getValue()) != null) { mappedEventMap.put(entry.getKey(), event.get(entry.getValue())); } } toProcess = StreamlineEventImpl.builder() .from(event) .sourceStream(input.getSourceStreamId()) .fieldsAndValues(mappedEventMap) .build(); } List<StreamlineEvent> results = customProcessorRuntime.process(toProcess); if (results != null) { Schema schema = outputSchema.values().iterator().next(); String outputStream = outputSchema.keySet().iterator().next(); for (StreamlineEvent e : results) { Map<String, Object> newFieldsAndValues = new HashMap<>(); for (Schema.Field field: schema.getFields()) { newFieldsAndValues.put(field.getName(), e.containsKey(field.getName()) ? e.get(field.getName()) : event.get(field.getName())); } StreamlineEvent toEmit = StreamlineEventImpl.builder() .from(e) .sourceStream(outputStream) .fieldsAndValues(newFieldsAndValues) .build(); collector.emit(outputStream, input, new Values(toEmit)); } } } catch (ProcessingException e) { LOG.error("Custom Processor threw a ProcessingException. ", e); throw new RuntimeException(e); } }