Source:
<code>protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException { if (request.getSession(false) == null) { response.sendRedirect(LoginServlet.class.getSimpleName()); return; } response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); response.setStatus(HttpStatus.SC_OK); String idList = request.getParameter(IDS); String downloadJSON = request.getParameter(PARAM_JSON); PrintWriter writer = response.getWriter(); if (downloadJSON != null) { List<String> pendingProxy = new ArrayList<String>(); if (idList == null) { for (RemoteProxy eachProxy : this.getRegistry().getAllProxies()) { if (eachProxy == null) { continue; } if ((eachProxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) eachProxy).supportsAutoUpgrade())) { if (!((SeLionRemoteProxy) eachProxy).upgradeNode(downloadJSON)) { pendingProxy.add(eachProxy.getId()); } } else { LOGGER.warning("Node " + eachProxy.getId() + " can not be auto upgraded."); } } } else { for (String eachId : idList.split(",")) { if (!eachId.trim().isEmpty()) { RemoteProxy proxy = getRegistry().getProxyById(eachId.trim()); if (proxy == null) { continue; } if ((proxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) proxy).supportsAutoUpgrade())) { if (!((SeLionRemoteProxy) proxy).upgradeNode(downloadJSON)) { pendingProxy.add(proxy.getId()); } } else { LOGGER.warning("Node " + proxy.getId() + " can not be auto upgraded."); } } } } if (pendingProxy.size() > 0) { String ids = ""; for (String temp : pendingProxy) { ids = ids + temp + ","; } ids = StringUtils.chop(ids); <START> ServletHelper.respondWithTemplate(writer, PENDING_NODE_FILE, ids, ids, downloadJSON); <END> } else { ServletHelper.displayMessageOnRedirect(writer, "Auto upgrade process initiated on all nodes."); } } else { showDefaultPage(writer); } }</code><technical_language>this refactored. passing in writer, pass response object input for consideration writing response. do changes this branch</technical_language>

Target:
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException { if (request.getSession(false) == null) { response.sendRedirect(LoginServlet.class.getSimpleName()); return; } String idList = request.getParameter(IDS); String downloadJSON = request.getParameter(PARAM_JSON); if (downloadJSON != null) { List<String> pendingProxy = new ArrayList<String>(); if (idList == null) { for (RemoteProxy eachProxy : this.getRegistry().getAllProxies()) { if (eachProxy == null) { continue; } if ((eachProxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) eachProxy).supportsAutoUpgrade())) { if (!((SeLionRemoteProxy) eachProxy).upgradeNode(downloadJSON)) { pendingProxy.add(eachProxy.getId()); } } else { LOGGER.warning("Node " + eachProxy.getId() + " can not be auto upgraded."); } } } else { for (String eachId : idList.split(",")) { if (!eachId.trim().isEmpty()) { RemoteProxy proxy = getRegistry().getProxyById(eachId.trim()); if (proxy == null) { continue; } if ((proxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) proxy).supportsAutoUpgrade())) { if (!((SeLionRemoteProxy) proxy).upgradeNode(downloadJSON)) { pendingProxy.add(proxy.getId()); } } else { LOGGER.warning("Node " + proxy.getId() + " can not be auto upgraded."); } } } } if (pendingProxy.size() > 0) { String ids = ""; for (String temp : pendingProxy) { ids = ids + temp + ","; } ids = StringUtils.chop(ids); ServletHelper.respondAsHtmlUsingArgsAndTemplateWithHttpStatus(response, PENDING_NODE_FILE, HttpServletResponse.SC_OK, ids, ids, downloadJSON); } else { ServletHelper.respondAsHtmlWithMessage(response, "Auto upgrade process initiated on all nodes."); } } else { showDefaultPage(response); } }