Skip to content

Commit 55ec8f3

Browse files
Daan Hooglandchaturvedia
authored andcommitted
findbugs replaced byte[].toString() with Arrays.toString(byte[])(cherry picked from commit ce7c6d2)
Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
1 parent 602faec commit 55ec8f3

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapCreateAccountCmd.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.security.NoSuchAlgorithmException;
2020
import java.security.SecureRandom;
21+
import java.util.Arrays;
2122
import java.util.Map;
2223

2324
import javax.inject.Inject;
@@ -125,7 +126,7 @@ private String generatePassword() throws ServerApiException {
125126
final SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG");
126127
final byte bytes[] = new byte[20];
127128
randomGen.nextBytes(bytes);
128-
return Base64.encode(bytes).toString();
129+
return Arrays.toString(Base64.encode(bytes));
129130
} catch (final NoSuchAlgorithmException e) {
130131
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
131132
"Failed to generate random password");

‎plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,19 @@
1919
import java.security.NoSuchAlgorithmException;
2020
import java.security.SecureRandom;
2121
import java.util.ArrayList;
22+
import java.util.Arrays;
2223
import java.util.List;
2324
import java.util.Map;
2425
import java.util.UUID;
2526

2627
import javax.inject.Inject;
2728

28-
import org.apache.cloudstack.api.*;
29+
import org.apache.cloudstack.api.APICommand;
30+
import org.apache.cloudstack.api.ApiConstants;
31+
import org.apache.cloudstack.api.ApiErrorCode;
32+
import org.apache.cloudstack.api.BaseListCmd;
33+
import org.apache.cloudstack.api.Parameter;
34+
import org.apache.cloudstack.api.ServerApiException;
2935
import org.apache.cloudstack.api.response.DomainResponse;
3036
import org.apache.cloudstack.api.response.LdapUserResponse;
3137
import org.apache.cloudstack.api.response.ListResponse;
@@ -37,7 +43,12 @@
3743
import org.bouncycastle.util.encoders.Base64;
3844

3945
import com.cloud.domain.Domain;
40-
import com.cloud.exception.*;
46+
import com.cloud.exception.ConcurrentOperationException;
47+
import com.cloud.exception.InsufficientCapacityException;
48+
import com.cloud.exception.InvalidParameterValueException;
49+
import com.cloud.exception.NetworkRuleConflictException;
50+
import com.cloud.exception.ResourceAllocationException;
51+
import com.cloud.exception.ResourceUnavailableException;
4152
import com.cloud.user.AccountService;
4253
import com.cloud.user.DomainService;
4354

@@ -175,7 +186,7 @@ private String generatePassword() throws ServerApiException {
175186
final SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG");
176187
final byte bytes[] = new byte[20];
177188
randomGen.nextBytes(bytes);
178-
return Base64.encode(bytes).toString();
189+
return Arrays.toString(Base64.encode(bytes));
179190
} catch (final NoSuchAlgorithmException e) {
180191
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate random password");
181192
}

0 commit comments

Comments
 (0)