From 1d24ca6a27c6831e302fbffc716004ba74fed020 Mon Sep 17 00:00:00 2001 From: Alexander Boruchinkin Date: Wed, 13 Apr 2016 02:46:52 +0300 Subject: [PATCH] Change concat Strings in foreach to StringBuilder. Change != to equals for Strings. Remove unnecessary ==true. --- .../pherf/util/GoogleChartGenerator.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/GoogleChartGenerator.java b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/GoogleChartGenerator.java index 577c0d94a0b..23cb689cdce 100644 --- a/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/GoogleChartGenerator.java +++ b/phoenix-pherf/src/main/java/org/apache/phoenix/pherf/util/GoogleChartGenerator.java @@ -163,7 +163,7 @@ private void renderAsGoogleChartsHTML() throws FileNotFoundException, Unsupporte sb.append("dataTable.addRows([\n"); for (Map.Entry dn : datanodes.entrySet()) { String currentKeyPrefix = dn.getKey().substring(0, dn.getKey().indexOf('|')); - if (!lastKeyPrefix.equalsIgnoreCase(currentKeyPrefix) && lastKeyPrefix != "") { + if (!lastKeyPrefix.equalsIgnoreCase(currentKeyPrefix) && !lastKeyPrefix.equals("")) { sb.append(getBlankRow()); } lastKeyPrefix = currentKeyPrefix; @@ -183,7 +183,7 @@ private void renderAsGoogleChartsHTML() throws FileNotFoundException, Unsupporte String thresholdString = Math.round((threshold*100)) + "%"; String footer = StaticGoogleChartsRenderingData.FOOTER .replace("[summary]", - ((verifyWithinThreshold(threshold) == true ? "PASSED | Results are within ": + ((verifyWithinThreshold(threshold) ? "PASSED | Results are within ": "FAILED | Results are outside ")) + "set threshold of " + thresholdString + "
" + new SimpleDateFormat("yyyy/MM/dd ha z").format(new Date())); @@ -197,23 +197,30 @@ private void renderAsGoogleChartsHTML() throws FileNotFoundException, Unsupporte * @return */ private String getBlankRow() { - String ret = "['" + new String(new char[60]).replace("\0", ".") + "'"; - for (int i=0; i nodeDataSet) { - String ret = ""; - for (Map.Entry nodeSet : nodeDataSet.entrySet()) - ret += ""; - return ret + "
" + getToolText(nodeSet.getValue()) + "
"; + private String getToolTipAsHTML(Map nodeDataSet) { + StringBuilder sb = new StringBuilder(""); + for (Map.Entry nodeSet : nodeDataSet.entrySet()) { + sb.append(""); + } + sb.append("
"); + sb.append(getToolText(nodeSet.getValue())); + sb.append("
"); + return sb.toString(); } /**