Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: [FIXED] Mediator Class: listNotificationInterests returns null  (Read 2859 times)
Kevin Kirkup
Newbie
*
Posts: 1


View Profile Email
« on: June 09, 2010, 06:39:11 »

In the base Mediator class, the listNotificiationInterests method returns 'null' by default.
:
public String[] listNotificationInterests( )
{
return null;
}

If you try to create a Mediator subclass and don't implement a listNotificationsInterests method, you will get a NullPointer exception because it is being referenced in registerMediator method of the View Class.
:
// Get Notification interests, if any.
String[] noteInterests = mediator.listNotificationInterests();
if (noteInterests.length == 0) {
return;
}

I think the default listNotificationsInterests should probably return a new String[] instead.

Thoughts?
« Last Edit: November 14, 2010, 03:10:53 by puremvc » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 09, 2010, 05:19:24 »

Absolutely it should. This is what the AS3 reference does - it returns an empty array. Don't know how the Java Standard port missed this. It's in the MultiCore port:

:
/**
* List the <code>INotification</code> names this <code>Mediator</code>
* is interested in being notified of.
*
* @return String[] the list of <code>INotification</code> names
*/
public String[] listNotificationInterests( )
{
return new String[]{};
}

BTW, in the meantime, I would suggest using the multicore port if possible.

-=Cliff>
« Last Edit: June 09, 2010, 05:47:10 by puremvc » Logged
Pages: [1]
Print