Program: 82454
Project: 82454
Buggy source:
public void doitInternal(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  AtomicBoolean quit=new AtomicBoolean();
  AtomicBoolean help=new AtomicBoolean();
  Properties properties=new Properties();
  try {
    properties.load(getClass().getResourceAsStream("String_Node_Str"));
  }
 catch (  IOException e) {
    if (Main.debug) {
      e.printStackTrace();
    }
    throw new CommandException(e.getMessage());
  }
  Map<String,String> metricNames=new HashMap<String,String>();
  Map<String,String> helpMap=new HashMap<String,String>();
  Set<Object> keySet=properties.keySet();
  for (  Object k : keySet) {
    String key=k.toString();
    if (isShortName(key)) {
      String shortName=getShortName(key,properties);
      String longName=getLongName(getLongNameKey(key),properties);
      metricNames.put(shortName,longName);
    }
 else     if (isHelpName(key)) {
      int indexOf=key.indexOf(HELP);
      String strKey=key.substring(0,indexOf);
      Object shortNameKey=properties.get(strKey + SHORTNAME);
      Object helpMessage=properties.get(key);
      if (shortNameKey != null && helpMessage != null) {
        helpMap.put(shortNameKey.toString(),helpMessage.toString());
      }
    }
  }
  String labelsStr=properties.getProperty("String_Node_Str");
  String[] labels=resolveShortNames(labelsStr.split("String_Node_Str"),properties);
  String sizesStr=properties.getProperty("String_Node_Str");
  Set<String> sizes=new HashSet<String>(Arrays.asList(resolveShortNames(sizesStr.split("String_Node_Str"),properties)));
  Set<String> keys=new HashSet<String>(metricNames.values());
  String cluster;
  if (args.length != 2) {
    cluster=Main.getCluster(client,"String_Node_Str" + help());
  }
 else {
    cluster=args[1];
  }
  ConsoleReader reader=this.getConsoleReader();
  if (reader != null) {
    Terminal terminal=reader.getTerminal();
    _height=terminal.getHeight() - 2;
    _width=terminal.getWidth() - 2;
    try {
      reader.setPrompt("String_Node_Str");
      reader.clearScreen();
    }
 catch (    IOException e) {
      if (Main.debug) {
        e.printStackTrace();
      }
    }
    startCommandWatcher(reader,quit,help,this);
  }
  List<String> shardServerList=new ArrayList<String>(client.shardServerList(cluster));
  Collections.sort(shardServerList);
  Map<String,AtomicReference<Client>> shardClients=setupClients(shardServerList);
  String shardServerLabel=properties.getProperty(TOP_SHARD_SERVER_SHORTNAME);
  int longestServerName=Math.max(getSizeOfLongestKey(shardClients),shardServerLabel.length());
  StringBuilder header=new StringBuilder("String_Node_Str" + longestServerName + "String_Node_Str");
  for (int i=1; i < labels.length; i++) {
    header.append("String_Node_Str");
  }
  header.append("String_Node_Str");
  do {
    StringBuilder output=new StringBuilder();
    if (quit.get()) {
      return;
    }
 else     if (help.get()) {
      showHelp(output,labels,helpMap);
    }
 else {
      output.append(truncate(String.format(header.toString(),(Object[])labels)));
      for (      Entry<String,AtomicReference<Client>> e : new TreeMap<String,AtomicReference<Client>>(shardClients).entrySet()) {
        String shardServer=e.getKey();
        AtomicReference<Client> ref=e.getValue();
        Map<String,Metric> metrics=getMetrics(shardServer,ref,keys);
        if (metrics == null) {
          String line=String.format("String_Node_Str" + longestServerName + "String_Node_Str",shardServer);
          output.append(line);
        }
 else {
          Object[] cols=new Object[labels.length];
          int c=0;
          cols[c++]=shardServer;
          StringBuilder sb=new StringBuilder("String_Node_Str" + longestServerName + "String_Node_Str");
          for (int i=1; i < labels.length; i++) {
            String mn=metricNames.get(labels[i]);
            Metric metric=metrics.get(mn);
            Map<String,Double> doubleMap=metric.getDoubleMap();
            Double value=doubleMap.get("String_Node_Str");
            if (value == null) {
              value=doubleMap.get("String_Node_Str");
            }
            cols[c++]=humanize(value,sizes.contains(mn));
            sb.append("String_Node_Str");
          }
          sb.append("String_Node_Str");
          output.append(truncate(String.format(sb.toString(),cols)));
        }
      }
    }
    if (reader != null) {
      try {
        reader.clearScreen();
      }
 catch (      IOException e) {
        if (Main.debug) {
          e.printStackTrace();
        }
      }
    }
    out.print(output.toString());
    out.flush();
    if (reader != null) {
      try {
synchronized (this) {
          wait(3000);
        }
      }
 catch (      InterruptedException e) {
        return;
      }
      Terminal terminal=reader.getTerminal();
      _height=terminal.getHeight() - 2;
      _width=terminal.getWidth() - 2;
      List<String> currentShardServerList=new ArrayList<String>(client.shardServerList(cluster));
      Collections.sort(currentShardServerList);
      if (!shardServerList.equals(currentShardServerList)) {
        close(shardClients);
        shardClients=setupClients(shardServerList);
      }
    }
  }
 while (reader != null);
}

Fixed version (ground truth):
public void doitInternal(PrintWriter out,Blur.Iface client,String[] args) throws CommandException, TException, BlurException {
  AtomicBoolean quit=new AtomicBoolean();
  AtomicBoolean help=new AtomicBoolean();
  Properties properties=new Properties();
  try {
    properties.load(getClass().getResourceAsStream("String_Node_Str"));
  }
 catch (  IOException e) {
    if (Main.debug) {
      e.printStackTrace();
    }
    throw new CommandException(e.getMessage());
  }
  Map<String,String> metricNames=new HashMap<String,String>();
  Map<String,String> helpMap=new HashMap<String,String>();
  Set<Object> keySet=properties.keySet();
  for (  Object k : keySet) {
    String key=k.toString();
    if (isShortName(key)) {
      String shortName=getShortName(key,properties);
      String longName=getLongName(getLongNameKey(key),properties);
      metricNames.put(shortName,longName);
    }
 else     if (isHelpName(key)) {
      int indexOf=key.indexOf(HELP);
      String strKey=key.substring(0,indexOf);
      Object shortNameKey=properties.get(strKey + SHORTNAME);
      Object helpMessage=properties.get(key);
      if (shortNameKey != null && helpMessage != null) {
        helpMap.put(shortNameKey.toString(),helpMessage.toString());
      }
    }
  }
  String labelsStr=properties.getProperty("String_Node_Str");
  String[] labels=resolveShortNames(labelsStr.split("String_Node_Str"),properties);
  String sizesStr=properties.getProperty("String_Node_Str");
  Set<String> sizes=new HashSet<String>(Arrays.asList(resolveShortNames(sizesStr.split("String_Node_Str"),properties)));
  Set<String> keys=new HashSet<String>(metricNames.values());
  String cluster;
  if (args.length != 2) {
    cluster=Main.getCluster(client,"String_Node_Str" + help());
  }
 else {
    cluster=args[1];
  }
  ConsoleReader reader=this.getConsoleReader();
  if (reader != null) {
    Terminal terminal=reader.getTerminal();
    _height=terminal.getHeight() - 2;
    _width=terminal.getWidth() - 2;
    try {
      reader.setPrompt("String_Node_Str");
      reader.clearScreen();
    }
 catch (    IOException e) {
      if (Main.debug) {
        e.printStackTrace();
      }
    }
    startCommandWatcher(reader,quit,help,this);
  }
  List<String> shardServerList=new ArrayList<String>(client.shardServerList(cluster));
  Collections.sort(shardServerList);
  Map<String,AtomicReference<Client>> shardClients=setupClients(shardServerList);
  String shardServerLabel=properties.getProperty(TOP_SHARD_SERVER_SHORTNAME);
  int longestServerName=Math.max(getSizeOfLongestKey(shardClients),shardServerLabel.length());
  StringBuilder header=new StringBuilder("String_Node_Str" + longestServerName + "String_Node_Str");
  for (int i=1; i < labels.length; i++) {
    header.append("String_Node_Str");
  }
  do {
    StringBuilder output=new StringBuilder();
    if (quit.get()) {
      return;
    }
 else     if (help.get()) {
      showHelp(output,labels,helpMap);
    }
 else {
      output.append(truncate(String.format(header.toString(),(Object[])labels)) + "String_Node_Str");
      for (      Entry<String,AtomicReference<Client>> e : new TreeMap<String,AtomicReference<Client>>(shardClients).entrySet()) {
        String shardServer=e.getKey();
        AtomicReference<Client> ref=e.getValue();
        Map<String,Metric> metrics=getMetrics(shardServer,ref,keys);
        if (metrics == null) {
          String line=String.format("String_Node_Str" + longestServerName + "String_Node_Str",shardServer);
          output.append(line);
        }
 else {
          Object[] cols=new Object[labels.length];
          int c=0;
          cols[c++]=shardServer;
          StringBuilder sb=new StringBuilder("String_Node_Str" + longestServerName + "String_Node_Str");
          for (int i=1; i < labels.length; i++) {
            String mn=metricNames.get(labels[i]);
            Metric metric=metrics.get(mn);
            Map<String,Double> doubleMap=metric.getDoubleMap();
            Double value=doubleMap.get("String_Node_Str");
            if (value == null) {
              value=doubleMap.get("String_Node_Str");
            }
            cols[c++]=humanize(value,sizes.contains(mn));
            sb.append("String_Node_Str");
          }
          output.append(truncate(String.format(sb.toString(),cols)) + "String_Node_Str");
        }
      }
    }
    if (reader != null) {
      try {
        reader.clearScreen();
      }
 catch (      IOException e) {
        if (Main.debug) {
          e.printStackTrace();
        }
      }
    }
    out.print(output.toString());
    out.flush();
    if (reader != null) {
      try {
synchronized (this) {
          wait(3000);
        }
      }
 catch (      InterruptedException e) {
        return;
      }
      Terminal terminal=reader.getTerminal();
      _height=terminal.getHeight() - 2;
      _width=terminal.getWidth() - 2;
      List<String> currentShardServerList=new ArrayList<String>(client.shardServerList(cluster));
      Collections.sort(currentShardServerList);
      if (!shardServerList.equals(currentShardServerList)) {
        close(shardClients);
        shardClients=setupClients(shardServerList);
      }
    }
  }
 while (reader != null);
}