1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 14:02:06 +01:00

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

View file

@ -242,6 +242,15 @@ public abstract class SmackTestCase extends TestCase {
connections[i] = createConnection(); connections[i] = createConnection();
if (!createOfflineConnections()) if (!createOfflineConnections())
connections[i].connect(); 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 // 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 // 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()) { if (!createOfflineConnections()) {
for (int i = 0; i < getMaxConnections(); i++) { for (int i = 0; i < getMaxConnections(); i++) {
String currentPassword = usernamePrefix + (i+1); String currentUser = usernames[i];
String currentUser = currentPassword; String currentPassword = passwords[i];
if (passwordPrefix != null)
currentPassword = (samePassword ? passwordPrefix : passwordPrefix + (i+1));
usernames[i] = currentUser;
passwords[i] = currentPassword;
try { try {
getConnection(i).login(currentUser, currentPassword, "Smack"); getConnection(i).login(currentUser, currentPassword, "Smack");