Source:
private void evaluatePatch(Context context, HttpServletRequest request, WorkspaceItem source, WorkspaceItemRest wsi, String section, Operation op) { boolean sectionExist = false; SubmissionConfig submissionConfig = submissionConfigReader .getSubmissionConfigByName(wsi.getSubmissionDefinition().getName()); for (int stepNum = 0; stepNum < submissionConfig.getNumberOfSteps(); stepNum++) { SubmissionStepConfig stepConfig = submissionConfig.getStep(stepNum); if (section.equals(stepConfig.getId())) { sectionExist = true; ClassLoader loader = this.getClass().getClassLoader(); Class stepClass; try { stepClass = loader.loadClass(stepConfig.getProcessingClassName()); Object stepInstance = stepClass.newInstance(); if (stepInstance instanceof AbstractRestProcessingStep) { AbstractRestProcessingStep stepProcessing = (AbstractRestProcessingStep) stepClass.newInstance(); stepProcessing.doPreProcessing(context, source); stepProcessing.doPatchProcessing(context, getRequestService().getCurrentRequest(), source, op, stepConfig); stepProcessing.doPostProcessing(context, source); } else { throw new DSpaceBadRequestException( "The submission step class specified by '" + stepConfig.getProcessingClassName() + "' does not extend the class org.dspace.submit.AbstractProcessingStep!" + " Therefore it cannot be used by the Configurable Submission as the <processing-class>!"); } } catch (UnprocessableEntityException e) { log.error(e.getMessage(), e); throw new UnprocessableEntityException("Error processing the patch request", e); } catch (Exception e) { log.error(e.getMessage(), e); throw new PatchException("Error processing the patch request", e); } } } if (!sectionExist) { throw new UnprocessableEntityException("The section with name " + section + " does not exist in this submission!"); } }

Target:
private void evaluatePatch(Context context, HttpServletRequest request, WorkspaceItem source, WorkspaceItemRest wsi, String section, Operation op) { boolean sectionExist = false; SubmissionConfig submissionConfig = submissionConfigReader .getSubmissionConfigByName(wsi.getSubmissionDefinition().getName()); for (int stepNum = 0; stepNum < submissionConfig.getNumberOfSteps(); stepNum++) { SubmissionStepConfig stepConfig = submissionConfig.getStep(stepNum); if (section.equals(stepConfig.getId())) { sectionExist = true; ClassLoader loader = this.getClass().getClassLoader(); Class stepClass; try { stepClass = loader.loadClass(stepConfig.getProcessingClassName()); Object stepInstance = stepClass.newInstance(); if (stepInstance instanceof AbstractRestProcessingStep) { AbstractRestProcessingStep stepProcessing = (AbstractRestProcessingStep) stepClass.newInstance(); stepProcessing.doPreProcessing(context, source); stepProcessing.doPatchProcessing(context, getRequestService().getCurrentRequest(), source, op, stepConfig); stepProcessing.doPostProcessing(context, source); } else { throw new DSpaceBadRequestException( "The submission step class specified by '" + stepConfig.getProcessingClassName() + "' does not extend the class org.dspace.submit.AbstractProcessingStep!" + " Therefore it cannot be used by the Configurable Submission as the <processing-class>!"); } } catch (UnprocessableEntityException e) { throw e; } catch (Exception e) { log.error(e.getMessage(), e); throw new PatchException("Error processing the patch request", e); } } } if (!sectionExist) { throw new UnprocessableEntityException("The section with name " + section + " does not exist in this submission!"); } }