ConnectionListener listener = new ConnectionListener() {
public void connectionClosed() {
JOptionPane.showMessageDialog(null…);
}
public void connectionClosedOnError(Exception e) {
JOptionPane.showMessageDialog(null…);
}
};
now i wanted to cause an error in order to check my program.
i enered a my user name (jid) but different password (in the registry window)…
in the debug window… i recieved 2 errors:
401… (un authorized) which i understand…
409…
now when i catch the exceptions (the errors)… i can only catch one error…
but something go nuts there…
because
when i catch the 401 error and i cant register this new user i close the connection and then the listener of the connection display me the right message.
but !! immidiattly after i see again the message when the connection is closed.
i check my code perfectly line after line… and i got to an conclusion that the reason that the connection is closed twice is that i got 2 errors… and maybe something is bugged here…
and thats when i entered the username but differnet password, i close the connection and it closes me twice!!!..
i know for sure it aint problem in my code because… in every time i close the connection i print on the screen the number of the command’’ connection.close()’’
so i only see one time when it get to that command.
but it closes the connection twice…
althogh there is just one number rinted on the screen…
but when i delete that (the same) connection.close
nothing is hapaning (of course)…
so i think that when these errors(2 errors) happen
there is some problem with using connection.close
because in the other places the close of connection works fine…