Program: 75419
Project: 75419
Buggy source:
/** 
 * Deserialze result object array from input stream. The reading procedure is strictly sequential, that means there is no random access. Datatype Corresponds to executor#setDataType
 * @param br input stream
 * @param length how many objects needs to be read
 * @return result object array
 * @throws IOException
 */
public IResultObject[] readData(InputStream bis,int length) throws IOException {
  ResultObject[] rowDatas=new ResultObject[length];
  int rowLen;
  byte[] rowDataBytes;
  ByteArrayInputStream bais;
  DataInputStream dis;
  for (int i=0; i < length; i++) {
    rowLen=IOUtil.readInt(bis);
    rowDataBytes=new byte[rowLen];
    bis.read(rowDataBytes);
    bais=new ByteArrayInputStream(rowDataBytes);
    dis=new DataInputStream(bais);
    Object[] obs=new Object[columnCount];
    for (int j=0; j < columnCount; j++) {
      Class fieldType=typeArray[j];
      if (dis.readByte() == 0) {
        obs[j]=null;
        continue;
      }
      if (fieldType.equals(Integer.class))       obs[j]=new Integer(dis.readInt());
 else       if (fieldType.equals(Double.class))       obs[j]=new Double(dis.readDouble());
 else       if (fieldType.equals(BigDecimal.class))       obs[j]=new BigDecimal(dis.readUTF());
 else       if (fieldType.equals(Time.class))       obs[j]=new Time(dis.readLong());
 else       if (fieldType.equals(Timestamp.class))       obs[j]=new Timestamp(dis.readLong());
 else       if (fieldType.equals(java.sql.Date.class))       obs[j]=new java.sql.Date(dis.readLong());
 else       if (fieldType.isAssignableFrom(Date.class))       obs[j]=new Date(dis.readLong());
 else       if (fieldType.equals(Boolean.class))       obs[j]=new Boolean(dis.readBoolean());
 else       if (fieldType.equals(String.class))       obs[j]=dis.readUTF();
 else       if (fieldType.equals(IClob.class))       obs[j]=dis.readUTF();
 else       if (fieldType.equals(IBlob.class)) {
        int len=IOUtil.readInt(dis);
        if (len == 0) {
          obs[j]=null;
        }
 else {
          byte[] bytes=new byte[len];
          dis.read(bytes);
          obs[j]=bytes;
        }
      }
 else       if (fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
        ObjectInputStream ois=new ObjectInputStream(dis);
        try {
          obs[j]=ois.readObject();
        }
 catch (        Exception e) {
        }
        ois.close();
      }
    }
    rowDatas[i]=newResultObject(obs);
    rowDataBytes=null;
    dis=null;
    bais=null;
  }
  return rowDatas;
}

Fixed version (ground truth):
/** 
 * Deserialze result object array from input stream. The reading procedure is strictly sequential, that means there is no random access. Datatype Corresponds to executor#setDataType
 * @param br input stream
 * @param length how many objects needs to be read
 * @return result object array
 * @throws IOException
 */
public IResultObject[] readData(InputStream bis,int length) throws IOException {
  ResultObject[] rowDatas=new ResultObject[length];
  int rowLen;
  byte[] rowDataBytes;
  ByteArrayInputStream bais;
  DataInputStream dis;
  for (int i=0; i < length; i++) {
    rowLen=IOUtil.readInt(bis);
    rowDataBytes=new byte[rowLen];
    bis.read(rowDataBytes);
    bais=new ByteArrayInputStream(rowDataBytes);
    dis=new DataInputStream(bais);
    Object[] obs=new Object[columnCount];
    for (int j=0; j < columnCount; j++) {
      Class fieldType=typeArray[j];
      if (dis.readByte() == 0) {
        obs[j]=null;
        continue;
      }
      if (fieldType.equals(Integer.class))       obs[j]=new Integer(dis.readInt());
 else       if (fieldType.equals(Double.class))       obs[j]=new Double(dis.readDouble());
 else       if (fieldType.equals(BigDecimal.class))       obs[j]=new BigDecimal(dis.readUTF());
 else       if (fieldType.equals(Time.class))       obs[j]=new Time(dis.readLong());
 else       if (fieldType.equals(Timestamp.class))       obs[j]=new Timestamp(dis.readLong());
 else       if (fieldType.equals(java.sql.Date.class))       obs[j]=new java.sql.Date(dis.readLong());
 else       if (fieldType.isAssignableFrom(Date.class))       obs[j]=new Date(dis.readLong());
 else       if (fieldType.equals(Boolean.class))       obs[j]=new Boolean(dis.readBoolean());
 else       if (fieldType.equals(String.class))       obs[j]=IOUtil.readString(dis);
 else       if (fieldType.equals(IClob.class))       obs[j]=IOUtil.readString(dis);
 else       if (fieldType.equals(IBlob.class)) {
        int len=IOUtil.readInt(dis);
        if (len == 0) {
          obs[j]=null;
        }
 else {
          byte[] bytes=new byte[len];
          dis.read(bytes);
          obs[j]=bytes;
        }
      }
 else       if (fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
        ObjectInputStream ois=new ObjectInputStream(dis);
        try {
          obs[j]=ois.readObject();
        }
 catch (        Exception e) {
        }
        ois.close();
      }
    }
    rowDatas[i]=newResultObject(obs);
    rowDataBytes=null;
    dis=null;
    bais=null;
  }
  return rowDatas;
}