Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[egit-dev] Code yielding exception under eclipse, but not if executed "barely"

Hi,

because of the missing Credentials support in the Git push API, we have built our own push command, based on the one EGit uses.

Its core looks like that (almost a copy of EGit):

            PushResult pr = null;
            URIish uri = remoteRepo;
            Transport transport = null;
            try {
                transport = Transport.open(localDb, uri);
                if (credentialsProvider != null)
                    transport.setCredentialsProvider(credentialsProvider);
                transport.setTimeout(this.timeout);

                if (rc != null)
                    transport.applyConfig(rc);
                transport.setDryRun(dryRun);
               pr = transport.push(gitSubMonitor,refUpdates);
                this.pushResult = pr;
            } catch (final NoRemoteRepositoryException e) {
                throw new UnexpectedGitException(e);
            } catch (final TransportException e) {
                throw new UnexpectedGitException(e);
            } catch (final NotSupportedException e) {
                throw new UnexpectedGitException(e);
            } finally {
                if (transport != null) {
                    transport.close();
                }

            }


(all variables used in this code are initialized fine, that is not the problem)

When I write a test that calls this push operation to push a test branch to github, everything works. However, when I run EXACTLY THE SAME test push code from a test eclipse instance I get the following exception:

Caused by: org.eclipse.jgit.errors.TransportException: https://github.com/gexicide/testor.git: cannot open git-receive-pack at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:393) at org.eclipse.jgit.transport.TransportHttp.openPush(TransportHttp.java:292)
    at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:130)
    at org.eclipse.jgit.transport.Transport.push(Transport.java:961)
at org.unicase.changetracking.git.GitPushOperation.run(GitPushOperation.java:174)
    ... 14 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
    at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:167)
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:356)
    ... 18 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(Unknown Source) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 33 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 39 more


Can someone tell me what it means and how to avoid it? And especially, why it appears in the test eclipse but not in a bare test (where the test code is just called from a main method). It seems that egit (or another plugin) changes something in the configuration of jgit such that the code semantics change and the exception occurs.

Thank you in advance for your help.

Best regards
Jan Finis


Back to the top