IOException wrongContentType(String expType, String actType) { final String why = MessageFormat.format(JGitText.get().expectedReceivedContentType, expType, actType); return new TransportException(uri, why); }
/** * Constructs an TransportException with the specified detail message. * * @param s * message * @param cause * root cause exception */ public TransportException(String s, Throwable cause) { super(s); initCause(cause); } }
final TransportException te; te = new TransportException(MessageFormat.format(JGitText.get().cannotGet, id.name())); if (failures != null && !failures.isEmpty()) { if (failures.size() == 1) te.initCause(failures.get(0)); else te.initCause(new CompoundException(failures));
} catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e);
} catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); } finally { transport.close(); } catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); } catch (NotSupportedException e) { throw new JGitInternalException(
/** * Helper method for ensuring one-operation per connection. Check whether * operation was already marked as started, and mark it as started. * * @throws org.eclipse.jgit.errors.TransportException * if operation was already marked as started. */ protected void markStartedOperation() throws TransportException { if (startedOperation) throw new TransportException( JGitText.get().onlyOneOperationCallPerConnectionIsSupported); startedOperation = true; }
} catch (TransportException e) { throw new org.eclipse.jgit.api.errors.TransportException( e.getMessage(), e); } catch (URISyntaxException e) { throw new InvalidRemoteException(MessageFormat.format(
/** * Constructs an TransportException with the specified detail message. * * @param s * message * @param cause * root cause exception */ public TransportException(final String s, final Throwable cause) { super(s); initCause(cause); } }
void checkExecFailure(int status, String exe, String why) throws TransportException { if (status == 127) { IOException cause = null; if (why != null && why.length() > 0) cause = new IOException(why); throw new TransportException(uri, MessageFormat.format( JGitText.get().cannotExecute, commandFor(exe)), cause); } }
/** * Constructs an TransportException with the specified detail message. * * @param s * message * @param cause * root cause exception */ public TransportException(String s, Throwable cause) { super(s); initCause(cause); } }
/** {@inheritDoc} */ @Override public FetchConnection openFetch() throws NotSupportedException, TransportException { final InputStream src; try { src = new FileInputStream(bundle); } catch (FileNotFoundException err) { throw new TransportException(uri, JGitText.get().notFound); } return new BundleFetchConnection(this, src); }
private int readSignature() throws IOException { final String rev = readLine(new byte[1024]); if (TransportBundle.V2_BUNDLE_SIGNATURE.equals(rev)) return 2; throw new TransportException(transport.uri, JGitText.get().notABundle); }
void execute(ProgressMonitor monitor, FetchResult result) throws NotSupportedException, TransportException { askFor.clear(); localUpdates.clear(); fetchHeadUpdates.clear(); packLocks.clear(); localRefs = null; try { executeImp(monitor, result); } finally { try { for (PackLock lock : packLocks) lock.unlock(); } catch (IOException e) { throw new TransportException(e.getMessage(), e); } } }
private void handleSslFailure(Throwable e) throws TransportException { if (sslFailure || !trustInsecureSslConnection(e.getCause())) { throw new TransportException(uri, MessageFormat.format( JGitText.get().sslFailureExceptionMessage, currentUri.setPass(null)), e); } sslFailure = true; }
/** {@inheritDoc} */ @Override public FetchConnection openFetch() throws TransportException { if (src == null) throw new TransportException(uri, JGitText.get().onlyOneFetchSupported); try { return new BundleFetchConnection(this, src); } finally { src = null; } }
/** * Spawn process * * @param cmd * command * @return a {@link java.lang.Process} object. * @throws org.eclipse.jgit.errors.TransportException * if any. */ protected Process spawn(String cmd) throws TransportException { try { String[] args = { "." }; //$NON-NLS-1$ ProcessBuilder proc = local.getFS().runInShell(cmd, args); proc.directory(remoteGitDir); // Remove the same variables CGit does. Map<String, String> env = proc.environment(); env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$ env.remove("GIT_CONFIG"); //$NON-NLS-1$ env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$ env.remove("GIT_DIR"); //$NON-NLS-1$ env.remove("GIT_WORK_TREE"); //$NON-NLS-1$ env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$ env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$ env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$ return proc.start(); } catch (IOException err) { throw new TransportException(uri, err.getMessage(), err); } }
Socket openConnection() throws TransportException { final int tms = getTimeout() > 0 ? getTimeout() * 1000 : 0; final int port = uri.getPort() > 0 ? uri.getPort() : GIT_PORT; @SuppressWarnings("resource") // Closed by the caller final Socket s = new Socket(); try { final InetAddress host = InetAddress.getByName(uri.getHost()); s.bind(null); s.connect(new InetSocketAddress(host, port), tms); } catch (IOException c) { try { s.close(); } catch (IOException closeErr) { // ignore a failure during close, we're already failing } if (c instanceof UnknownHostException) throw new TransportException(uri, JGitText.get().unknownHost); if (c instanceof ConnectException) throw new TransportException(uri, c.getMessage()); throw new TransportException(uri, c.getMessage(), c); } return s; }
BundleFetchConnection(Transport transportBundle, InputStream src) throws TransportException { transport = transportBundle; bin = new BufferedInputStream(src); try { switch (readSignature()) { case 2: readBundleV2(); break; default: throw new TransportException(transport.uri, JGitText.get().notABundle); } } catch (TransportException err) { close(); throw err; } catch (IOException err) { close(); throw new TransportException(transport.uri, err.getMessage(), err); } catch (RuntimeException err) { close(); throw new TransportException(transport.uri, err.getMessage(), err); } }
(o1, o2) -> mtimes.get(o2).compareTo(mtimes.get(o1))); } catch (FtpChannel.FtpException f) { throw new TransportException( MessageFormat.format(JGitText.get().cannotListPackPath, objectsPath, f.getMessage()),
private boolean alreadyHave(AnyObjectId id) throws TransportException { try { return reader.has(id); } catch (IOException error) { throw new TransportException(MessageFormat.format( JGitText.get().cannotReadObject, id.name()), error); } }