Skip to content

Commit

Permalink
PAYARA-2465 fixes #2328 added in removed public constructor (#2357)
Browse files Browse the repository at this point in the history
  • Loading branch information
smillidge authored and arjantijms committed Feb 3, 2018
1 parent 9401ee2 commit 5dfe956
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2018] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.admin.util;

import com.sun.enterprise.util.StringUtils;

/**
* A class that holds the user and password for the connection to the server.
* Used by the HttpConnectorAddress class.
Expand All @@ -50,9 +49,18 @@
public final class AuthenticationInfo {
private final String user;
private final char[] password;

/**
*
* @param user the user name for the connection
* @param password the clear text password for the connection
*/
public AuthenticationInfo(String user, String password) {
this(user,password.toCharArray());
}

/**
* The only way to construct the instances of this class.
*
* @param user the user name for the connection
* @param password the clear text password for the connection
*/
Expand All @@ -73,8 +81,8 @@ public String getUser() {
* Returns the password in clear text.
* @return String
*/
public char[] getPassword() {
return password;
public String getPassword() {
return new String(password);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* holder.
*/

// Portions Copyright [2016-2017] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2018] [Payara Foundation and/or its affiliates]

package com.sun.enterprise.admin.util;

Expand Down Expand Up @@ -305,7 +305,7 @@ private String getUser() {
}

private char[] getPassword() {
return authInfo != null ? authInfo.getPassword() : "".toCharArray();
return authInfo != null ? authInfo.getPassword().toCharArray() : "".toCharArray();
}

private URLConnection openConnection(URL url) throws IOException {
Expand Down

0 comments on commit 5dfe956

Please sign in to comment.