diff --git a/src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java b/src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java index 5f4ca8c214..34a8b41ae5 100644 --- a/src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java +++ b/src/main/java/org/jenkinsci/plugins/gitclient/JGitAPIImpl.java @@ -125,7 +125,6 @@ import org.eclipse.jgit.submodule.SubmoduleWalk; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.FetchConnection; -import org.eclipse.jgit.transport.HttpTransport; import org.eclipse.jgit.transport.PushResult; import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RemoteConfig; @@ -993,9 +992,8 @@ private TransportConfigCallback getTransportConfigCallback() { if (transport instanceof SshTransport sshTransport) { sshTransport.setSshSessionFactory(buildSshdSessionFactory(this.hostKeyVerifierFactory)); } - if (transport instanceof HttpTransport) { - ((TransportHttp) transport) - .setHttpConnectionFactory(new PreemptiveAuthHttpClientConnectionFactory(getProvider())); + if (transport instanceof TransportHttp transportHttp) { + transportHttp.setHttpConnectionFactory(new PreemptiveAuthHttpClientConnectionFactory(getProvider())); } }; } @@ -1004,8 +1002,8 @@ private void decorateTransport(Transport tn) { if (tn instanceof SshTransport transport) { transport.setSshSessionFactory(buildSshdSessionFactory(getHostKeyFactory())); } - if (tn instanceof HttpTransport) { - ((TransportHttp) tn).setHttpConnectionFactory(new PreemptiveAuthHttpClientConnectionFactory(getProvider())); + if (tn instanceof TransportHttp transportHttp) { + transportHttp.setHttpConnectionFactory(new PreemptiveAuthHttpClientConnectionFactory(getProvider())); } }