mercredi 30 novembre 2016

Sonar blocker for managed "ame" + flex project

I'm trying to fix bocker given by sonar for a Flex+ actionScript3 web application.

I was faced to this unresolvable blocker:

The managed event "ame" is either misspelled or is missing a companion Event metadata tag

My code is as follows:

    [Bindable]  
    [ManagedEvents(names="message")]
    public class ClassName extends EventDispatcher
    {
      .........
     }

I tried to fix this issue as follows:

    [Bindable]
    [Event(name="message",type="package.ClassEvent")]
    [ManagedEvents(names="message")]
    public class ClassName extends EventDispatcher
    {
      ....    
     }

Where in package.ClassEvent is the declared event "message"

[Command(selector="message")]
public function message(evt:NameEvent):AsyncToken
{           
    .....
}

PS: Sonar suggest as solution :

The "ManagedEvents" metadata tag allows you to flag an event as being managed. By definition this "ManageEvents" metadata tag should be used in pair with an "Event" metadata tag.

Noncompliant Code Example

[Event(name="message", type="my.package.MyEvemt")] [ManagedEvents("mes")] //This "mes" event is not defined with the "Event" metadata tag public class MyClass {...} Compliant Solution [Event(name="message", type="my.package.MyEvemt")] [ManagedEvents("message")] public class MyClass {...}

Aucun commentaire:

Enregistrer un commentaire