Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.TransportException


      env.remove("GIT_INDEX_FILE");
      env.remove("GIT_NO_REPLACE_OBJECTS");

      return proc.start();
    } catch (IOException err) {
      throw new TransportException(uri, err.getMessage(), err);
    }
  }
View Full Code Here


      final Repository dst;
      try {
        dst = new FileRepository(remoteGitDir);
      } catch (IOException err) {
        throw new TransportException(uri, JGitText.get().notAGitDirectory);
      }

      final PipedInputStream in_r;
      final PipedOutputStream in_w;

      final PipedInputStream out_r;
      final PipedOutputStream out_w;
      try {
        in_r = new PipedInputStream();
        in_w = new PipedOutputStream(in_r);

        out_r = new PipedInputStream() {
          // The client (BasePackFetchConnection) can write
          // a huge burst before it reads again. We need to
          // force the buffer to be big enough, otherwise it
          // will deadlock both threads.
          {
            buffer = new byte[MIN_CLIENT_BUFFER];
          }
        };
        out_w = new PipedOutputStream(out_r);
      } catch (IOException err) {
        dst.close();
        throw new TransportException(uri, JGitText.get().cannotConnectPipes, err);
      }

      worker = new Thread("JGit-Upload-Pack") {
        public void run() {
          try {
View Full Code Here

      final Repository dst;
      try {
        dst = new FileRepository(remoteGitDir);
      } catch (IOException err) {
        throw new TransportException(uri, JGitText.get().notAGitDirectory);
      }

      final PipedInputStream in_r;
      final PipedOutputStream in_w;

      final PipedInputStream out_r;
      final PipedOutputStream out_w;
      try {
        in_r = new PipedInputStream();
        in_w = new PipedOutputStream(in_r);

        out_r = new PipedInputStream();
        out_w = new PipedOutputStream(out_r);
      } catch (IOException err) {
        dst.close();
        throw new TransportException(uri, JGitText.get().cannotConnectPipes, err);
      }

      worker = new Thread("JGit-Receive-Pack") {
        public void run() {
          try {
View Full Code Here

    } catch (NotSupportedException err) {
      throw err;
    } catch (TransportException err) {
      throw err;
    } catch (IOException err) {
      throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
    }
  }
View Full Code Here

      case HttpURLConnection.HTTP_NOT_FOUND:
        break;

      default:
        throw new TransportException(uri, MessageFormat.format(
            JGitText.get().cannotReadHEAD, status, conn.getResponseMessage()));
      }
    }

    WalkFetchConnection wfc = new WalkFetchConnection(this, d);
View Full Code Here

    } catch (NotSupportedException err) {
      throw err;
    } catch (TransportException err) {
      throw err;
    } catch (IOException err) {
      throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
    }
  }
View Full Code Here

              MessageFormat.format(JGitText.get().uriNotFound, u));

        case HttpURLConnection.HTTP_UNAUTHORIZED:
          authMethod = HttpAuthMethod.scanResponse(conn);
          if (authMethod == HttpAuthMethod.NONE)
            throw new TransportException(uri, MessageFormat.format(
                JGitText.get().authenticationNotSupported, uri));
          if (1 < authAttempts
              || !authMethod.authorize(uri,
                  getCredentialsProvider())) {
            throw new TransportException(uri,
                JGitText.get().notAuthorized);
          }
          authAttempts++;
          continue;

        case HttpURLConnection.HTTP_FORBIDDEN:
          throw new TransportException(uri, MessageFormat.format(
              JGitText.get().serviceNotPermitted, service));

        default:
          String err = status + " " + conn.getResponseMessage(); //$NON-NLS-1$
          throw new TransportException(uri, err);
        }
      }
    } catch (NotSupportedException e) {
      throw e;
    } catch (TransportException e) {
      throw e;
    } catch (IOException e) {
      throw new TransportException(uri, MessageFormat.format(JGitText.get().cannotOpenService, service), e);
    }
  }
View Full Code Here

    return input;
  }

  IOException wrongContentType(String expType, String actType) {
    final String why = MessageFormat.format(JGitText.get().expectedReceivedContentType, expType, actType);
    return new TransportException(uri, why);
  }
View Full Code Here

    // as a pkt-line stream.
    //
    final byte[] magic = new byte[5];
    IO.readFully(in, magic, 0, magic.length);
    if (magic[4] != '#') {
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().expectedPktLineWithService, RawParseUtils.decode(magic)));
    }

    final PacketLineIn pckIn = new PacketLineIn(new UnionInputStream(
        new ByteArrayInputStream(magic), in));
    final String exp = "# service=" + service; //$NON-NLS-1$
    final String act = pckIn.readString();
    if (!exp.equals(act)) {
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().expectedGot, exp, act));
    }

    while (pckIn.readString() != PacketLineIn.END) {
      // for now, ignore the remaining header lines
View Full Code Here

      if (conn == null) {
        // Output hasn't started yet, because everything fit into
        // our request buffer. Send with a Content-Length header.
        //
        if (out.length() == 0) {
          throw new TransportException(uri,
              JGitText.get().startingReadStageWithoutWrittenRequestDataPendingIsNotSupported);
        }

        // Try to compress the content, but only if that is smaller.
        TemporaryBuffer buf = new TemporaryBuffer.Heap(http.postBuffer);
        try {
          GZIPOutputStream gzip = new GZIPOutputStream(buf);
          out.writeTo(gzip, null);
          gzip.close();
          if (out.length() < buf.length())
            buf = out;
        } catch (IOException err) {
          // Most likely caused by overflowing the buffer, meaning
          // its larger if it were compressed. Don't compress.
          buf = out;
        }

        openStream();
        if (buf != out)
          conn.setRequestProperty(HDR_CONTENT_ENCODING, ENCODING_GZIP);
        conn.setFixedLengthStreamingMode((int) buf.length());
        final OutputStream httpOut = conn.getOutputStream();
        try {
          buf.writeTo(httpOut, null);
        } finally {
          httpOut.close();
        }
      }

      out.reset();

      final int status = HttpSupport.response(conn);
      if (status != HttpURLConnection.HTTP_OK) {
        throw new TransportException(uri, status + " " //$NON-NLS-1$
            + conn.getResponseMessage());
      }

      final String contentType = conn.getContentType();
      if (!responseType.equals(contentType)) {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.TransportException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.