Program: 66488
Project: 66488
Buggy source:
/** 
 * Purpose: Serialize an SDODataObject to an ObjectOutputStream This function is mandated by the Externalizable interface. It writes binary data in the same order as was will be read back in readExternal(). Prerequisites: An object has already been constructed and associated with the theSDODataObject member
 */
public void writeExternal(ObjectOutput objectOutput) throws IOException {
  GZIPOutputStream aGZIPOutputStream=null;
  ByteArrayOutputStream aByteOutputStream=null;
  if ((theSDODataObject.getContainer() == null)) {
    try {
      objectOutput.writeByte(SDO_ROOT_OBJECT_IDENTIFIER);
      aByteOutputStream=new ByteArrayOutputStream();
      aGZIPOutputStream=new GZIPOutputStream(aByteOutputStream);
      XMLDocument aDocument=aHelperContext.getXMLHelper().createDocument(theSDODataObject,SDOConstants.SDO_URL,SDOConstants.SDO_PREFIX + SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT + DEFAULT_ROOT_ELEMENT_NAME);
      aHelperContext.getXMLHelper().save(aDocument,aGZIPOutputStream,null);
      aGZIPOutputStream.finish();
      aGZIPOutputStream.flush();
      aByteOutputStream.flush();
      byte[] buf=aByteOutputStream.toByteArray();
      objectOutput.writeInt(buf.length);
      objectOutput.write(buf);
    }
  finally {
      if (aGZIPOutputStream != null) {
        aGZIPOutputStream.close();
      }
      if (aByteOutputStream != null) {
        aByteOutputStream.close();
      }
    }
  }
 else {
    objectOutput.writeByte(SDO_INTERNAL_OBJECT_IDENTIFIER);
    String aPath=theSDODataObject._getPath();
    objectOutput.writeUTF(aPath);
    ((ObjectOutputStream)objectOutput).writeObject(theSDODataObject.getRootObject());
  }
}

Fixed version (ground truth):
/** 
 * Purpose: Serialize an SDODataObject to an ObjectOutputStream This function is mandated by the Externalizable interface. It writes binary data in the same order as was will be read back in readExternal(). Prerequisites: An object has already been constructed and associated with the theSDODataObject member
 */
public void writeExternal(ObjectOutput objectOutput) throws IOException {
  GZIPOutputStream aGZIPOutputStream=null;
  ByteArrayOutputStream aByteOutputStream=null;
  if ((theSDODataObject.getContainer() == null)) {
    try {
      String identifier=null;
      if (this.aHelperContext.getClass() == SDOHelperContext.class) {
        identifier=((SDOHelperContext)this.aHelperContext).getIdentifier();
      }
      if (identifier != null && !(identifier.equals("String_Node_Str"))) {
        objectOutput.writeByte(SDO_HELPER_CONTEXT_ID_IDENTIFIER);
        objectOutput.writeUTF(identifier);
      }
 else {
        objectOutput.writeByte(SDO_ROOT_OBJECT_IDENTIFIER);
      }
      aByteOutputStream=new ByteArrayOutputStream();
      aGZIPOutputStream=new GZIPOutputStream(aByteOutputStream);
      XMLDocument aDocument=aHelperContext.getXMLHelper().createDocument(theSDODataObject,SDOConstants.SDO_URL,SDOConstants.SDO_PREFIX + SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT + DEFAULT_ROOT_ELEMENT_NAME);
      aHelperContext.getXMLHelper().save(aDocument,aGZIPOutputStream,null);
      aGZIPOutputStream.finish();
      aGZIPOutputStream.flush();
      aByteOutputStream.flush();
      byte[] buf=aByteOutputStream.toByteArray();
      objectOutput.writeInt(buf.length);
      objectOutput.write(buf);
    }
  finally {
      if (aGZIPOutputStream != null) {
        aGZIPOutputStream.close();
      }
      if (aByteOutputStream != null) {
        aByteOutputStream.close();
      }
    }
  }
 else {
    objectOutput.writeByte(SDO_INTERNAL_OBJECT_IDENTIFIER);
    String aPath=theSDODataObject._getPath();
    objectOutput.writeUTF(aPath);
    ((ObjectOutputStream)objectOutput).writeObject(theSDODataObject.getRootObject());
  }
}