From ac89b47eeb3c843b2686739cc4ca75e7b14b7bbb Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Fri, 27 Nov 2015 11:02:32 +0100 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/transport/HttpAuthMethod.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 3594ea91b..998f28001 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 @@ 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;