Announcement Announcement Module
Collapse
No announcement yet.
Problem with EventBus and a istantiation of a IEventBusListener Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with EventBus and a istantiation of a IEventBusListener

    I have the same problem http://forum.springsource.org/showthread.php?t=68560 but in a different context;

    this is the app-context.xml
    PHP Code:
    <object id="applicationModel" class="sas.test.contacts.model.ApplicationModel"></object>
        
        <
    object id="repository"
            
    class="sas.test.contacts.repositories.MockContactService"></object>
        
        <
    object id="applicationController"
            
    class="sas.test.contacts.controller.ApplicationController">
            <
    constructor-arg ref="applicationModel"></constructor-arg>
            <
    constructor-arg ref="repository"></constructor-arg>
        </
    object
    The ApplicationController is istantiated twice (the first with null constructor arguments, the second with correct args).
    Note that in the ApplicationController constructr i register it as listener of EventBus (EventBus.addListener(this););

    After loaded the app-context.xml in the mainClass I trigger an event with EventBus but the ApplicationController instance fired is the first with null arguments. So the event handler function fails.

    Thanks in advance

  • #2
    Using Asser.notNull (constructor_arg,"message") it avoids the double instantiation of ApplicationController class and everything goes well.

    It's due to the fact that a (IllegalArgument)Error blocks the object factoring?

    Everytime declaring in the application-context.xml an object with constructor-args it must assure that args are not null?

    Comment


    • #3
      Hi,

      due to a bug/limitation with describeType(), the as3commons-reflect library needs to instantiate a class to get hold of its constructor info. That's why you are seeing that it gets instantiated twice.

      As long as this is not solved, we'll have to work around it this way.

      I would suggest to use assertions anyway to check for valid constructor args.

      regards,
      Christophe

      Comment


      • #4
        Thanks! SAS is great framework for IOC, MVC, ecc but also cover some actionscript lacks with Assertion, Logging, Maps ecc
        Thanks again

        Comment

        Working...
        X