Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Lamy <[email protected]>
  • Loading branch information
olamy committed Apr 26, 2024
1 parent 7049e95 commit 45e8baf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<org.jenkinsci.plugins.gitclient.verifier.SshHostKeyVerificationStrategy.jgit_known_hosts_file>${project.build.directory}/ssh/know_hosts</org.jenkinsci.plugins.gitclient.verifier.SshHostKeyVerificationStrategy.jgit_known_hosts_file>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private HttpClient getClient() {
new HttpHost(serviceUri.getHost(), serviceUri.getPort(), serviceUri.getScheme());

CredentialsProvider clientCredentialsProvider = new SystemDefaultCredentialsProvider();
if (credentialsProvider.supports(u, p)) {
if (credentialsProvider != null && credentialsProvider.supports(u, p)) {
URIish uri = serviceUri;
while (uri != null) {
if (credentialsProvider.get(uri, u, p)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public HttpConnection create(final URL url, final Proxy proxy) throws IOExceptio
}

protected HttpConnection innerCreate(final URL url, final Proxy proxy) {
CredentialsProvider credentialsProvider = JGitAPIImpl.getProvider();
if (credentialsProvider == null) {
throw new IllegalStateException(NEED_CREDENTIALS_PROVIDER);
}

return new PreemptiveAuthHttpClientConnection(JGitAPIImpl.getProvider(), url.toString(), proxy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public abstract class SshHostKeyVerificationStrategy<T extends HostKeyVerifierFa
extends AbstractDescribableImpl<SshHostKeyVerificationStrategy<T>> implements ExtensionPoint {

public static final String KNOWN_HOSTS_DEFAULT =
Paths.get("target", ".ssh", "known_hosts").toString();
Paths.get(System.getProperty("user.home"), ".ssh", "known_hosts").toString();
private static final String JGIT_KNOWN_HOSTS_PROPERTY =
SshHostKeyVerificationStrategy.class.getName() + ".jgit_known_hosts_file";
private static final String JGIT_KNOWN_HOSTS_FILE_PATH =
Expand Down

0 comments on commit 45e8baf

Please sign in to comment.