Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.PackProtocolException


        if (!wantSatisfied(obj))
          return false;
      }
      return true;
    } catch (IOException e) {
      throw new PackProtocolException(JGitText.get().internalRevisionError, e);
    }
  }
View Full Code Here


  }

  AckNackResult readACK(final MutableObjectId returnedId) throws IOException {
    final String line = readString();
    if (line.length() == 0)
      throw new PackProtocolException(JGitText.get().expectedACKNAKFoundEOF);
    if ("NAK".equals(line))
      return AckNackResult.NAK;
    if (line.startsWith("ACK ")) {
      returnedId.fromString(line.substring(4, 44));
      if (line.length() == 44)
        return AckNackResult.ACK;

      final String arg = line.substring(44);
      if (arg.equals(" continue"))
        return AckNackResult.ACK_CONTINUE;
      else if (arg.equals(" common"))
        return AckNackResult.ACK_COMMON;
      else if (arg.equals(" ready"))
        return AckNackResult.ACK_READY;
    }
    if (line.startsWith("ERR "))
      throw new PackProtocolException(line.substring(4));
    throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedACKNAKGot, line));
  }
View Full Code Here

    if (statelessRPC && multiAck != MultiAck.DETAILED) {
      // Our stateless RPC implementation relies upon the detailed
      // ACK status to tell us common objects for reuse in future
      // requests.  If its not enabled, we can't talk to the peer.
      //
      throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED));
    }

    return line.toString();
  }
View Full Code Here

      }
      return avail;
    }

    private PackProtocolException outOfOrderAdvertisement(final String n) {
      return new PackProtocolException(MessageFormat.format(JGitText.get().advertisementOfCameBefore, n, n));
    }
View Full Code Here

    private PackProtocolException outOfOrderAdvertisement(final String n) {
      return new PackProtocolException(MessageFormat.format(JGitText.get().advertisementOfCameBefore, n, n));
    }

    private PackProtocolException invalidAdvertisement(final String n) {
      return new PackProtocolException(MessageFormat.format(JGitText.get().invalidAdvertisementOf, n));
    }
View Full Code Here

    private PackProtocolException invalidAdvertisement(final String n) {
      return new PackProtocolException(MessageFormat.format(JGitText.get().invalidAdvertisementOf, n));
    }

    private PackProtocolException duplicateAdvertisement(final String n) {
      return new PackProtocolException(MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, n));
    }
View Full Code Here

  private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates)
      throws IOException {
    final String unpackLine = readStringLongTimeout();
    if (!unpackLine.startsWith("unpack "))
      throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().unexpectedReportLine, unpackLine));
    final String unpackStatus = unpackLine.substring("unpack ".length());
    if (!unpackStatus.equals("ok"))
      throw new TransportException(uri, MessageFormat.format(
          JGitText.get().errorOccurredDuringUnpackingOnTheRemoteEnd, unpackStatus));

    String refLine;
    while ((refLine = pckIn.readString()) != PacketLineIn.END) {
      boolean ok = false;
      int refNameEnd = -1;
      if (refLine.startsWith("ok ")) {
        ok = true;
        refNameEnd = refLine.length();
      } else if (refLine.startsWith("ng ")) {
        ok = false;
        refNameEnd = refLine.indexOf(" ", 3);
      }
      if (refNameEnd == -1)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2
            , uri, refLine));
      final String refName = refLine.substring(3, refNameEnd);
      final String message = (ok ? null : refLine
          .substring(refNameEnd + 1));

      final RemoteRefUpdate rru = refUpdates.get(refName);
      if (rru == null)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedRefReport, uri, refName));
      if (ok) {
        rru.setStatus(Status.OK);
      } else {
        rru.setStatus(Status.REJECTED_OTHER_REASON);
        rru.setMessage(message);
      }
    }
    for (final RemoteRefUpdate rru : refUpdates.values()) {
      if (rru.getStatus() == Status.AWAITING_REPORT)
        throw new PackProtocolException(MessageFormat.format(
            JGitText.get().expectedReportForRefNotReceived , uri, rru.getRemoteName()));
    }
  }
View Full Code Here

      }

      if (line == PacketLineIn.END)
        break;
      if (!line.startsWith("want ") || line.length() < 45)
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line));

      if (isFirst && line.length() > 45) {
        String opt = line.substring(45);
        if (opt.startsWith(" "))
          opt = opt.substring(1);
View Full Code Here

          pckOut.writeString("ACK " + last.name() + "\n");

        return true;

      } else {
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line));
      }
    }
  }
View Full Code Here

          ObjectId id = notFound.getObjectId();
          if (wantIds.contains(id)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, id.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg, notFound);
          }
          continue;
        }
        if (obj == null)
          break;

        // If the object is still found in wantIds, the want
        // list wasn't parsed earlier, and was done in this batch.
        //
        if (wantIds.remove(obj)) {
          if (!advertised.contains(obj)) {
            String msg = MessageFormat.format(
                JGitText.get().wantNotValid, obj.name());
            pckOut.writeString("ERR " + msg);
            throw new PackProtocolException(msg);
          }

          if (!obj.has(WANT)) {
            obj.add(WANT);
            wantAll.add(obj);
View Full Code Here

TOP

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

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.