Fix NPE in Testcases where 'createOfflineConnections() == true'. The change 13453 created the username and password array, which needs to be initilized even if the connection and the login is done manually

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13460 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-02-07 19:10:32 +00:00 committed by flow
parent b907d606d9
commit c309e27853
1 changed files with 11 additions and 8 deletions

View File

@ -242,6 +242,15 @@ public abstract class SmackTestCase extends TestCase {
connections[i] = createConnection();
if (!createOfflineConnections())
connections[i].connect();
String currentPassword = usernamePrefix + (i+1);
String currentUser = currentPassword;
if (passwordPrefix != null)
currentPassword = (samePassword ? passwordPrefix : passwordPrefix + (i+1));
usernames[i] = currentUser;
passwords[i] = currentPassword;
}
// Use the host name that the server reports. This is a good idea in most
// cases, but could fail if the user set a hostname in their XMPP server
@ -251,14 +260,8 @@ public abstract class SmackTestCase extends TestCase {
if (!createOfflineConnections()) {
for (int i = 0; i < getMaxConnections(); i++) {
String currentPassword = usernamePrefix + (i+1);
String currentUser = currentPassword;
if (passwordPrefix != null)
currentPassword = (samePassword ? passwordPrefix : passwordPrefix + (i+1));
usernames[i] = currentUser;
passwords[i] = currentPassword;
String currentUser = usernames[i];
String currentPassword = passwords[i];
try {
getConnection(i).login(currentUser, currentPassword, "Smack");