Source:
<code>private void EndCommandAction() { CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); VdcReturnValueBase vdcReturnValue = null; ExecutionContext context = null; boolean endActionRuntimeException = false; AsyncTasks dbAsyncTask = getParameters().getDbAsyncTask(); ArrayList<VdcActionParametersBase> imagesParameters = new ArrayList<VdcActionParametersBase>(); for (EndedTaskInfo taskInfo : entityInfo.getEndedTasksInfo().getTasksInfo()) { VdcActionParametersBase childTaskParameters = taskInfo.getTaskParameters().getDbAsyncTask().getTaskParameters(); boolean childTaskGroupSuccess = childTaskParameters.getTaskGroupSuccess() && taskInfo.getTaskStatus().getTaskEndedSuccessfully(); childTaskParameters .setTaskGroupSuccess(childTaskGroupSuccess); if (!childTaskParameters.equals(dbAsyncTask.getActionParameters())) { imagesParameters.add(childTaskParameters); } } dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters); try { log.infoFormat("CommandAsyncTask::EndCommandAction [within thread] context: Attempting to EndAction '{0}', executionIndex: '{1}'", dbAsyncTask.getActionParameters().getCommandType(), dbAsyncTask.getActionParameters().getExecutionIndex()); try { Guid stepId = dbAsyncTask.getStepId(); if (stepId != null) { context = ExecutionHandler.createFinalizingContext(stepId); } vdcReturnValue = Backend.getInstance().endAction(getEndActionType(dbAsyncTask), dbAsyncTask.getActionParameters(), new CommandContext(context)); } catch (VdcBLLException ex) { log.error(getErrorMessage()); log.error(ex.toString()); log.debug(ex); } catch (RuntimeException ex) { log.error(getErrorMessage(), ex); endActionRuntimeException = true; } } catch (RuntimeException Ex2) { log.error( "CommandAsyncTask::EndCommandAction [within thread]: An exception has been thrown (not related to 'EndAction' itself)", Ex2); endActionRuntimeException = true; } finally { if (endActionRuntimeException) { handleEndActionRuntimeException(entityInfo, dbAsyncTask); <START> return; <END> } boolean isTaskGroupSuccess = dbAsyncTask.getActionParameters().getTaskGroupSuccess(); handleEndActionResult(entityInfo, vdcReturnValue, context, isTaskGroupSuccess); } }</code><technical_language>a big fan of if..return idiom. else statement</technical_language>

Target:
private void EndCommandAction() { CommandMultiAsyncTasks entityInfo = GetCommandMultiAsyncTasks(); VdcReturnValueBase vdcReturnValue = null; ExecutionContext context = null; boolean endActionRuntimeException = false; AsyncTasks dbAsyncTask = getParameters().getDbAsyncTask(); ArrayList<VdcActionParametersBase> imagesParameters = new ArrayList<VdcActionParametersBase>(); for (EndedTaskInfo taskInfo : entityInfo.getEndedTasksInfo().getTasksInfo()) { VdcActionParametersBase childTaskParameters = taskInfo.getTaskParameters().getDbAsyncTask().getTaskParameters(); boolean childTaskGroupSuccess = childTaskParameters.getTaskGroupSuccess() && taskInfo.getTaskStatus().getTaskEndedSuccessfully(); childTaskParameters .setTaskGroupSuccess(childTaskGroupSuccess); if (!childTaskParameters.equals(dbAsyncTask.getActionParameters())) { imagesParameters.add(childTaskParameters); } } dbAsyncTask.getActionParameters().setImagesParameters(imagesParameters); try { log.infoFormat("CommandAsyncTask::EndCommandAction [within thread] context: Attempting to EndAction '{0}', executionIndex: '{1}'", dbAsyncTask.getActionParameters().getCommandType(), dbAsyncTask.getActionParameters().getExecutionIndex()); try { Guid stepId = dbAsyncTask.getStepId(); if (stepId != null) { context = ExecutionHandler.createFinalizingContext(stepId); } vdcReturnValue = Backend.getInstance().endAction(getEndActionType(dbAsyncTask), dbAsyncTask.getActionParameters(), new CommandContext(context)); } catch (VdcBLLException ex) { log.error(getErrorMessage()); log.error(ex.toString()); log.debug(ex); } catch (RuntimeException ex) { log.error(getErrorMessage(), ex); endActionRuntimeException = true; } } catch (RuntimeException Ex2) { log.error( "CommandAsyncTask::EndCommandAction [within thread]: An exception has been thrown (not related to 'EndAction' itself)", Ex2); endActionRuntimeException = true; } finally { if (endActionRuntimeException) { handleEndActionRuntimeException(entityInfo, dbAsyncTask); } else { boolean isTaskGroupSuccess = dbAsyncTask.getActionParameters().getTaskGroupSuccess(); handleEndActionResult(entityInfo, vdcReturnValue, context, isTaskGroupSuccess); } } }