Program: 65515
Project: 65515
Buggy source:
/** 
 * Write the result object value if it is used in column binding map
 * @param dos
 * @param resultObject
 * @param nameSet
 * @throws DataException
 * @throws IOException
 */
public static int writeResultObject(DataOutputStream dos,IResultObject resultObject,int count,Set nameSet,Map<String,StringTable> stringTableMap,Map<String,IIndexSerializer> index,int rowIndex,int version) throws DataException, IOException {
  if (resultObject.getResultClass() == null)   return 0;
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  for (int i=1; i <= count; i++) {
    if (nameSet != null && (nameSet.contains(resultObject.getResultClass().getFieldName(i)) || nameSet.contains(resultObject.getResultClass().getFieldAlias(i)))) {
      IIndexSerializer currIndex=index.get(resultObject.getResultClass().getFieldName(i));
      Object candidate=resultObject.getFieldValue(i);
      if (currIndex != null) {
{
          currIndex.put(candidate,rowIndex);
        }
      }
      StringTable table=null;
      if (stringTableMap != null)       table=stringTableMap.get(resultObject.getResultClass().getFieldName(i));
      if (table != null) {
        int stringIndex=table.getIndex((String)resultObject.getFieldValue(i));
        IOUtil.writeInt(tempDos,stringIndex);
      }
 else {
        if (version >= VersionManager.VERSION_3_7_2_1) {
          ResultObjectUtil.writeObject(tempDos,resultObject.getFieldValue(i),resultObject.getResultClass().getFieldValueClass(i));
        }
 else {
          IOUtil.writeObject(tempDos,resultObject.getFieldValue(i));
        }
      }
    }
  }
  tempDos.flush();
  tempBos.flush();
  tempBaos.flush();
  byte[] bytes=tempBaos.toByteArray();
  int rowBytes=bytes.length;
  IOUtil.writeRawBytes(dos,bytes);
  tempBaos=null;
  tempBos=null;
  tempDos=null;
  return rowBytes;
}

Fixed version (ground truth):
/** 
 * Write the result object value if it is used in column binding map
 * @param dos
 * @param resultObject
 * @param nameSet
 * @throws DataException
 * @throws IOException
 */
public static int writeResultObject(DataOutputStream dos,IResultObject resultObject,int count,Set nameSet,Map<String,StringTable> stringTableMap,Map<String,IIndexSerializer> index,int rowIndex,int version) throws DataException, IOException {
  if (resultObject.getResultClass() == null)   return 0;
  ByteArrayOutputStream tempBaos=new ByteArrayOutputStream();
  BufferedOutputStream tempBos=new BufferedOutputStream(tempBaos);
  DataOutputStream tempDos=new DataOutputStream(tempBos);
  for (int i=1; i <= count; i++) {
    if (nameSet != null && (nameSet.contains(resultObject.getResultClass().getFieldName(i)) || nameSet.contains(resultObject.getResultClass().getFieldAlias(i)))) {
      IIndexSerializer currIndex=index.get(resultObject.getResultClass().getFieldName(i));
      Object candidate=resultObject.getFieldValue(i);
      if (currIndex != null) {
{
          currIndex.put(candidate,rowIndex);
        }
      }
      StringTable table=null;
      if (stringTableMap != null)       table=stringTableMap.get(resultObject.getResultClass().getFieldName(i));
      if (table != null) {
        int stringIndex=table.getIndex((String)resultObject.getFieldValue(i));
        IOUtil.writeInt(tempDos,stringIndex);
      }
 else {
        if (version > VersionManager.VERSION_3_7_2_1) {
          ResultObjectUtil.writeObject(tempDos,resultObject.getFieldValue(i),resultObject.getResultClass().getFieldValueClass(i));
        }
 else {
          IOUtil.writeObject(tempDos,resultObject.getFieldValue(i));
        }
      }
    }
  }
  tempDos.flush();
  tempBos.flush();
  tempBaos.flush();
  byte[] bytes=tempBaos.toByteArray();
  int rowBytes=bytes.length;
  IOUtil.writeRawBytes(dos,bytes);
  tempBaos=null;
  tempBos=null;
  tempDos=null;
  return rowBytes;
}