Browse Source

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>
tags/v4.2.0.201601211800-r
Matthias Sohn 8 years ago
parent
commit
ac89b47eeb

+ 2
- 1
org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java View File

@@ -219,7 +219,8 @@ abstract class HttpAuthMethod {
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;

Loading…
Cancel
Save