You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2015/06/12 12:25:39 UTC

[2/3] git commit: updated refs/heads/master to 4900d15

Fixed CLOUDSTACK-8551 findbugs issue in LdapImportUsersCmd.java

DM_DEFAULT_ENCODING issue. Used UTF-8


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d504305a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d504305a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d504305a

Branch: refs/heads/master
Commit: d504305a982c493a256ac463937dc1c3139ac30a
Parents: d46b658
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Thu Jun 11 17:07:03 2015 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Thu Jun 11 17:07:03 2015 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/command/LdapImportUsersCmd.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d504305a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
index b6c8656..63549f1 100644
--- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
+++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LdapImportUsersCmd.java
@@ -16,6 +16,7 @@
 // under the License.
 package org.apache.cloudstack.api.command;
 
+import java.io.UnsupportedEncodingException;
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.util.ArrayList;
@@ -228,9 +229,8 @@ public class LdapImportUsersCmd extends BaseListCmd {
             final SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG");
             final byte bytes[] = new byte[20];
             randomGen.nextBytes(bytes);
-            String encodedPassword = new String(Base64.encode(bytes));
-            return encodedPassword;
-        } catch (final NoSuchAlgorithmException e) {
+            return new String(Base64.encode(bytes), "UTF-8");
+        } catch ( NoSuchAlgorithmException | UnsupportedEncodingException e) {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate random password");
         }
     }