Fix NPE in HttpAuthMethod

If the password char array is null constructing a new String from this
array fails with a NPE. Add a null check to fix this.

Change-Id: Ifae6eecca38d5f114861f44658a32521e6e96866
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2015-11-27 11:02:32 +01:00
parent 3d8e6b1e16
commit ac89b47eeb
1 changed files with 2 additions and 1 deletions

View File

@ -219,7 +219,8 @@ boolean authorize(URIish uri, CredentialsProvider credentialsProvider) {
if (credentialsProvider.supports(u, p)
&& credentialsProvider.get(uri, u, p)) {
username = u.getValue();
password = new String(p.getValue());
char[] v = p.getValue();
password = (v == null) ? null : new String(p.getValue());
p.clear();
} else
return false;