diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2015-11-27 11:02:32 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2015-12-07 16:05:19 +0100 |
commit | ac89b47eeb3c843b2686739cc4ca75e7b14b7bbb (patch) | |
tree | cad79fb13492509aa12591b8b43c564c7ef6cc07 | |
parent | 3d8e6b1e16092701c31463092e945b8f00886bb7 (diff) | |
download | jgit-ac89b47eeb3c843b2686739cc4ca75e7b14b7bbb.tar.gz jgit-ac89b47eeb3c843b2686739cc4ca75e7b14b7bbb.zip |
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>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index 3594ea91b4..998f280014 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -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; |