Commands are set up multiple times? Possible Bug?

12 views
Skip to first unread message

William Lepinski

unread,
Apr 11, 2011, 3:11:01 PM4/11/11
to Swiz Framework
Today while I was debugging an application I checked out that my
Commands was getting instantiated 3 times. Take a the log messages
below:

InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }
BeanFactory::setUpBean( Bean{ source: [object LoadResourcesCommand],
name: null } )
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }
BeanFactory::setUpBean( Bean{ source: [object LoadResourcesCommand],
name: null } )
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }
BeanFactory::setUpBean( Bean{ source: [object LoadResourcesCommand],
name: null } )
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }
BeanFactory::setUpBean( Bean{ source: [object LoadResourcesCommand],
name: null } )
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
LoadResourcesCommand], name: null }

This happens when I run the application without any breakpoints, if a
put some breakpoints into the BeanFactory::setUpBean
those strange log messages doesn't appear on my console. :( Check out
the log messages printed when I execute the code line by line with
breakpoints:

BeanFactory::setUpBean( Bean{ source: [object ApplicationCommandMap],
name: commandMap } )
BeanFactory::setUpBean( Prototype{ type: [class LoadResourcesCommand],
name: null } )
BeanFactory::setUpBean( Bean{ source: [object ReportFacade], name:
reportFacade } )
BeanFactory::setUpBean( Bean{ source: [RemoteObject
destination="reportFacade" channelSet="null"], name: reportRemote } )
InjectProcessor set up [Inject( source="reportRemote" )] on
Bean{ source: [object ReportFacade], name: reportFacade }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }
InjectProcessor set up [Inject] on Prototype{ type: [class
LoadResourcesCommand], name: null }

I guess the problem is on the method getObject():* (line 51 of
Prototype.as) sometimes the variable instance:* is filled with the
same value of source property, sometimes is null so the prototype
delegates again the setUp to the beanFactory.

Thanks in advance.

William Lepinski

unread,
Apr 11, 2011, 3:28:28 PM4/11/11
to Swiz Framework
I'm uploaded a small project test case on http://dl.dropbox.com/u/514060/swiz-command-test.rar

Thanks.

William Lepinski

unread,
Apr 11, 2011, 3:50:59 PM4/11/11
to Swiz Framework
I guess I fix the bug changing the line 126 on
https://github.com/swiz/swiz-framework/blob/master/src/org/swizframework/utils/commands/CommandMap.as

From:
_swiz.beanFactory.addBean( commandPrototype );

To:
_swiz.beanFactory.addBean( commandPrototype, false );

Is this right?

On Apr 11, 4:28 pm, William Lepinski <wil...@gmail.com> wrote:
> I'm uploaded a small project test case onhttp://dl.dropbox.com/u/514060/swiz-command-test.rar

Brian Kotek

unread,
Apr 11, 2011, 4:18:21 PM4/11/11
to swiz-fr...@googlegroups.com
I've never used the command map so I'm really not sure. If you change that in CommandMap, does it work correctly?


--
You received this message because you are subscribed to the Google Groups "Swiz Framework" group.
To post to this group, send email to swiz-fr...@googlegroups.com.
To unsubscribe from this group, send email to swiz-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swiz-framework?hl=en.


William Lepinski

unread,
Apr 11, 2011, 4:37:32 PM4/11/11
to Swiz Framework
I'm doing some tests here but apparently works.

Modifying the addBean method makes the command be instantiated when
the event gets called and handled on the CommandMap..
I'm not sure about the GC of the created command but the log messages
now makes more sense.

Take a look:

[SWF] SwizCommandBug.swf - 2,392,520 bytes after decompression
Swiz dispatcher set to SwizCommandBug0
Swiz domain set to null
Dispatched Swiz Created Event to find parent
Swiz domain set to [object ApplicationDomain]
Swiz global dispatcher set to SwizCommandBug0
Processors initialized
BeanFactory completing setup
BeanFactory::setUpBean( Bean{ source: [object ApplicationCommands],
name: null } )
BeanFactory::setUpBean( Bean{ source: [object ApplicationModel], name:
null } )
BeanFactory::setUpBean( Bean{ source: [object UserModel], name:
null } )
BeanFactory initialized
Set up event type set to addedToStage
Set up event phase set to capture phase
Set up event priority set to 50
Tear down event type set to removedFromStage
Tear down event phase set to capture phase
Tear down event priority set to 50
BeanFactory::setUpBean( Bean{ source: SwizCommandBug0, name: null } )
Swiz initialized
BeanFactory::setUpBean( Bean{ source: [object ExampleCommand], name:
null } )
InjectProcessor set up [Inject] on Bean{ source: [object
ExampleCommand], name: null }
InjectProcessor set up [Inject] on Bean{ source: [object
ExampleCommand], name: null }
executed
appModel: [object ApplicationModel]
userModel: [object UserModel]

I will probably fill in a new bug in Jira for this issue.

;)


On Apr 11, 5:18 pm, Brian Kotek <brian...@gmail.com> wrote:
> I've never used the command map so I'm really not sure. If you change that
> in CommandMap, does it work correctly?
>
>
>
>
>
>
>
> On Mon, Apr 11, 2011 at 3:50 PM, William Lepinski <wil...@gmail.com> wrote:
> > I guess I fix the bug changing the line 126 on
>
> >https://github.com/swiz/swiz-framework/blob/master/src/org/swizframew...

ben.clin...@gmail.com

unread,
Apr 19, 2011, 2:11:52 PM4/19/11
to swiz-fr...@googlegroups.com
Checked in a fix for this today. Will be in the next release, or you can grab it from the develop branch. Thanks for submitting.

Ben
Reply all
Reply to author
Forward
0 new messages