Source:
private static int validateBasedOnStatus(Props jobProps, Collection<String> errors, JobCallbackStatusEnum jobStatus, int maxNumCallback, int maxPostBodyLength) { int callbackCount = 0; String jobCallBackUrl = JOB_CALLBACK_URL_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name() .toLowerCase()); String requestMethod = JOB_CALLBACK_REQUEST_METHOD_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name().toLowerCase()); String httpBody = JOB_CALLBACK_BODY_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name() .toLowerCase()); for (int i = 1; i <= maxNumCallback; i++) { String callbackUrlKey = jobCallBackUrl.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String callbackUrlValue = jobProps.get(callbackUrlKey); if (callbackUrlValue == null || callbackUrlValue.length() == 0) { break; } else { String requestMethodKey = requestMethod.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String methodValue = jobProps.getString(requestMethodKey, HTTP_GET); if (HTTP_POST.equals(methodValue)) { String postBodyKey = httpBody.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String postBodyValue = jobProps.get(postBodyKey); if (postBodyValue == null || postBodyValue.length() == 0) { errors.add("No POST body was specified for job callback '" + callbackUrlValue + "'"); } else if (postBodyValue.length() > maxPostBodyLength) { errors.add("POST body length is : " + postBodyValue.length() + " which is larger than supported length of " + maxPostBodyLength); } else { callbackCount++; } } else if (HTTP_GET.equals(methodValue)) { callbackCount++; } else { errors.add("Unsupported request method: " + methodValue + " Only POST and GET are supported"); } } } return callbackCount; }

Target:
private static int validateBasedOnStatus(Props jobProps, Collection<String> errors, JobCallbackStatusEnum jobStatus, int maxNumCallback, int maxPostBodyLength) { int callbackCount = 0; String jobCallBackUrl = JOB_CALLBACK_URL_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name() .toLowerCase()); String requestMethod = JOB_CALLBACK_REQUEST_METHOD_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name().toLowerCase()); String httpBody = JOB_CALLBACK_BODY_TEMPLATE.replaceFirst(STATUS_TOKEN, jobStatus.name() .toLowerCase()); for (int i = 0; i <= maxNumCallback; i++) { String callbackUrlKey = jobCallBackUrl.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String callbackUrlValue = jobProps.get(callbackUrlKey); if (i == 0) { if (callbackUrlValue != null) { errors.add("Sequence number starts at 1, not 0"); } continue; } if (callbackUrlValue == null || callbackUrlValue.length() == 0) { break; } else { String requestMethodKey = requestMethod.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String methodValue = jobProps.getString(requestMethodKey, HTTP_GET); if (HTTP_POST.equals(methodValue)) { String postBodyKey = httpBody.replaceFirst(SEQUENCE_TOKEN, Integer.toString(i)); String postBodyValue = jobProps.get(postBodyKey); if (postBodyValue == null || postBodyValue.length() == 0) { errors.add("No POST body was specified for job callback '" + callbackUrlValue + "'"); } else if (postBodyValue.length() > maxPostBodyLength) { errors.add("POST body length is : " + postBodyValue.length() + " which is larger than supported length of " + maxPostBodyLength); } else { callbackCount++; } } else if (HTTP_GET.equals(methodValue)) { callbackCount++; } else { errors.add("Unsupported request method: " + methodValue + " Only POST and GET are supported"); } } } return callbackCount; }