Program: 1628
Project: 1628
Buggy source:
public SessionImpl(final Connection connection,final SASLManager saslManager,final ResourceBindingManager bindingManager,final IMSessionManager iMSessionManager){
  this.connection=connection;
  iqManager=new IQManager();
  queuedStanzas=new ArrayList<IPacket>();
  connection.onStanzaReceived(new Listener<IPacket>(){
    public void onEvent(    final IPacket stanza){
      final String name=stanza.getName();
      if (name.equals("String_Node_Str")) {
        fireMessage(new Message(stanza));
      }
 else       if (name.equals("String_Node_Str")) {
        firePresence(new Presence(stanza));
      }
 else       if (name.equals("String_Node_Str")) {
        final String type=stanza.getAttribute("String_Node_Str");
        if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
          fireIQ(new IQ(stanza));
        }
 else {
          iqManager.handle(stanza);
        }
      }
 else       if (transaction != null && "String_Node_Str".equals(name) && stanza.hasChild("String_Node_Str")) {
        saslManager.sendAuthorizationRequest(transaction);
        transaction=null;
      }
    }
  }
);
  connection.onError(new Listener<String>(){
    public void onEvent(    final String msg){
      GWT.log("String_Node_Str" + msg,null);
      setState(State.error);
    }
  }
);
  connection.onDisconnected(new Listener<String>(){
    public void onEvent(    final String parameter){
      setState(State.disconnected);
    }
  }
);
  saslManager.onAuthorized(new Listener<AuthorizationTransaction>(){
    public void onEvent(    final AuthorizationTransaction ticket){
      if (ticket.getState() == AuthorizationTransaction.State.succeed) {
        setState(Session.State.authorized);
        connection.restartStream();
        bindingManager.bindResource(ticket.getXmppUri().getResource());
      }
 else {
        setState(Session.State.notAuthorized);
        disconnect();
      }
    }
  }
);
  bindingManager.onBinded(new Listener<XmppURI>(){
    public void onEvent(    final XmppURI uri){
      iMSessionManager.requestSession(uri);
    }
  }
);
  iMSessionManager.onSessionCreated(new Listener<XmppURI>(){
    public void onEvent(    final XmppURI uri){
      setLoggedIn(uri);
    }
  }
);
}

Fixed version (ground truth):
public SessionImpl(final Connection connection,final SASLManager saslManager,final ResourceBindingManager bindingManager,final IMSessionManager iMSessionManager){
  this.connection=connection;
  iqManager=new IQManager();
  queuedStanzas=new ArrayList<IPacket>();
  connection.onStanzaReceived(new Listener<IPacket>(){
    public void onEvent(    final IPacket stanza){
      final String name=stanza.getName();
      if (name.equals("String_Node_Str")) {
        fireMessage(new Message(stanza));
      }
 else       if (name.equals("String_Node_Str")) {
        firePresence(new Presence(stanza));
      }
 else       if (name.equals("String_Node_Str")) {
        final String type=stanza.getAttribute("String_Node_Str");
        if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
          fireIQ(new IQ(stanza));
        }
 else {
          iqManager.handle(stanza);
        }
      }
 else       if (transaction != null && "String_Node_Str".equals(name) && stanza.hasChild("String_Node_Str")) {
        saslManager.sendAuthorizationRequest(transaction);
        transaction=null;
      }
    }
  }
);
  connection.onError(new Listener<String>(){
    public void onEvent(    final String msg){
      GWT.log("String_Node_Str" + msg,null);
      setState(State.error);
    }
  }
);
  connection.onDisconnected(new Listener<String>(){
    public void onEvent(    final String parameter){
      setState(State.disconnected);
    }
  }
);
  saslManager.onAuthorized(new Listener<AuthorizationTransaction>(){
    public void onEvent(    final AuthorizationTransaction ticket){
      if (ticket.getState() == AuthorizationTransaction.State.succeed) {
        setState(Session.State.authorized);
        connection.restartStream();
        String resource=ticket.getXmppUri().getResource();
        if (resource == null) {
          resource="String_Node_Str" + System.currentTimeMillis();
        }
        bindingManager.bindResource(resource);
      }
 else {
        setState(Session.State.notAuthorized);
        disconnect();
      }
    }
  }
);
  bindingManager.onBinded(new Listener<XmppURI>(){
    public void onEvent(    final XmppURI uri){
      iMSessionManager.requestSession(uri);
    }
  }
);
  iMSessionManager.onSessionCreated(new Listener<XmppURI>(){
    public void onEvent(    final XmppURI uri){
      setLoggedIn(uri);
    }
  }
);
}