ソースを参照

Prevent NPE if no CredentialsProvider is registered

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
Matthias Sohn 9年前
コミット
3885ce2a94

+ 1
- 0
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties ファイルの表示

@@ -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}

+ 1
- 0
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java ファイルの表示

@@ -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;

+ 3
- 0
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java ファイルの表示

@@ -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

読み込み中…
キャンセル
保存