Source:
<code>private String createPage(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append( "<!DOCTYPE html PUBLIC \"- sb.append("<html xmlns=\"<LINK_0>\" xml:lang=\"en\" lang=\"en\">"); sb.append("<head>"); sb.append("<title>"); sb.append("Query Result"); sb.append("</title>"); sb.append("</head>"); sb.append("<body>"); sb.append("<h1>"); sb.append("Query Request:"); sb.append("</h1>"); sb.append("<p>"); String metacardId = request.getParameter(QUERY_REQUEST_PARAM); sb.append(metacardId); sb.append("</p>"); sb.append("<h1>"); sb.append("Query Result:"); sb.append("</h1>"); sb.append("<p>"); sb.append("<textarea name=\"queryresult\" id=\"queryresult\" rows=\"40\" cols=\"80\">"); sb.append(getMetacardForId(metacardId, getProxyTicket(request))); sb.append("</textarea>"); sb.append("</p>"); sb.append("<p>"); sb.append("<form method=\"post\" action=\"" + QUERY_FORM_SERVLET + "\">"); sb.append("<input type=\"submit\" value=\"New Query\" />"); sb.append("</form>"); sb.append("</p>"); sb.append("</body>"); sb.append("</html>"); StringBuilder message = new StringBuilder(); message.append("\n########################################################################\n"); message.append(" Query result html:\n"); message.append(sb.toString()); message.append("\n########################################################################\n"); if (LOGGER.isDebugEnabled()) { LOGGER.debug(message.toString()); } <START> <END> return sb.toString(); }</code><technical_language>If message is for debugging, wasteful build print conditionally. reason build message conditionally well? (move 163-167 LOGGER.isDebugEnabled() check)</technical_language>

Target:
private String createPage(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.append( "<!DOCTYPE html PUBLIC \"- sb.append("<html xmlns=\"<LINK_0>\" xml:lang=\"en\" lang=\"en\">"); sb.append("<head>"); sb.append("<title>"); sb.append("Query Result"); sb.append("</title>"); sb.append("</head>"); sb.append("<body>"); sb.append("<h1>"); sb.append("Query Request:"); sb.append("</h1>"); sb.append("<p>"); String metacardId = request.getParameter(QUERY_REQUEST_PARAM); sb.append(metacardId); sb.append("</p>"); sb.append("<h1>"); sb.append("Query Result:"); sb.append("</h1>"); sb.append("<p>"); sb.append("<textarea name=\"queryresult\" id=\"queryresult\" rows=\"40\" cols=\"80\">"); sb.append(getMetacardForId(metacardId, getProxyTicket(request))); sb.append("</textarea>"); sb.append("</p>"); sb.append("<p>"); sb.append("<form method=\"post\" action=\"" + QUERY_FORM_SERVLET + "\">"); sb.append("<input type=\"submit\" value=\"New Query\" />"); sb.append("</form>"); sb.append("</p>"); sb.append("</body>"); sb.append("</html>"); if (LOGGER.isDebugEnabled()) { StringBuilder message = new StringBuilder(); message.append( "\n########################################################################\n"); message.append(" Query result html:\n"); message.append(sb.toString()); message.append( "\n########################################################################\n"); LOGGER.debug(message.toString()); } return sb.toString(); }