Examples of PackProtocolException


Examples of org.eclipse.jgit.errors.PackProtocolException

      }

      if (line.length() < 83) {
        final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef;
        sendError(m);
        throw new PackProtocolException(m);
      }

      final ObjectId oldId = ObjectId.fromString(line.substring(0, 40));
      final ObjectId newId = ObjectId.fromString(line.substring(41, 81));
      final String name = line.substring(82);
View Full Code Here

Examples of org.eclipse.jgit.errors.PackProtocolException

    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

Examples of org.eclipse.jgit.errors.PackProtocolException

  }

  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;
    }
    throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedACKNAKGot, line));
  }
View Full Code Here

Examples of org.eclipse.jgit.errors.PackProtocolException

    }
    available(avail);
  }

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

Examples of org.eclipse.jgit.errors.PackProtocolException

  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

Examples of org.eclipse.jgit.errors.PackProtocolException

      }
      return avail;
    }

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

Examples of org.eclipse.jgit.errors.PackProtocolException

    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

Examples of org.eclipse.jgit.errors.PackProtocolException

    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

Examples of org.eclipse.jgit.errors.PackProtocolException

        additionalHaves.add(id);
      } else if (name.endsWith("^{}")) {
        name = name.substring(0, name.length() - 3);
        final Ref prior = avail.get(name);
        if (prior == null)
          throw new PackProtocolException(uri, MessageFormat.format(
              JGitText.get().advertisementCameBefore, name, name));

        if (prior.getPeeledObjectId() != null)
          throw duplicateAdvertisement(name + "^{}");
View Full Code Here

Examples of org.eclipse.jgit.errors.PackProtocolException

    b.append(option);
    return true;
  }

  private PackProtocolException duplicateAdvertisement(final String name) {
    return new PackProtocolException(uri, MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.