Source:
<code>private ExecutableFlow updateExecution(Map<String, Object> updateData) throws ExecutorManagerException { Integer execId = (Integer) updateData.get(ConnectorParams.UPDATE_MAP_EXEC_ID); if (execId == null) { throw new ExecutorManagerException( "Response is malformed. Need exec id to update."); } Pair<ExecutionReference, ExecutableFlow> refPair = this.runningFlows.get(execId); if (refPair == null) { throw new ExecutorManagerException( "No running flow found with the execution id. Removing " + execId); } ExecutionReference ref = refPair.getFirst(); ExecutableFlow flow = refPair.getSecond(); if (updateData.containsKey("error")) { throw new ExecutorManagerException((String) updateData.get("error"), flow); } ref.setNextCheckTime(0); ref.setNumErrors(0); Status oldStatus = flow.getStatus(); flow.applyUpdateObject(updateData); Status newStatus = flow.getStatus(); <START> if(oldStatus != newStatus && Status.isStatusFailed(newStatus)) { <END> CommonMetrics.INSTANCE.markFlowFail(); } ExecutionOptions options = flow.getExecutionOptions(); if (oldStatus != newStatus && newStatus.equals(Status.FAILED_FINISHING)) { if (options.getNotifyOnFirstFailure()) { Alerter mailAlerter = alerters.get("email"); try { mailAlerter.alertOnFirstError(flow); } catch (Exception e) { e.printStackTrace(); logger.error("Failed to send first error email." + e.getMessage()); } } if (options.getFlowParameters().containsKey("alert.type")) { String alertType = options.getFlowParameters().get("alert.type"); Alerter alerter = alerters.get(alertType); if (alerter != null) { try { alerter.alertOnFirstError(flow); } catch (Exception e) { e.printStackTrace(); logger.error("Failed to alert by " + alertType); } } else { logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert."); } } } return flow; }</code><technical_language>compare Status this, equals</technical_language>

Target:
private ExecutableFlow updateExecution(Map<String, Object> updateData) throws ExecutorManagerException { Integer execId = (Integer) updateData.get(ConnectorParams.UPDATE_MAP_EXEC_ID); if (execId == null) { throw new ExecutorManagerException( "Response is malformed. Need exec id to update."); } Pair<ExecutionReference, ExecutableFlow> refPair = this.runningFlows.get(execId); if (refPair == null) { throw new ExecutorManagerException( "No running flow found with the execution id. Removing " + execId); } ExecutionReference ref = refPair.getFirst(); ExecutableFlow flow = refPair.getSecond(); if (updateData.containsKey("error")) { throw new ExecutorManagerException((String) updateData.get("error"), flow); } ref.setNextCheckTime(0); ref.setNumErrors(0); Status oldStatus = flow.getStatus(); flow.applyUpdateObject(updateData); Status newStatus = flow.getStatus(); if(oldStatus != newStatus && newStatus == Status.FAILED) { CommonMetrics.INSTANCE.markFlowFail(); } ExecutionOptions options = flow.getExecutionOptions(); if (oldStatus != newStatus && newStatus.equals(Status.FAILED_FINISHING)) { if (options.getNotifyOnFirstFailure()) { Alerter mailAlerter = alerters.get("email"); try { mailAlerter.alertOnFirstError(flow); } catch (Exception e) { e.printStackTrace(); logger.error("Failed to send first error email." + e.getMessage()); } } if (options.getFlowParameters().containsKey("alert.type")) { String alertType = options.getFlowParameters().get("alert.type"); Alerter alerter = alerters.get(alertType); if (alerter != null) { try { alerter.alertOnFirstError(flow); } catch (Exception e) { e.printStackTrace(); logger.error("Failed to alert by " + alertType); } } else { logger.error("Alerter type " + alertType + " doesn't exist. Failed to alert."); } } } return flow; }