Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
draekz #1
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Subject: Bug in agsXMPP: Connection Error when doing RosterItem.GetGroups()
When I do a "GetGroups" function of a RosterItem (during RosterItem event) that is not part of any group, I get a ConnectionError event sparked from the Xmpp connection object saying "A null value was found where an object instance was required."

This is a bug from within agsXMPP so it seems..

Anyone has any ideas on what I might do to find out more? or get past this?
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no, there must be something wrong in your code.

GetGroups returns a ElementList, if the RosterItem object has no groups then it returns a empty ElementList.

please post the code which causes the exception.

Alex
Alexander Gnauck
AG-Software
Avatar
draekz #3
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Yeah I'd like it to be my code (because then i could fix it), but I honestly don't see how it can be:

    ...
    _connection.OnError += new ErrorHandler (ConnectionError);
    _connection.OnRosterItem += new agsXMPP.XmppClientConnection.RosterHandler (ConnectionRosterItem);
}

private void ConnectionRosterItem (object sender, RosterItem item)
{
    Console.WriteLine("Roster Item Found");

    foreach (agsXMPP.protocol.Base.Group jgroup in item.GetGroups ())
    {
        // This code does not execute, i get an event right away for connection error, giving me the null.
    }

    Console.WriteLine("Done.");
}

private void ConnectionError (object sender, Exception e)
{
    LogUtility.Debug ("Connection error: "+e.Message);
}

Output would be then:

Roster Item Found
Connection error: A null value was found where an object instance was required.


If I go into the contact list using another IM program, I can get the list for this account, I can move the email address that is not in a group and put it into a group, and reload my app, and it works fine.
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this code works fine for me.
Can you also output the Xml of the rosterItem (item.ToString())?
Alexander Gnauck
AG-Software
Avatar
draekz #5
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Yeah sure, its:

XML: <item xmlns="jabber:iq:roster" subscription="none" jid="test@jabber.org" name="Test" />
Avatar
draekz #6
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
While this works:

XML: <item xmlns="jabber:iq:roster" subscription="none" jid="test@jabber.org" name="Test"><group>Test</group></item>

since it has the group section. but if the group section is missing and I do GetGroups() it gives the error.

This cannot be something I'm doing, i'm barely doing anything at all.
Avatar
draekz #7
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
I also tried to skip this for now, and move forward to do things like removing a contact from the roster, and i'm finding more of the same types of errors now:

OUTGOING: <iq id="agsXMPP_8" type="set"><query xmlns="jabber:iq:roster"><item jid="testte@lala" name="Testte" /></query></iq>

INCOMING: <iq xmlns="jabber:client" from="galadraek@jabber.org/agsXMPP" type="set" id="push" to="galadraek@jabber.org/agsXMPP"><query xmlns="jabber:iq:roster"><item subscription="none" jid="testte@lala" name="Testte" /></query></iq>

2007/11/27 06:11:30 [JabberSession.ConnectionIq] IQ

XML: <item xmlns="jabber:iq:roster" subscription="none" jid="testte@lala" name="Testte" />

2007/11/27 06:11:30 [JabberSession.ConnectionError] Connection error: A null value was found where an object instance was required.

INCOMING: <iq xmlns="jabber:client" from="galadraek@jabber.org/agsXMPP" type="result" id="agsXMPP_8" to="galadraek@jabber.org/agsXMPP" />

2007/11/27 06:11:30 [JabberSession.ConnectionIq] IQ


Do I have a bad version of agsxmpp or something?? i'm getting Null value errors when i'm doing basic removing of a uid!
Avatar
draekz #8
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Dear god. agsxmpp wraps everything in the "ConnectionError" event for exceptions and stops the app from terminating with a stack trace if something happens within my own code.

I did find a NULL reference within my code, but it wasn't happening at the proper time, and was giving the "ConnectionError" Event! This is what was screwing me up.

I didn't realize that agsxmpp wrapped everything in try{}catch blocks even for my own code.

Thanks, i got things under control....

sigh sorry about that
Avatar
Jabberer #9
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Quote by draekz:
Dear god. agsxmpp wraps everything in the "ConnectionError" event for exceptions and stops the app from terminating with a stack trace if something happens within my own code.

yes, this is because the most people don't write their own exception handlers.
If you don't handle a exception in your code it always goes to the next higher instance which is agsXMPP. So many unhandled exceptions of agsXMPP objects would cause a disconnect without this exception handling.

If you browse the forums you will find lots of questions like "Why does agsXMPP disconnect me" which are gone after we added this exception handling.

But this should only affect you codeblocks with agsXMPP objects. Other code and exceptions should still terminate your app terminate with a stacktrace.
Software Developer
AG-Software
Avatar
draekz #10
Member since Nov 2007 · 17 posts
Group memberships: Members
Show profile · Link to this post
Right, and that knowledge has made using agsXMPP possible. Without it I'm sure I would have still been scratching my head :P
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS