Program: 65745
Project: 65745
Buggy source:
public static void writeObject(DataOutputStream dos,Object fieldValue,Class fieldType) throws IOException, DataException {
  if (fieldValue == null) {
    dos.writeByte(0);
    return;
  }
 else {
    dos.writeByte(1);
  }
  if (fieldType.equals(Integer.class))   dos.writeInt(((Integer)convert(fieldValue,DataType.INTEGER_TYPE)).intValue());
 else   if (fieldType.equals(Double.class))   dos.writeDouble(((Double)convert(fieldValue,DataType.DOUBLE_TYPE)).doubleValue());
 else   if (fieldType.equals(BigDecimal.class))   dos.writeUTF(((BigDecimal)convert(fieldValue,DataType.DECIMAL_TYPE)).toString());
 else   if (Date.class.isAssignableFrom(fieldType))   dos.writeLong(((Date)convert(fieldValue,DataType.DATE_TYPE)).getTime());
 else   if (fieldType.equals(Boolean.class))   dos.writeBoolean(((Boolean)convert(fieldValue,DataType.BOOLEAN_TYPE)).booleanValue());
 else   if (fieldType.equals(String.class))   IOUtil.writeString(dos,fieldValue.toString());
 else   if (fieldType.equals(IClob.class) || fieldType.equals(Clob.class))   IOUtil.writeString(dos,fieldValue.toString());
 else   if (fieldType.equals(IBlob.class) || fieldType.equals(Blob.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(Object.class) || fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
    if (!(fieldValue instanceof Serializable))     throw new DataException(ResourceConstants.NOT_SERIALIZABLE_CLASS,fieldValue.getClass().getName());
    ObjectOutputStream oo=ObjectSecurity.createObjectOutputStream(dos);
    oo.writeObject(fieldValue);
    oo.close();
  }
 else {
    throw new DataException(ResourceConstants.BAD_DATA_TYPE,fieldType.toString());
  }
}

Fixed version (ground truth):
public static void writeObject(DataOutputStream dos,Object fieldValue,Class fieldType) throws IOException, DataException {
  if (fieldValue == null) {
    dos.writeByte(0);
    return;
  }
 else {
    dos.writeByte(1);
  }
  if (fieldType.equals(Integer.class))   dos.writeInt(((Integer)convert(fieldValue,DataType.INTEGER_TYPE)).intValue());
 else   if (fieldType.equals(Double.class))   dos.writeDouble(((Double)convert(fieldValue,DataType.DOUBLE_TYPE)).doubleValue());
 else   if (fieldType.equals(BigDecimal.class))   dos.writeUTF(((BigDecimal)convert(fieldValue,DataType.DECIMAL_TYPE)).toString());
 else   if (Date.class.isAssignableFrom(fieldType))   dos.writeLong(((Date)convert(fieldValue,DataType.DATE_TYPE)).getTime());
 else   if (fieldType.equals(Boolean.class))   dos.writeBoolean(((Boolean)convert(fieldValue,DataType.BOOLEAN_TYPE)).booleanValue());
 else   if (fieldType.equals(String.class))   IOUtil.writeString(dos,fieldValue.toString());
 else   if (fieldType.equals(IClob.class) || fieldType.equals(Clob.class))   IOUtil.writeString(dos,fieldValue.toString());
 else   if (fieldType.equals(IBlob.class) || fieldType.equals(Blob.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(Object.class) || fieldType.equals(DataType.getClass(DataType.ANY_TYPE))) {
    if (!(fieldValue instanceof Serializable))     throw new DataException(ResourceConstants.NOT_SERIALIZABLE_CLASS,fieldValue.getClass().getName());
    IOUtil.writeObject(dos,fieldValue);
  }
 else {
    throw new DataException(ResourceConstants.BAD_DATA_TYPE,fieldType.toString());
  }
}