Source:
<code>private String getFileFromParameters(HttpMessage msg, Map<String, String> parameters) throws ApiException, IOException { String fileName = parameters.get("filename"); String historyReferenceId = parameters.get("historyReferenceId"); String host = msg.getRequestHeader().getHeader("host"); if (fileName == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "fileName"); } if (historyReferenceId == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "historyReferenceId"); } try { Integer.parseInt(historyReferenceId); } catch(NumberFormatException e) { throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "historyReferenceId"); } LOGGER.debug("fileName = " + fileName); LOGGER.debug("historyReferenceId = " + historyReferenceId); if (!fileName.equals("front-end-scanner.js")) { throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "fileName"); <START> } else { <END> String frontEndApiUrl = API .getInstance() .getCallBackUrl(this, "https://" + host); StringBuilder injectedContentBuilder = new StringBuilder(65000) .append("var frontEndScanner=(function() {"); appendFrontEndScannerCodeTo(injectedContentBuilder); injectedContentBuilder.append("})();"); String injectedContent = injectedContentBuilder .toString() .replace("<<HISTORY_REFERENCE_ID>>", historyReferenceId) .replace("<<ZAP_CALLBACK_ENDPOINT>>", frontEndApiUrl + "?action=createAlert"); injectedContent = placeUserScriptsInto(injectedContent); msg.setResponseBody(injectedContent); msg.setResponseHeader( API.getDefaultResponseHeader( "application/javascript; charset=UTF-8", msg.getResponseBody().length(), false)); return msg.getResponseBody().toString(); } }</code><technical_language>else removed, throws</technical_language>

Target:
private String getFileFromParameters(HttpMessage msg, Map<String, String> parameters) throws ApiException, IOException { String fileName = parameters.get("filename"); String historyReferenceId = parameters.get("historyReferenceId"); String host = msg.getRequestHeader().getHeader("host"); if (fileName == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "fileName"); } if (historyReferenceId == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "historyReferenceId"); } try { Integer.parseInt(historyReferenceId); } catch(NumberFormatException e) { throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "historyReferenceId"); } LOGGER.debug("fileName = " + fileName); LOGGER.debug("historyReferenceId = " + historyReferenceId); if (!fileName.equals("front-end-scanner.js")) { throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "fileName"); } String frontEndApiUrl = API .getInstance() .getCallBackUrl(this, "https://" + host); StringBuilder injectedContentBuilder = new StringBuilder(65000) .append("var frontEndScanner=(function() {"); appendFrontEndScannerCodeTo(injectedContentBuilder); injectedContentBuilder.append("})();"); String injectedContent = injectedContentBuilder .toString() .replace("<<HISTORY_REFERENCE_ID>>", historyReferenceId) .replace("<<ZAP_CALLBACK_ENDPOINT>>", frontEndApiUrl + "?action=createAlert"); injectedContent = placeUserScriptsInto(injectedContent); msg.setResponseBody(injectedContent); msg.setResponseHeader(DEFAULT_RESPONSE_HEADER); msg.getResponseHeader().setContentLength( msg.getResponseBody().length()); return msg.getResponseBody().toString(); }