Program: 31257
Project: 31257
Buggy source:
private String outputMessage(FetchRequest fetch,StoredMessage message,ImapSessionFolder folder,boolean useUids) throws FolderException, ProtocolException {
  boolean ensureFlagsResponse=false;
  if (fetch.isSetSeen() && !message.isSet(Flags.Flag.SEEN)) {
    folder.setFlags(FLAGS_SEEN,true,message.getUid(),folder,useUids);
    message.setFlags(FLAGS_SEEN,true);
    ensureFlagsResponse=true;
  }
  StringBuilder response=new StringBuilder();
  if (fetch.flags || ensureFlagsResponse) {
    response.append("String_Node_Str");
    response.append(MessageFlags.format(message.getFlags()));
  }
  if (fetch.internalDate) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getReceivedDateAsString());
    response.append('\"');
  }
  if (fetch.size) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getSize());
  }
  if (fetch.envelope) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getEnvelope());
  }
  if (fetch.body) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getBodyStructure(false));
  }
  if (fetch.bodyStructure) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getBodyStructure(true));
  }
  if (fetch.uid) {
    response.append("String_Node_Str");
    response.append(message.getUid());
  }
  Collection elements=fetch.getBodyElements();
  for (  Object element : elements) {
    BodyFetchElement fetchElement=(BodyFetchElement)element;
    response.append(SP);
    response.append(fetchElement.getResponseName());
    if (null == fetchElement.getPartial()) {
      response.append(SP);
    }
    String sectionSpecifier=fetchElement.getParameters();
    MimeMessage mimeMessage=message.getMimeMessage();
    try {
      handleBodyFetch(mimeMessage,sectionSpecifier,fetchElement.getPartial(),response);
    }
 catch (    Exception e) {
      throw new FolderException(e.getMessage());
    }
  }
  if (response.length() > 0) {
    return response.substring(1);
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
private String outputMessage(FetchRequest fetch,StoredMessage message,ImapSessionFolder folder,boolean useUids) throws FolderException, ProtocolException {
  boolean ensureFlagsResponse=false;
  if (fetch.isSetSeen() && !message.isSet(Flags.Flag.SEEN)) {
    folder.setFlags(FLAGS_SEEN,true,message.getUid(),folder,useUids);
    message.setFlags(FLAGS_SEEN,true);
    ensureFlagsResponse=true;
  }
  StringBuilder response=new StringBuilder();
  if (fetch.flags || ensureFlagsResponse) {
    response.append("String_Node_Str");
    response.append(MessageFlags.format(message.getFlags()));
  }
  if (fetch.internalDate) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getReceivedDateAsString());
    response.append('\"');
  }
  if (fetch.size) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getSize());
  }
  if (fetch.envelope) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getEnvelope());
  }
  if (fetch.body) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getBodyStructure(false));
  }
  if (fetch.bodyStructure) {
    response.append("String_Node_Str");
    response.append(message.getAttributes().getBodyStructure(true));
  }
  if (fetch.uid) {
    response.append("String_Node_Str");
    response.append(message.getUid());
  }
  Collection elements=fetch.getBodyElements();
  for (  Object element : elements) {
    BodyFetchElement fetchElement=(BodyFetchElement)element;
    response.append(SP);
    response.append(fetchElement.getResponseName());
    if (null == fetchElement.getPartial()) {
      response.append(SP);
    }
    String sectionSpecifier=fetchElement.getParameters();
    MimeMessage mimeMessage=message.getMimeMessage();
    try {
      handleBodyFetch(mimeMessage,sectionSpecifier,fetchElement.getPartial(),response);
    }
 catch (    Exception e) {
      throw new FolderException(e);
    }
  }
  if (response.length() > 0) {
    return response.substring(1);
  }
 else {
    return "String_Node_Str";
  }
}