|
@@ -51,6 +51,7 @@ import java.io.IOException;
|
51
|
51
|
import java.net.URI;
|
52
|
52
|
import java.util.Collection;
|
53
|
53
|
import java.util.Collections;
|
|
54
|
+import java.util.Date;
|
54
|
55
|
import java.util.HashMap;
|
55
|
56
|
import java.util.List;
|
56
|
57
|
import java.util.Map;
|
|
@@ -437,6 +438,12 @@ public class XmppParser extends BaseSocketAwareParser {
|
437
|
438
|
/** {@inheritDoc} */
|
438
|
439
|
@Override
|
439
|
440
|
public void run() {
|
|
441
|
+ if (getURI().getUserInfo() == null || !getURI().getUserInfo().contains(":")) {
|
|
442
|
+ getCallback(ConnectErrorListener.class).onConnectError(this,
|
|
443
|
+ new Date(), new ParserError(ParserError.ERROR_USER,
|
|
444
|
+ "User name and password must be specified in URI", ""));
|
|
445
|
+ return;
|
|
446
|
+ }
|
440
|
447
|
final String[] userInfoParts = getURI().getUserInfo().split(":", 2);
|
441
|
448
|
final String[] userParts = userInfoParts[0].split("@", 2);
|
442
|
449
|
|
|
@@ -458,7 +465,14 @@ public class XmppParser extends BaseSocketAwareParser {
|
458
|
465
|
connection.addPacketWriterListener(new PacketListenerImpl(DataOutListener.class), new AcceptAllPacketFilter());
|
459
|
466
|
connection.getChatManager().addChatListener(new ChatManagerListenerImpl());
|
460
|
467
|
|
461
|
|
- connection.login(userInfoParts[0], userInfoParts[1], "DMDirc.");
|
|
468
|
+ try {
|
|
469
|
+ connection.login(userInfoParts[0], userInfoParts[1], "DMDirc.");
|
|
470
|
+ } catch (XMPPException ex) {
|
|
471
|
+ getCallback(ConnectErrorListener.class).onConnectError(this,
|
|
472
|
+ new Date(), new ParserError(ParserError.ERROR_USER,
|
|
473
|
+ ex.getMessage(), ""));
|
|
474
|
+ return;
|
|
475
|
+ }
|
462
|
476
|
|
463
|
477
|
connection.sendPacket(new Presence(Presence.Type.available, null, priority, Presence.Mode.available));
|
464
|
478
|
connection.getRoster().addRosterListener(new RosterListenerImpl());
|