Bug 334353

Summary: PERF: dead code in AbstractRecord
Product: z_Archived Reporter: Martin JANDA <jandam>
Component: EclipselinkAssignee: James Sutherland <jamesssss>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P2 CC: jamesssss, tom.ware
Version: unspecifiedKeywords: performance
Target Milestone: ---Flags: jamesssss: iplog+
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch none

Description Martin JANDA CLA 2011-01-14 03:52:00 EST
Build Identifier: 2.2 revision 8831 - 01/14/2011 03:10 AM

DatabaseField.setIndex is never called in methods:
*) public Object get(DatabaseField key)
*) public Object getIndicatingNoEntry(DatabaseField key)

--- Original code
        index = this.fields.indexOf(key);
        if (index >= 0) {
            // PERF: If the fields index was not set, then set it.
            if (index == -1) {
                key.setIndex(index);
            }
            return this.values.get(index);
        } else {
            return null;
        }

--- Intended code
        index = this.fields.indexOf(key);
        if (index >= 0) {
            // PERF: If the fields index was not set, then set it.
!            if (key.getIndex() == -1) {
                key.setIndex(index);
            }
            return this.values.get(index);
        } else {
            return null;
        }

--- Impact
Access to record values are made through DatabaseFields with index already set.

According to my observation 'setIndex' should be called in ParameterExpression and in AbstractTransformationMapping.

Reproducible: Always
Comment 1 Tom Ware CLA 2011-02-03 09:45:32 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 James Sutherland CLA 2011-05-17 10:40:20 EDT
Observation seems correct.

Fixing in 2.3.
Comment 3 James Sutherland CLA 2011-05-24 11:39:00 EDT
Created attachment 196450 [details]
patch
Comment 4 James Sutherland CLA 2011-06-01 14:02:44 EDT
Fixed in 2.3
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:09:39 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink