List of usage examples for org.eclipse.jgit.errors TransportException TransportException
public TransportException(final URIish uri, final String s, final Throwable cause)
From source file:it.com.atlassian.labs.speakeasy.util.jgit.FixedTransportHttp.java
License:Eclipse Distribution License
@Override public FetchConnection openFetch() throws TransportException, NotSupportedException { final String service = SVC_UPLOAD_PACK; try {/* w w w . j av a2s . c o m*/ final HttpURLConnection c = connect(service); final InputStream in = openInputStream(c); try { if (isSmartHttp(c, service)) { readSmartHeaders(in, service); return new SmartHttpFetchConnection(in); } else { // Assume this server doesn't support smart HTTP fetch // and fall back on dumb object walking. // return newDumbConnection(in); } } finally { in.close(); } } catch (NotSupportedException err) { throw err; } catch (TransportException err) { throw err; } catch (IOException err) { throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err); } }
From source file:it.com.atlassian.labs.speakeasy.util.jgit.FixedTransportHttp.java
License:Eclipse Distribution License
@Override public PushConnection openPush() throws NotSupportedException, TransportException { final String service = SVC_RECEIVE_PACK; try {/* w ww.j a v a2 s .com*/ final HttpURLConnection c = connect(service); final InputStream in = openInputStream(c); try { if (isSmartHttp(c, service)) { readSmartHeaders(in, service); return new SmartHttpPushConnection(in); } else if (!useSmartHttp) { final String msg = JGitText.get().smartHTTPPushDisabled; throw new NotSupportedException(msg); } else { final String msg = JGitText.get().remoteDoesNotSupportSmartHTTPPush; throw new NotSupportedException(msg); } } finally { in.close(); } } catch (NotSupportedException err) { throw err; } catch (TransportException err) { throw err; } catch (IOException err) { throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err); } }
From source file:it.com.atlassian.labs.speakeasy.util.jgit.WalkRemoteObjectDatabase.java
License:Eclipse Distribution License
/** * Read a standard Git packed-refs file to discover known references. * * @param avail//from w w w . ja v a 2s. c om * return collection of references. Any existing entries will be * replaced if they are found in the packed-refs file. * @throws TransportException * an error occurred reading from the packed refs file. */ protected void readPackedRefs(final Map<String, Ref> avail) throws TransportException { try { final BufferedReader br = openReader(ROOT_DIR + Constants.PACKED_REFS); try { readPackedRefsImpl(avail, br); } finally { br.close(); } } catch (FileNotFoundException notPacked) { // Perhaps it wasn't worthwhile, or is just an older repository. } catch (IOException e) { throw new TransportException(getURI(), JGitText.get().errorInPackedRefs, e); } }
From source file:org.eclipse.orion.server.git.GitSshSessionFactory.java
License:Open Source License
@Override public RemoteSession getSession(URIish uri, CredentialsProvider credentialsProvider, FS fs, int tms) throws TransportException { int port = uri.getPort(); String user = uri.getUser();// w w w. j a v a 2 s.c o m String pass = uri.getPass(); if (credentialsProvider instanceof GitCredentialsProvider) { if (port <= 0) port = SSH_PORT; GitCredentialsProvider cp = (GitCredentialsProvider) credentialsProvider; if (user == null) { CredentialItem.Username u = new CredentialItem.Username(); if (cp.supports(u) && cp.get(cp.getUri(), u)) { user = u.getValue(); } } if (pass == null) { CredentialItem.Password p = new CredentialItem.Password(); if (cp.supports(p) && cp.get(cp.getUri(), p)) { pass = new String(p.getValue()); } } try { final SessionHandler session = new SessionHandler(user, uri.getHost(), port, cp.getKnownHosts(), cp.getPrivateKey(), cp.getPublicKey(), cp.getPassphrase()); if (pass != null) session.setPassword(pass); if (credentialsProvider != null && !credentialsProvider.isInteractive()) { session.setUserInfo(new CredentialsProviderUserInfo(session.getSession(), credentialsProvider)); } session.connect(tms); return new JschSession(session.getSession(), uri); } catch (JSchException e) { throw new TransportException(uri, e.getMessage(), e); } } return null; }