powered by Jive Software

Login Exception catching

I’‘m making a client using Smack to login to GoogleTalk, and everything is going fine, but I want to tell the user that they’‘ve failed to log in. here’'s my login code:

private boolean connect(String name, String psw)

{

try

{

connection = new GoogleTalkConnection();

connection.login(name,psw);

}

catch(XMPPException xmppe)

{

System.err.println("#–# Could not login");

return false;

}

 hub = connection.createChat("gtalkmuc@gmail.com");

hub.addMessageListener(this);

sendToHub("#GoogleMUCC");

return true;

}[/code]

Thus, when failing to login for any reason, the console should print “#-# Could not login”… but the error that is returned is "java.lang.Exception: TLS negotiation has failed

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:31

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:42)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:62)"

How can I get the login to accept my exception catch block?

Looks like it’'s throwing a generic Exception for TLS negotiation problems. You should add another catch for generic Exceptions.

Adam

Hey Brian,

Today I checked in a fix for SMACK-89. Let me know if the problem still persists in the next nightly build.

Regards,

– Gato