Package org.eclipse.jgit.errors

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


    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

    public void checkWants(UploadPack up, List<ObjectId> wants)
        throws PackProtocolException, IOException {
      if (!up.isBiDirectionalPipe())
        new ReachableCommitRequestValidator().checkWants(up, wants);
      else if (!wants.isEmpty())
        throw new PackProtocolException(MessageFormat.format(
            JGitText.get().wantNotValid, wants.iterator().next().name()));
    }
View Full Code Here

      else if (!wants.isEmpty()) {
        Set<ObjectId> refIds =
          refIdSet(up.getRepository().getRefDatabase().getRefs(ALL).values());
        for (ObjectId obj : wants) {
          if (!refIds.contains(obj))
            throw new PackProtocolException(MessageFormat.format(
                JGitText.get().wantNotValid, obj.name()));
        }
      }
    }
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)) //$NON-NLS-1$
      return AckNackResult.NAK;
    if (line.startsWith("ACK ")) { //$NON-NLS-1$
      returnedId.fromString(line.substring(4, 44));
      if (line.length() == 44)
        return AckNackResult.ACK;

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

        clientShallowCommits.add(ObjectId.fromString(line.substring(8)));
        continue;
      }

      if (!line.startsWith("want ") || line.length() < 45) //$NON-NLS-1$
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line)); //$NON-NLS-1$

      if (isFirst) {
        if (line.length() > 45) {
          FirstLine firstLine = new FirstLine(line);
          options = firstLine.getOptions();
View Full Code Here

          pckOut.writeString("ACK " + last.name() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$

        return true;

      } else {
        throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line)); //$NON-NLS-1$
      }
    }
  }
View Full Code Here

        }
      }
      wantIds.clear();
    } catch (MissingObjectException notFound) {
      ObjectId id = notFound.getObjectId();
      throw new PackProtocolException(MessageFormat.format(
          JGitText.get().wantNotValid, id.name()), notFound);
    } finally {
      q.release();
    }
  }
View Full Code Here

    AsyncRevObjectQueue q = walk.parseAny(notAdvertisedWants, true);
    try {
      RevObject obj;
      while ((obj = q.next()) != null) {
        if (!(obj instanceof RevCommit))
          throw new PackProtocolException(MessageFormat.format(
            JGitText.get().wantNotValid, obj.name()));
        walk.markStart((RevCommit) obj);
      }
    } catch (MissingObjectException notFound) {
      ObjectId id = notFound.getObjectId();
      throw new PackProtocolException(MessageFormat.format(
          JGitText.get().wantNotValid, id.name()), notFound);
    } finally {
      q.release();
    }
    for (ObjectId id : reachableFrom) {
      try {
        walk.markUninteresting(walk.parseCommit(id));
      } catch (IncorrectObjectTypeException notCommit) {
        continue;
      }
    }

    RevCommit bad = walk.next();
    if (bad != null) {
      throw new PackProtocolException(MessageFormat.format(
          JGitText.get().wantNotValid,
          bad.name()));
    }
    walk.reset();
  }
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.