Menu

#39 Couldn't get result from User Directory

jabberbeans_backend
open
nobody
None
5
2013-02-19
2001-06-05
Anonymous
No

I'm trying to do a query on user directory using
IQSearchRequestBuilder, I'm running jabber in debug
mode and can see the result in debug but the packet
didn't arrive to the packet listener. Do you have any
glue about this problem?
Thanks.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    any IQSearch requests that are sent don't get any response,
    and further, no more responses are ever received, though
    some packets can be sent. Did the listening thread die or
    something?

     
  • Nobody/Anonymous

    Logged In: NO

    All the IQSearch requests don't get nay response, I think
    the listener thread is not died because I still receive
    response for other requests that is not IQSearch.

     
  • Greg Schueler

    Greg Schueler - 2001-07-27

    Logged In: YES
    user_id=282989

    I found the bug!
    in the file org/jabber/jabberbeans/sax/SubHandler.java
    the method "graftSubHandler" grafts the new subhandler in
    place of the current one, but the new subhandler's parent is
    still the current one! The correct thing should be to set
    the parent of the new subhandler to be the parent of the
    current subhandler (is this correct mass?). If so (and it
    seems to work for fine for me on 0.9.0pre4) you just need
    to add 1 line to SubHandler.java.

    change the "graftSubHandler" method to this:

    protected final void graftSubHandler(SubHandler subHandler,
    String name,
    AttributeList attributes)
    throws SAXException
    {
    setChildSubHandler(subHandler,null,null);
    subHandler.setParent(this.parent); //<--new line
    subHandler.startElement(name,attributes);
    }

     
  • Greg Schueler

    Greg Schueler - 2001-07-29

    Logged In: YES
    user_id=282989

    alas, more bugs. After the fix I posted below, I found that
    searches that had no results (i.e. an empty <query> element)
    caused the same input stream hang that the original bug was
    doing...This is because the IQSearchHandler always expects
    that the subhandler it grafts in the handleStartElement
    method will return a valid Extension object...not so if
    there is no start element in the first place. Also, since
    the IQSearchHandler is re-used (apparently) by the handler
    factory, its subCount variable was out of whack with
    reality, since it is incremented when IQSearchHandler is
    made the new subhandler, and never decremented because it
    grafts a different subhandler in its place.

    The fix is twofold, fist add another line to graftSubHandler
    in SubHandler.java:

    protected final void graftSubHandler(SubHandler
    subHandler,
    String name,
    AttributeList attributes)
    throws SAXException
    {
    subCount=0; //<--add this line also
    setChildSubHandler(subHandler,null,null);
    subHandler.setParent(this.parent);
    subHandler.startElement(name,attributes);
    }

    and secondly, modify
    org/jabber/jabberbeans/sax/Extension/IQSearchHandler.java
    change the "stopHandler" method to the following:
    protected Object stopHandler(String name)
    throws SAXException
    {

    if(extension==null)
    return new IQSearchResultBuilder().build();
    else
    return extension;
    }

     

Log in to post a comment.

MongoDB Logo MongoDB