Program: 75420
Project: 75420
Buggy source:
/** 
 * @param bos
 * @param resultObject
 * @throws IOException
 */
public void writeData(OutputStream bos,IResultObject resultObject) throws IOException {
  byte[] rowsDataBytes;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  DataOutputStream dos=new DataOutputStream(baos);
  for (int j=0; j < columnCount; j++) {
    Object fieldValue=null;
    try {
      fieldValue=resultObject.getFieldValue(j + 1);
    }
 catch (    DataException e) {
    }
    if (fieldValue == null) {
      dos.writeByte(0);
      continue;
    }
 else {
      dos.writeByte(1);
    }
    Class fieldType=typeArray[j];
    if (fieldType.equals(Integer.class))     dos.writeInt(((Integer)fieldValue).intValue());
 else     if (fieldType.equals(Double.class))     dos.writeDouble(((Double)fieldValue).doubleValue());
 else     if (fieldType.equals(BigDecimal.class))     dos.writeUTF(((BigDecimal)fieldValue).toString());
 else     if (Date.class.isAssignableFrom(fieldType))     dos.writeLong(((Date)fieldValue).getTime());
 else     if (fieldType.equals(Boolean.class))     dos.writeBoolean(((Boolean)fieldValue).booleanValue());
 else     if (fieldType.equals(String.class))     dos.writeUTF(fieldValue.toString());
 else     if (fieldType.equals(IClob.class))     dos.writeUTF(fieldValue.toString());
 else     if (fieldType.equals(IBlob.class)) {
      byte[] bytes=(byte[])fieldValue;
      if (bytes == null || bytes.length == 0) {
        IOUtil.writeInt(dos,0);
      }
 else {
        IOUtil.writeInt(dos,bytes.length);
        dos.write((byte[])fieldValue);
      }
    }
 else     if (fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
      if (!(fieldValue instanceof Serializable))       fieldValue=fieldValue.toString();
      ObjectOutputStream oo=new ObjectOutputStream(dos);
      oo.writeObject(fieldValue);
      oo.close();
    }
  }
  dos.flush();
  rowsDataBytes=baos.toByteArray();
  IOUtil.writeInt(bos,rowsDataBytes.length);
  bos.write(rowsDataBytes);
  rowsDataBytes=null;
  dos=null;
  baos=null;
}

Fixed version (ground truth):
/** 
 * @param bos
 * @param resultObject
 * @throws IOException
 */
public void writeData(OutputStream bos,IResultObject resultObject) throws IOException {
  byte[] rowsDataBytes;
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  DataOutputStream dos=new DataOutputStream(baos);
  for (int j=0; j < columnCount; j++) {
    Object fieldValue=null;
    try {
      fieldValue=resultObject.getFieldValue(j + 1);
    }
 catch (    DataException e) {
    }
    if (fieldValue == null) {
      dos.writeByte(0);
      continue;
    }
 else {
      dos.writeByte(1);
    }
    Class fieldType=typeArray[j];
    if (fieldType.equals(Integer.class))     dos.writeInt(((Integer)fieldValue).intValue());
 else     if (fieldType.equals(Double.class))     dos.writeDouble(((Double)fieldValue).doubleValue());
 else     if (fieldType.equals(BigDecimal.class))     dos.writeUTF(((BigDecimal)fieldValue).toString());
 else     if (Date.class.isAssignableFrom(fieldType))     dos.writeLong(((Date)fieldValue).getTime());
 else     if (fieldType.equals(Boolean.class))     dos.writeBoolean(((Boolean)fieldValue).booleanValue());
 else     if (fieldType.equals(String.class))     IOUtil.writeString(dos,fieldValue.toString());
 else     if (fieldType.equals(IClob.class))     IOUtil.writeString(dos,fieldValue.toString());
 else     if (fieldType.equals(IBlob.class)) {
      byte[] bytes=(byte[])fieldValue;
      if (bytes == null || bytes.length == 0) {
        IOUtil.writeInt(dos,0);
      }
 else {
        IOUtil.writeInt(dos,bytes.length);
        dos.write((byte[])fieldValue);
      }
    }
 else     if (fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
      if (!(fieldValue instanceof Serializable))       fieldValue=fieldValue.toString();
      ObjectOutputStream oo=new ObjectOutputStream(dos);
      oo.writeObject(fieldValue);
      oo.close();
    }
  }
  dos.flush();
  rowsDataBytes=baos.toByteArray();
  IOUtil.writeInt(bos,rowsDataBytes.length);
  bos.write(rowsDataBytes);
  rowsDataBytes=null;
  dos=null;
  baos=null;
}