Watch, Follow, &
Connect with Us
Public Report
Report From: JBuilder/Database    [ Add a report in this area ]  
Report #:  6097   Status: Closed
Constructor SortDescriptor(SortDescriptor desc) bug
Project:  JBuilder Build #:  9.0.125.0
Version:    12 Submitted By:   Lamar Channell
Report Type:  Basic functionality failure Date Reported:  9/29/2003 2:24:50 PM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   193964
Resolution: Fixed (Resolution Comments) Resolved in Build: : 012.000.203.000
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The constructor for SortDescriptor(SortDescriptor desc) does not set the options field. I'm trying to clone a sort descriptor with the Sort.SORT_AS_INSERTED option set. The current source for the constructor:

public SortDescriptor(SortDescriptor desc) {
  this(desc.indexName, desc.sortKeys, desc.descending, desc.caseInsensitive, desc.unique, desc.localName);
}

needs to be changed to include the setting of the desc.options field.
Steps to Reproduce:
1) create a SortDescriptor sd1 with the option Sort.SORT_AS_INSERTED
2) clone the SortDescriptor creating sd2 using the constructor
(i.e. sd2 = new SortDescriptor(sd1); )
3) execute sd1.getOptions() = 16
4) execute sd2.getOptions() = 0

Or use attached demo code.
Workarounds
Use the following constructor:

sd2 = new SortDescriptor(sd1.getIndexName(), sd1.getKeys(),
sd1.getDescending(), sd1.getLocalName(), sd1.getOptions());

---------

Use the following constructor:

sd2 = new SortDescriptor(sd1.getIndexName(), sd1.getKeys(),
sd1.getDescending(), sd1.getLocalName(), sd1.getOptions());
Attachment
None
Comments

None

Server Response from: ETNACODE01