Re: Internal Inconsistency in K2Sort
Re: Internal Inconsistency in K2Sort
- Subject: Re: Internal Inconsistency in K2Sort
- From: email@hidden
- Date: Wed, 30 Jan 2008 14:52:41 -0500
Thank you Alan and James,
"Anyone know of a clever way to
get null values to appear at the end of an ascending sorted list?"
You gave a good tip. I've discovered
that the only thing custom going on is in the Application constructor with
the line:
EOSortOrdering.ComparisonSupport.setSupportForClass(new
CXNullsAtEndComparisonSupport(), Object.class);
Probably that custom descendant of ComparisonSupport
is the culprit. It attempts to universally weigh null values as "infinite"
but otherwise act like the default comparison support. This way null values
always appear at the end of an ascending list. It seems to have the desired
effect most of the time and I can't figure out what might be going wrong.
Perhaps there is another solution that
I haven't thought of. Some better way to get nulls to appear at the end
rather than the beginning of an ascending sort?
-- Aaron
Alan Ward <email@hidden> wrote on 29-01-2008
05:35:25 PM:
> I have seen that and if I remember correctly it can be caused by
> sorting with a custom
> comparator that works inconsistently (i.e. one
that can say A > B
> and B > A). I could be wrong
> as it's been a while but I would check your comparator
classes if
> you have any.
>
> Alan
>
> On Jan 29, 2008, at 3:28 PM, email@hidden wrote:
>
>
> Has anyone ever received a strange WebObjects error when sorting
> related to an internal Apple "K2Sort" funky state?
>
> Here's the error:
>
> java.lang.IllegalStateException: Internal Inconsistency in K2Sort
>
> Here's the stack trace:
>
> _NSCollectionPrimitives.java 312
K2SortArray
> com.webobjects.foundation
> EOSortOrdering.java 202
_sortUsingKeyOrderArray
> com.webobjects.eocontrol
> EOSortOrdering.java 238
sortedArrayUsingKeyOrderArray
> com.webobjects.eocontrol
>
> From what I can tell, when our app starts up this error either never
> happens or it happens each time we try to perform a sort. Almost
> like playing the slots... at app launch time we don't know if things
> are going to sort correctly for the life of the app.
>
> It's concievable that something else is going on, that some user
> hits a branch of code that leaves the K2 algorithm in a broken
> state... but we haven't identified a series of steps that causes this.
>
> Anyone experience problems with the K2Sort?
>
> -- Aaron
> _______________________________________________
> Do not post admin requests to the list. They
will be ignored.
> Webobjects-dev mailing list
(email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden