Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-2811

method Counters.makeCompactString() does not insert separator char ',' between the counters of different groups.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 0.16.0
    • Fix Version/s: 0.16.1
    • Component/s: None
    • Labels:
      None

      Description

      The corrent code is:

       public synchronized String makeCompactString() {
          StringBuffer buffer = new StringBuffer();
            for(Group group: this){
            boolean first = true;
            for(Counter counter: group) {
              if (first) {
                first = false;
              } else {
                buffer.append(',');
              }
              buffer.append(group.getDisplayName());
              buffer.append('.');
              buffer.append(counter.getDisplayName());
              buffer.append('=');
              buffer.append(counter.getCounter());
            }
          }
          return buffer.toString();
        }
      

      The correct code should be like:

       public synchronized String makeCompactString() {
          StringBuffer buffer = new StringBuffer();
          boolean first = true;
          for(Group group: this){
            
            for(Counter counter: group) {
              if (first) {
                first = false;
              } else {
                buffer.append(',');
              }
              buffer.append(group.getDisplayName());
              buffer.append('.');
              buffer.append(counter.getDisplayName());
              buffer.append('=');
              buffer.append(counter.getCounter());
            }
          }
          return buffer.toString();
        }
      

        Attachments

        1. patch-2811.txt
          0.6 kB
          Runping Qi

          Activity

            People

            • Assignee:
              runping Runping Qi
              Reporter:
              runping Runping Qi
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: