Program: 53112
Project: 53112
Buggy source:
@VisibleForTesting void printJsonForTargets(CommandRunnerParams params,Executor executor,SortedMap<String,TargetNode<?>> buildIndex) throws BuildFileParseException, IOException, InterruptedException {
  params.getConsole().getStdOut().println("String_Node_Str");
  ObjectMapper mapper=params.getObjectMapper();
  Iterator<TargetNode<?>> valueIterator=buildIndex.values().iterator();
  while (valueIterator.hasNext()) {
    TargetNode<?> targetNode=valueIterator.next();
    SortedMap<String,Object> sortedTargetRule=null;
    sortedTargetRule=params.getParser().getRawTargetNode(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),executor,targetNode);
    if (sortedTargetRule == null) {
      params.getConsole().printErrorText("String_Node_Str" + targetNode.getBuildTarget().getFullyQualifiedName());
      continue;
    }
    StringWriter stringWriter=new StringWriter();
    try {
      mapper.writerWithDefaultPrettyPrinter().writeValue(stringWriter,sortedTargetRule);
    }
 catch (    IOException e) {
      throw Throwables.propagate(e);
    }
    String output=stringWriter.getBuffer().toString();
    if (valueIterator.hasNext()) {
      output+="String_Node_Str";
    }
    params.getConsole().getStdOut().println(output);
  }
  params.getConsole().getStdOut().println("String_Node_Str");
}

Fixed version (ground truth):
@VisibleForTesting void printJsonForTargets(CommandRunnerParams params,Executor executor,SortedMap<String,TargetNode<?>> buildIndex,ImmutableMap<String,ShowOptions> showRulesResult) throws BuildFileParseException, IOException, InterruptedException {
  params.getConsole().getStdOut().println("String_Node_Str");
  ObjectMapper mapper=params.getObjectMapper();
  Iterator<Entry<String,TargetNode<?>>> mapIterator=buildIndex.entrySet().iterator();
  while (mapIterator.hasNext()) {
    Entry<String,TargetNode<?>> current=mapIterator.next();
    String target=current.getKey();
    TargetNode<?> targetNode=current.getValue();
    SortedMap<String,Object> sortedTargetRule;
    sortedTargetRule=params.getParser().getRawTargetNode(params.getBuckEventBus(),params.getCell(),getEnableProfiling(),executor,targetNode);
    if (sortedTargetRule == null) {
      params.getConsole().printErrorText("String_Node_Str" + targetNode.getBuildTarget().getFullyQualifiedName());
      continue;
    }
    ShowOptions showOptions=showRulesResult.get(target);
    if (showOptions != null) {
      putIfValuePresent(ShowOptionsName.RULE_KEY.getName(),showOptions.getRuleKey(),sortedTargetRule);
      putIfValuePresent(ShowOptionsName.OUTPUT_PATH.getName(),showOptions.getOutputPath(),sortedTargetRule);
      putIfValuePresent(ShowOptionsName.TARGET_HASH.getName(),showOptions.getTargetHash(),sortedTargetRule);
    }
    StringWriter stringWriter=new StringWriter();
    try {
      mapper.writerWithDefaultPrettyPrinter().writeValue(stringWriter,sortedTargetRule);
    }
 catch (    IOException e) {
      throw Throwables.propagate(e);
    }
    String output=stringWriter.getBuffer().toString();
    if (mapIterator.hasNext()) {
      output+="String_Node_Str";
    }
    params.getConsole().getStdOut().println(output);
  }
  params.getConsole().getStdOut().println("String_Node_Str");
}