Program: 65760
Project: 65760
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
 * @param stopSign
 * @return result object array
 * @throws IOException
 * @throws DataException 
 */
public IResultObject[] readData(InputStream bis,ClassLoader classLoader,int length) throws IOException, DataException {
  ResultObject[] rowDatas=new ResultObject[length];
  int rowLen;
  byte[] rowDataBytes;
  ByteArrayInputStream bais;
  DataInputStream dis;
  for (int i=0; i < length; i++) {
    if (session.getStopSign().isStopped())     break;
    rowLen=IOUtil.readInt(bis);
    rowDataBytes=new byte[rowLen];
    int readSize=bis.read(rowDataBytes);
    int totalSize=readSize;
    while (readSize > 0 && totalSize < rowLen) {
      readSize=bis.read(rowDataBytes,totalSize,rowLen - totalSize);
      totalSize+=readSize;
    }
    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]=Integer.valueOf(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 (Date.class.isAssignableFrom(fieldType))       obs[j]=new Date(dis.readLong());
 else       if (fieldType.equals(Boolean.class))       obs[j]=Boolean.valueOf(dis.readBoolean());
 else       if (fieldType.equals(String.class))       obs[j]=IOUtil.readString(dis);
 else       if (fieldType.equals(IClob.class) || fieldType.equals(Clob.class))       obs[j]=IOUtil.readString(dis);
 else       if (fieldType.equals(IBlob.class) || fieldType.equals(Blob.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(Object.class) || fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
        ObjectInputStream ois=null;
        if (classLoader != null) {
          ois=ObjectSecurity.createObjectInputStream(dis,classLoader);
        }
 else {
          ois=ObjectSecurity.createObjectInputStream(dis);
        }
        try {
          obs[j]=ObjectSecurity.readObject(ois);
        }
 catch (        Exception e) {
        }
        ois.close();
      }
 else {
        throw new DataException(ResourceConstants.BAD_DATA_TYPE,fieldType.toString());
      }
    }
    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
 * @param stopSign
 * @return result object array
 * @throws IOException
 * @throws DataException 
 */
public IResultObject[] readData(InputStream bis,ClassLoader classLoader,int length) throws IOException, DataException {
  ResultObject[] rowDatas=new ResultObject[length];
  int rowLen;
  byte[] rowDataBytes;
  ByteArrayInputStream bais;
  DataInputStream dis;
  for (int i=0; i < length; i++) {
    if (session.getStopSign().isStopped())     break;
    rowLen=IOUtil.readInt(bis);
    rowDataBytes=new byte[rowLen];
    int readSize=bis.read(rowDataBytes);
    int totalSize=readSize;
    while (readSize > 0 && totalSize < rowLen) {
      readSize=bis.read(rowDataBytes,totalSize,rowLen - totalSize);
      totalSize+=readSize;
    }
    bais=new ByteArrayInputStream(rowDataBytes);
    dis=new DataInputStream(bais);
    Object[] obs=new Object[columnCount];
    for (int j=0; j < columnCount; j++) {
      Class fieldType=typeArray[j];
      obs[j]=readObject(dis,fieldType,classLoader);
    }
    rowDatas[i]=newResultObject(obs);
    rowDataBytes=null;
    dis=null;
    bais=null;
  }
  return rowDatas;
}