If the git server requires authentication and no CredentialsProvider is registered TransportHttp.connect() would throw an NPE since it tries to reset the credentials provider. Instead throw a TransportException explaining the problem. Change-Id: Ib274e7d9c43bba301089975423de6a05ca5169f6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>tags/v3.5.0.201409071800-rc1
@@ -339,6 +339,7 @@ needsWorkdir=Needs workdir | |||
newlineInQuotesNotAllowed=Newline in quotes not allowed | |||
noApplyInDelete=No apply in delete | |||
noClosingBracket=No closing {0} found for {1} at index {2}. | |||
noCredentialsProvider=Authentication is required but no CredentialsProvider has been registered | |||
noHEADExistsAndNoExplicitStartingRevisionWasSpecified=No HEAD exists and no explicit starting revision was specified | |||
noHMACsupport=No {0} support: {1} | |||
noMergeBase=No merge base could be determined. Reason={0}. {1} |
@@ -398,6 +398,7 @@ public class JGitText extends TranslationBundle { | |||
/***/ public String newlineInQuotesNotAllowed; | |||
/***/ public String noApplyInDelete; | |||
/***/ public String noClosingBracket; | |||
/***/ public String noCredentialsProvider; | |||
/***/ public String noHEADExistsAndNoExplicitStartingRevisionWasSpecified; | |||
/***/ public String noHMACsupport; | |||
/***/ public String noMergeBase; |
@@ -497,6 +497,9 @@ public class TransportHttp extends HttpTransport implements WalkTransport, | |||
throw new TransportException(uri, MessageFormat.format( | |||
JGitText.get().authenticationNotSupported, uri)); | |||
CredentialsProvider credentialsProvider = getCredentialsProvider(); | |||
if (credentialsProvider == null) | |||
throw new TransportException(uri, | |||
JGitText.get().noCredentialsProvider); | |||
if (authAttempts > 1) | |||
credentialsProvider.reset(uri); | |||
if (3 < authAttempts |