Spicefactory Forum Index Spicefactory
Discuss Spicefactory Open Source Projects
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MapCommand doesn`t show error with wrong injection

 
Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory - General Discussions
View previous topic :: View next topic  
Author Message
p.r.i.d.e.



Joined: 16 Apr 2012
Posts: 7
Location: Ukraine

PostPosted: Mon Apr 16, 2012 9:16 pm    Post subject: MapCommand doesn`t show error with wrong injection Reply with quote

Hi Jens,

I have been working with Parsley since version 2.4.
Some days ago I decided to try new version 3.0 and I met some unexpected behavior.
I have started using MapCommand insted DynamicCommand, new features sounded good for me. But when I made simple MapCommand and made wrong injection to the class the Parsley did not invoke the execute method and did not throw some special errors. If injections are correct - all works fine. I guess it is an unpleasant bug.

I used next libs:
    parsley-core-3.0.0.swc
    parsley-flex-3.0.0.swc
    spicelib-commands-3.1.1.swc
    spicelib-reflect-3.0.0.swc
    spicelib-util-3.1.0.swc




Log of org.spicefactory.* (LogEventLevel.ALL)
Code:
INFO:  Initialize Flex Support
Using new ApplicationDomain for key [object _TestMapCommand_mx_managers_SystemManager]
Add org.spicefactory.parsley.core.view.metadata::Autoremove to cache for [Domain 1]
Add view root: TestMapCommand0/TestMapCommand
Creating Context [Context(FlexConfig{MainConfig})] without parent
Add org.spicefactory.parsley.asconfig.metadata::ObjectDefinitionMetadata to cache for [Domain 1]
Add org.spicefactory.parsley.asconfig.metadata::DynamicObjectDefinitionMetadata to cache for [Domain 1]
Add org.spicefactory.parsley.asconfig.metadata::InternalProperty to cache for [Domain 1]
Add MainConfig to cache for [Domain 2]
Add org.spicefactory.parsley.command.tag::MapCommandTag to cache for [Domain 2]
Add GetUsersCommand to cache for [Domain 2]
Add GetUsersMessage to cache for [Domain 2]
Executing command [AsyncCommand]
Completed all commands in [AsyncCommand]
Executing command [AsyncCommand]
Completed all commands in [AsyncCommand]
Executing command [AsyncCommand]
Completed all commands in [AsyncCommand]
Process view 'TestMapCommand0' with [Context(FlexConfig{MainConfig})]
Add TestMapCommand to cache for [Domain 2]
Setting processing domain: [object ApplicationDomain]
Add mx.core::UIComponent to cache for [Domain 2]
Add spark.components.supportClasses::SkinnableComponent to cache for [Domain 2]
Add spark.components::SkinnableContainer to cache for [Domain 2]
Add flash.display::DisplayObjectContainer to cache for [Domain 2]
Add flash.display::Sprite to cache for [Domain 2]
Add flash.display::DisplayObject to cache for [Domain 2]
Add spark.components::Application to cache for [Domain 2]
Add flash.display::InteractiveObject to cache for [Domain 2]
Add spark.components.supportClasses::SkinnableContainerBase to cache for [Domain 2]
Add mx.core::FlexSprite to cache for [Domain 2]
Add flash.events::EventDispatcher to cache for [Domain 2]
Setting processing domain: null
Add Function to cache for [Domain 2]
Configure managed object with [ObjectDefinition(type = TestMapCommand, id = [[Object 1]])] and 1 processor(s)
Applying [MessageDispatcher([Property dispatcher in class TestMapCommand])] to managed object with [ObjectDefinition(type = TestMapCommand, id = [[Object 1]])]
Add view 'TestMapCommand0' to [Context(FlexConfig{MainConfig})]
Dispatch message '[object GetUsersMessage]' with 1 receiver(s)
Add GetUsersCommand to cache for [Domain 1]
Add org.spicefactory.lib.command.light::LightCommandAdapter to cache for [Domain 2]
Setting processing domain: [object ApplicationDomain]
Add org.spicefactory.lib.command.base::AbstractAsyncCommand to cache for [Domain 2]
Add org.spicefactory.lib.command.base::AbstractSuspendableCommand to cache for [Domain 2]
Add org.spicefactory.lib.command.base::AbstractCancellableCommand to cache for [Domain 2]
Setting processing domain: null
Configure managed object with [ObjectDefinition(type = org.spicefactory.lib.command.light::LightCommandAdapter, id = [[Object 2]])] and 0 processor(s)
Discarding command status execute for message '[object GetUsersMessage]': no matching observer
Executing command [AsyncCommand]
Setting processing domain: [object ApplicationDomain]
Setting processing domain: null
Add Model to cache for [Domain 2]
Configure managed object with [ObjectDefinition(type = GetUsersCommand, id = [[Object 3]])] and 1 processor(s)
Applying [Property(name=[Property model in class GetUsersCommand],value={ImplicitTypeReference(type=undefined)})] to managed object with [ObjectDefinition(type = GetUsersCommand, id = [[Object 3]])]




There are a simple code snippets to reproduce this issue.

TestMapCommand
Code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx"
            minWidth="955"
            minHeight="600"
            xmlns:parsley="http://www.spicefactory.org/parsley">

   <fx:Script>
      <![CDATA[
         import mx.logging.LogEventLevel;
         
         [MessageDispatcher]
         public var dispatcher:Function;
         
         protected function clickHandler():void {
            dispatcher(new GetUsersMessage());
         }
      ]]>
   </fx:Script>


   <fx:Declarations>
      <s:TraceTarget>
         <s:filters>
            <fx:String>org.spicefactory.*</fx:String>
         </s:filters>
         <s:level>{LogEventLevel.ALL}</s:level>
      </s:TraceTarget>
      
      <parsley:Configure/>

      <parsley:ContextBuilder>
         <parsley:MessageSettings unhandledErrors="{ErrorPolicy.RETHROW}"/>
         <parsley:FlexConfig type="{MainConfig}"/>
      </parsley:ContextBuilder>
   </fx:Declarations>

   <s:Button click="clickHandler()"/>
</s:Application>


MainConfig.mxml
Code:
<?xml version="1.0" encoding="utf-8"?>
<parsley:Objects xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/mx"
             xmlns:parsley="http://www.spicefactory.org/parsley">

   <fx:Declarations>
      <parsley:MapCommand type="{GetUsersCommand}"
                     messageType="{GetUsersMessage}"/>
   </fx:Declarations>
</parsley:Objects>


GetUsersCommand.as
Code:
package {
   
   public class GetUsersCommand {
      
      [Inject]
      public var model:Model; // wrong injection, this class is not managed.
      
      public function execute():void {
      }
   }
}


GetUsersMessage.as and Model.as are simple classes without properties.

Please check it.

Regards,
Alex
Back to top
View user's profile Send private message
p.r.i.d.e.



Joined: 16 Apr 2012
Posts: 7
Location: Ukraine

PostPosted: Tue Apr 17, 2012 9:16 pm    Post subject: Reply with quote

The same problem occurs if you manage two objects with the same interface and then try to inject an object by this interface to MapCommand. That also won`t lead you to error screen.

Why MapCommnand`s work in silent mode? (Any errors should be caused by misconfiguration (e.g. ambuigities or missing dependencies).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Spicefactory Forum Index -> Spicefactory - General Discussions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group