Runtime warning when chaining Commands with the CommandSignal extension Part II

dotdotcommadot's Avatar

dotdotcommadot

04 Apr, 2012 02:13 PM

Hi there,

I'm having the exact same problem as in this thread:
http://knowledge.robotlegs.org/discussions/problems/415-runtime-war...
, but with the difference that I just switched to SwiftSuspenders 2 (which i got here: https://github.com/tschneidereit/robotlegs/downloads)

At first I got this warning when chaining commands (also when triggering a command 2 times right after eachother), with a payload that has been injected before, and I just didn't mind..
But, while I was programming, I noticed i'd need optional payloads in my commands, so i switched to swiftsuspenders2.
But swiftsuspenders2 throws a real error for this, so it's currently blocking the application..

So: either I use the nullObject pattern so I don't need swiftsupenders2 (which I think is a bit too much work, if I need to implement it for every single command...), or maybe someone comes up with a genius solution... ? (fingers crossed)

someone...anyone..?

  1. Support Staff 1 Posted by Shaun Smith on 04 Apr, 2012 04:20 PM

    Shaun Smith's Avatar

    It's possible that a temporary mapping isn't being unmapped in time. Could you provide more info? Possibly a stack trace (with sensitive info stripped out of course)

  2. 2 Posted by dotdotcommadot on 05 Apr, 2012 09:01 AM

    dotdotcommadot's Avatar

    Hmm, this is what I'm getting:
    Warning: Injector already has a mapping for be.corelio.spoleto.model.vo::DocumentVo|.
     If you have overridden this mapping intentionally you can use "injector.unmap()" prior to your replacement mapping in order to avoid seeing this message.

    Error: Error while removing an injector mapping: No mapping defined for dependency be.corelio.spoleto.model.vo::DocumentVo|
    at org.swiftsuspenders::Injector/unmap()[/Users/till/dev/swiftsuspenders/swiftsuspenders/src/org/swiftsuspenders/Injector.as:243]
    at org.robotlegs.adapters::SwiftSuspendersInjector/unmap()[/Users/till/dev/robotlegs/robotlegs/src/org/robotlegs/adapters/SwiftSuspendersInjector.as:101]
    at org.robotlegs.base::SignalCommandMap/unmapSignalValues()[/Users/passepartout/FlexWorkspace/spoleto/libs/org/robotlegs/base/SignalCommandMap.as:110]
    at org.robotlegs.base::SignalCommandMap/routeSignalToCommand()[/Users/passepartout/FlexWorkspace/spoleto/libs/org/robotlegs/base/SignalCommandMap.as:93]
    at Function/<anonymous>()[/Users/passepartout/FlexWorkspace/spoleto/libs/org/robotlegs/base/SignalCommandMap.as:35]
    at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:91]
    at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
    at be.corelio.spoleto.view.documents::DocumentsComp/onRequestRefreshDocument()[/Users/passepartout/FlexWorkspace/spoleto/src/be/corelio/spoleto/view/documents/DocumentsComp.as:137]
    at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:87]
    at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
    at Function/<anonymous>()[/Users/passepartout/FlexWorkspace/spoleto/src/be/corelio/spoleto/view/ui/topmenu/TopMenu.as:244]

    As you can see, i first get the robotlegs warning that the mapping already exists, and secondly I get the swiftsuspenders error that it doesn't exist.

    Basicly, I want to refresh a jobslist in object documentVo
    So what I do:
    - refreshDocumentSignal.dispatch( documentsModel.document );
        -> I should give documentsModel.document as a payload, because it is possible that I need to refresh other documents as well.. otherwise I would've let the command get the document from documentsModel.
    - getJobsByQuerySignal.dispatch( document.queryString, document.query, document );
        -> this should get all the jobs from the server. Even putting dummy data here, like "new DocumentVo()" crashes the application.

    It used to work in SwiftSuspenders1.
    I'm guessing that it might be looking for a documentVo, because it probably exists in some temporary mapping, and then tries to get it from the rest of the mappings, but then notices that this doesn't exist..
    or something like this, no?
    It seems like the [inject] functionality in the command might be confusing him:" should i get the documentVo from my signal, of should I get it from my mappings".

    Sorry if I'm not entirely clear in my explanation.

  3. 3 Posted by dotdotcommadot on 05 Apr, 2012 09:10 AM

    dotdotcommadot's Avatar

    To recreate the bug, I think all you need to do is:
    - create a signal that requires an object SomePayloadObject
    - in your mediator: firstSignal.dispatch( new SomePayloadObject() )
    - in the command, triggered by this signal, dispatch another signal that uses the same type of payload:
    secondSignal.dispatch( new SomePayloadObject );

  4. 4 Posted by Stray on 05 Apr, 2012 09:23 AM

    Stray's Avatar

    Hi Hans,

    Could you try with the version of SCM that is on my fork:

    https://github.com/Stray/signals-extensions-CommandSignal

    There was an issue where it became apparent that creating and executing commands had to happen separately, it sounds like you have a version from before that.

    Stray

  5. 5 Posted by dotdotcommadot on 05 Apr, 2012 09:58 AM

    dotdotcommadot's Avatar

    I was already working with the latest version..
    Maybe the problem is that the extension is updated for Swiftsuspenders 1.6, and not for Swiftsuspenders 2..? (as it says on the messages on https://github.com/Stray/signals-extensions-CommandSignal).

  6. 6 Posted by dotdotcommadot on 05 Apr, 2012 10:28 AM

    dotdotcommadot's Avatar

    Anyway, I switched back to the regular build (https://github.com/robotlegs/robotlegs-framework/tree/master), which includes SwiftSuspenders 1.6.
    Everything works again, but no more optional injections :)

    Thx a lot for your help anyway!!

  7. Support Staff 7 Posted by Till Schneidere... on 05 Apr, 2012 11:44 AM

    Till Schneidereit's Avatar

    Hey Hans,

    sorry for the annoying differences between Swiftsuspenders 1.6 and 2b.
    I'm afraid that I might have to can the warnings for most cases in
    Swiftsuspenders 2 anyway: As I have discovered, they make much less
    sense for a fluid API.

    I guess that means that 2.0 final will again be warning-free for your use-case.

    cheers,
    till

  8. 8 Posted by dotdotcommadot on 05 Apr, 2012 12:54 PM

    dotdotcommadot's Avatar

    Hey Till,

    Cool, I'll keep on eye out for that one. For the moment I'll just be checking for null objects before i pass them to a signal, and send empty objects instead.

    It's totally awesome how fast and useful you people respond here every time!
    Thanks a lot!
    Hans

  9. Support Staff 9 Posted by Till Schneidere... on 05 Apr, 2012 01:20 PM

    Till Schneidereit's Avatar

    We try our best, thank you :)

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac