Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-dev] Review of fix for bug# 257256 (SDO 2.1.1 TCK: null pointer exception occurs when unbounded ID element is present) - involves change to ObjectBuilder

    The change looks good.
    The addition of the new protected method should have minimal impact on the other 46 existing clients of ObjectBuilder in foundation.
    The overridden implementation in OX that returns an XMLRecord instance of AbstractRecord looks fine as long as the session parameter and session.getSessionName() can be assumed to be !null.
    thank you
-----Original Message-----
From: David Mccann
Sent: Tuesday, December 02, 2008 15:28
To: Dev mailing list for Eclipse Persistence Services
Subject: [eclipselink-dev] Review of fix for bug# 257256 (SDO 2.1.1 TCK: null pointer exception occurs when unbounded ID element is present) - involves change to ObjectBuilder


I'm a proposing a slight change to ObjectBuilder to resolve the above-mentioned issue.  On (or near, depending on the build) line 1783 in the extractPrimaryKeyFromObject(Object, AbstractSession, boolean) method in ObjectBuilder the code is:
  • AbstractRecord databaseRow = createRecord(size, session);
I am proposing it be changed to:
  • AbstractRecord databaseRow = createRecordForPKExtraction(size, session);
Where createRecordForPKExtraction() would be:

     * Create a new row/record for the object builder. This allows subclasses to
     * define different record types.  This will typically be called when a
     * record will be used for temporarily holding on to primary key fields.
    protected AbstractRecord createRecordForPKExtraction(int size, AbstractSession session) {
        return createRecord(size, session);

This will allow us (in XMLObjectBuilder) to return the correct record type for primary key extraction purposes.  Please let me know if you have any issues or concerns with these changes.  For reference, here is the bug description:
The TCK test DefineTypesTest.testDynamicTypesGroup1() involves a schema where a complex type contains an unbounded element of type xsd:ID.  A null pointer exception occurs upon load operation:

    at org.eclipse.persistence.internal.sessions.AbstractRecord.put(
    at org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping.writeFromObjectIntoRow(
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(
    at org.eclipse.persistence.internal.descriptors.ObjectBuilder.extractPrimaryKeyFromObject(
    at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.extractPrimaryKeyFromObject(
    at org.eclipse.persistence.oxm.record.UnmarshalRecord.endDocument(

This occurs because we are returning the wrong record type for this mapping (composite direct collection) during primary key extraction.  The code in ObjectBuilder simply calls createRecord(size, session) which in XMLObjectBuilder returns an UnmarshalRecord.  In this case, however, we need a DOMRecord such that the code can perform get and put operations (which are not supported in unmarshal record).


David McCann | Principal Software Engineer | TopLink Product
Oracle Corporation Canada
45 O'Connor Street, Suite 400
Ottawa, Ontario K1P 1A4
613.238.2818 (fax)

Back to the top