History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: PSL-350
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Jens Halm
Reporter: Michael Stepanov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Parsley Core

Incorrect sorting of MessageHandler's using the "order" attribute

Created: 19/Jan/10 12:08 AM   Updated: 03/Jan/11 04:27 AM
Component/s: Messaging
Affects Version/s: 2.2.0
Fix Version/s: 2.2.0


 Description  « Hide
I've played with some MessageHandlers and found that if you specify order as follow

[MessageHandler(order="999")]
public function handler1(msg:Message):void
{
...
}

[MessageHandler(order="1900")]
public function handler2(msg:Message):void
{
...
}

than call order is 1900,999. This corresponds to flash array sortOn behaviour because by default Array sort occurs using string representation of field. You use this code

function Processor (receivers:Array, handler:Function, async:Boolean = true, handleErrors:Boolean = true) {
this.receivers = receivers;
this.handler = handler;
this.async = async;
this.handleErrors = handleErrors;
receivers.sortOn("order");
}

in org.spicefactory.parsley.core.messaging.impl.Processor class.

But order field is the numeric one, so you probably should use

receivers.sortOn("order", Array.NUMERIC);

This affects all places of code there you use such sorting.

 All   Comments   Change History      Sort Order:
Michael Stepanov - 19/Jan/10 12:09 AM
This occurs in Parsley 2.2.RC1 (not found this version in list.

Jens Halm - 19/Jan/10 12:16 AM
Thanks for spotting this. I usually use Array.NUMERIC in these cases of course, so I assume that it's only in this class.