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

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 0.16.0
    • 0.16.1
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: