Program: 97597
Project: 97597
Buggy source:
@Override public void runOperation(VariableMap variableMap,IProgressMonitor monitor) throws Exception {
  IOseeStatement chStmt=ServiceUtil.getOseeDatabaseService().getStatement();
  try {
    monitor.setTaskName("String_Node_Str");
    chStmt.runPreparedQuery(GET_TRANS_DETAILS,ServiceUtil.getIdentityService().getLocalId(CoreAttributeTypes.WordTemplateContent));
    monitor.setTaskName("String_Node_Str");
    while (chStmt.next() && !monitor.isCanceled()) {
      AttrData attrData=new AttrData(chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"));
      Resource resource=getResource(attrData.uri);
      try {
        boolean foundOffenderByteSeq=false;
        for (int byteIndex=0; byteIndex < resource.backingBytes.length; byteIndex++) {
          foundOffenderByteSeq=(resource.backingBytes[byteIndex] == (byte)0xEF) && (resource.backingBytes[byteIndex + 1] == (byte)0xBF) && (resource.backingBytes[byteIndex + 2] == (byte)0xBD);
          if (foundOffenderByteSeq) {
            String comment=String.format("String_Node_Str",chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"));
            attrData.setComment(comment);
            String offender=new String(new byte[]{resource.backingBytes[byteIndex],resource.backingBytes[byteIndex + 1],resource.backingBytes[byteIndex + 2]},"String_Node_Str");
            log("String_Node_Str" + offender);
            log("String_Node_Str" + resource.resourceName);
            int beginIndex=resource.data.indexOf(offender);
            int maxIndex=beginIndex + 10 < resource.data.length() ? beginIndex + 10 : resource.data.length() - 1;
            beginIndex=beginIndex < 10 ? 0 : beginIndex - 10;
            log("String_Node_Str" + resource.data.substring(beginIndex,maxIndex));
            log("String_Node_Str");
            log(attrData.comment);
            break;
          }
        }
      }
 catch (      Exception ex) {
        OseeLog.logf(Activator.class,Level.SEVERE,"String_Node_Str",attrData.gammaId,attrData.uri,ex);
      }
    }
  }
  finally {
    chStmt.close();
  }
}

Fixed version (ground truth):
@Override public void runOperation(VariableMap variableMap,IProgressMonitor monitor) throws Exception {
  IOseeStatement chStmt=ServiceUtil.getOseeDatabaseService().getStatement();
  try {
    monitor.setTaskName("String_Node_Str");
    boolean allBranches=branchId == -1;
    StringBuilder query=new StringBuilder();
    query.append(GET_TRANS_DETAILS);
    query.append(allBranches ? AND_ALL_BRANCHES : AND_SPECIFIC_BRANCHES);
    Object[] params=new Object[allBranches ? 1 : 3];
    params[0]=ServiceUtil.getIdentityService().getLocalId(CoreAttributeTypes.WordTemplateContent);
    if (!allBranches) {
      params[1]=branchId;
      params[2]=TransactionDetailsType.NonBaselined.getId();
    }
    chStmt.runPreparedQuery(query.toString(),params);
    monitor.setTaskName("String_Node_Str");
    while (chStmt.next() && !monitor.isCanceled()) {
      AttrData attrData=new AttrData(chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"));
      Resource resource=getResource(attrData.uri);
      try {
        boolean foundOffenderByteSeq=false;
        for (int byteIndex=0; byteIndex < resource.backingBytes.length; byteIndex++) {
          foundOffenderByteSeq=(resource.backingBytes[byteIndex] == (byte)0xEF) && (resource.backingBytes[byteIndex + 1] == (byte)0xBF) && (resource.backingBytes[byteIndex + 2] == (byte)0xBD);
          if (foundOffenderByteSeq) {
            String comment=String.format("String_Node_Str",chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"),chStmt.getString("String_Node_Str"));
            attrData.setComment(comment);
            String offender=new String(new byte[]{resource.backingBytes[byteIndex],resource.backingBytes[byteIndex + 1],resource.backingBytes[byteIndex + 2]},"String_Node_Str");
            log("String_Node_Str" + offender);
            log("String_Node_Str" + resource.resourceName);
            int beginIndex=resource.data.indexOf(offender);
            int maxIndex=beginIndex + 10 < resource.data.length() ? beginIndex + 10 : resource.data.length() - 1;
            beginIndex=beginIndex < 10 ? 0 : beginIndex - 10;
            log("String_Node_Str" + resource.data.substring(beginIndex,maxIndex));
            log("String_Node_Str");
            log(attrData.comment);
            break;
          }
        }
      }
 catch (      Exception ex) {
        OseeLog.logf(Activator.class,Level.SEVERE,"String_Node_Str",attrData.gammaId,attrData.uri,ex);
      }
    }
  }
  finally {
    chStmt.close();
  }
}