XmppEndPoint - setting login to false when creating an account results in no 
action
-----------------------------------------------------------------------------------

                 Key: CAMEL-3237
                 URL: https://issues.apache.org/activemq/browse/CAMEL-3237
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-xmpp
    Affects Versions: 2.4.0
            Reporter: Mário Homem


XmppEndPoint myXmppEndPoint = new XmppEndPoint();
(...)
myXmppEndPoint.setCreateAccount(true);
myXmppEndPoint .setLogin(false);
(...)

This will result in "no action" in xmpp server, if setLogin true the account is 
created and the user stays online.

I believe it's because of the logic used in createConnection() method of 
XmppEndPoint that could be changed to:

if (!connection.isAuthenticated()) {
            if (user != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging in to XMPP as user: " + user + " on 
connection: " + getConnectionMessage(connection));
                }
                if (password == null) {
                    LOG.warn("No password configured for user: " + user + " on 
connection: " + getConnectionMessage(connection));
                }

                if (createAccount) {
                    AccountManager accountManager = new 
AccountManager(connection);
                    accountManager.createAccount(user, password);
                }
                if(login){
                        if (resource != null) {
                                connection.login(user, password, resource);
                        } else {
                                connection.login(user, password);
                        }
                }
            } else {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Logging in anonymously to XMPP on connection: "  
+ getConnectionMessage(connection));
                }
                connection.loginAnonymously();
            }




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to