Source:
<code>public void processTuple(byte[] tuple) { if (tuple == null) { <START> if (err.isConnected()) { <END> err.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); logger.error("Tuple could not be parsed. Reason Blank/null tuple"); } errorTupleCount++; return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, getHeader())) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, "Blank/header tuple")); logger.error("Tuple could not be parsed. Reason Blank/header tuple"); } errorTupleCount++; return; } if (incomingString.length() < recordLength) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, "Record length mis-match/shorter tuple")); logger.error("Tuple could not be parsed. Reason Record length mis-match/shorter tuple"); } errorTupleCount++; return; } if (incomingString.length() > recordLength) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, "Record length mis-match/longer tuple")); logger.error("Tuple could not be parsed. Reason Record length mis-match/longer tuple"); } errorTupleCount++; return; } try { String[] values = univocityParser.parseLine(incomingString); HashMap<String, Object> toEmit = new HashMap(); Object pojo = fixedWidthValidator.validate(values, toEmit); if (parsedOutput.isConnected()) { parsedOutput.emit(toEmit); parsedOutputCount++; } if (out.isConnected() && clazz != null) { out.emit(pojo); emittedObjectCount++; } } catch (Exception e) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(incomingString, e.getMessage())); } errorTupleCount++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); } }</code><technical_language>Do this globally for error emits</technical_language>

Target:
public void processTuple(byte[] tuple) { if (tuple == null) { if (err.isConnected()) { err.emit(new KeyValPair<String, String>(null, "Blank/null tuple")); logger.error("Tuple could not be parsed. Reason Blank/null tuple"); } errorTupleCount++; return; } String incomingString = new String(tuple); if (StringUtils.isBlank(incomingString) || StringUtils.equals(incomingString, getHeader())) { if (err.isConnected()) { err.emit(new KeyValPair<>(incomingString, "Blank/header tuple")); logger.error("Tuple could not be parsed. Reason Blank/header tuple"); } errorTupleCount++; return; } if (incomingString.length() < recordLength) { if (err.isConnected()) { err.emit(new KeyValPair<>(incomingString, "Record length mis-match/shorter tuple")); } logger.error("Tuple could not be parsed. Reason Record length mis-match/shorter tuple. " + "Expected length " + recordLength + " Actual length " + incomingString.length()); errorTupleCount++; return; } if (incomingString.length() > recordLength) { if (err.isConnected()) { err.emit(new KeyValPair<>(incomingString, "Record length mis-match/longer tuple")); } logger.error("Tuple could not be parsed. Reason Record length mis-match/longer tuple. " + "Expected length " + recordLength + " Actual length " + incomingString.length()); errorTupleCount++; return; } try { String[] values = univocityParser.parseLine(incomingString); HashMap<String, Object> toEmit = new HashMap(); Object pojo = validateAndSet(values, toEmit); if (parsedOutput.isConnected()) { parsedOutput.emit(toEmit); parsedOutputCount++; } if (out.isConnected() && clazz != null) { out.emit(pojo); emittedObjectCount++; } } catch (Exception e) { if (err.isConnected()) { err.emit(new KeyValPair<>(incomingString, e.getMessage())); } errorTupleCount++; logger.error("Tuple could not be parsed. Reason {}", e.getMessage()); } }