hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Runping Qi (JIRA)" <j...@apache.org>
Subject [jira] Created: (HADOOP-2811) method Counters.makeCompactString() does not insert separator char ',' between the counters of different groups.
Date Wed, 13 Feb 2008 02:13:12 GMT
method Counters.makeCompactString() does not insert separator char ',' between the counters
of different groups.
----------------------------------------------------------------------------------------------------------------

                 Key: HADOOP-2811
                 URL: https://issues.apache.org/jira/browse/HADOOP-2811
             Project: Hadoop Core
          Issue Type: Bug
          Components: mapred
    Affects Versions: 0.16.0
            Reporter: Runping Qi



The corrent code is:
{code}
 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();
  }
{/code}
The correct code should be like:
{code}
 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();
  }
{/code}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message