powered by Jive Software

Bug Report: Data Class Getters

The data classes have a lot of accessors that access fields 3 levels deep without doing any null checking.

Example (from AuthExtension.as)

public function get username():String

{

return myUsernameNode.firstChild.nodeValue;

}

This throws an exception if myUsernameNode is null, or if it has no firstChild. I’ve attached a patch that makes these getters safer, like this:

public function get username():String

{

if(myUsernameNode && myUsernameNode.firstChild)

   return myUsernameNode.firstChild.nodeValue;

return null;

}

Affected files: AuthExtension.as, FormExtension.as, Message.as, MUCExtension.as, MUCItem.as, MUCStatus.as, RegisterExtension.as, SearchExtension.as, and XMPPStanza.as.

All comments/code reviews welcome.

Thanks,

Karthik
data.patch (8722 Bytes)