Examples of ObjectLoader


Examples of org.eclipse.jgit.lib.ObjectLoader

   *         object, or null if the object does not exist.
   * @throws IOException
   */
  ObjectLoader openObject(final WindowCursor curs, final AnyObjectId objectId)
      throws IOException {
    ObjectLoader ldr;

    ldr = openObjectImpl1(curs, objectId);
    if (ldr != null)
      return ldr;

View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

    return null;
  }

  final ObjectLoader openObjectImpl1(final WindowCursor curs,
      final AnyObjectId objectId) throws IOException {
    ObjectLoader ldr;

    ldr = openObject1(curs, objectId);
    if (ldr != null)
      return ldr;
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

  }

  final ObjectLoader openObjectImpl2(final WindowCursor curs,
      final String objectName, final AnyObjectId objectId)
      throws IOException {
    ObjectLoader ldr;

    ldr = openObject2(curs, objectName, objectId);
    if (ldr != null)
      return ldr;
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

  }

  ObjectLoader openObject1(final WindowCursor curs,
      final AnyObjectId objectId) throws IOException {
    if (unpackedObjectCache.isUnpacked(objectId)) {
      ObjectLoader ldr = openObject2(curs, objectId.name(), objectId);
      if (ldr != null)
        return ldr;
      else
        unpackedObjectCache.remove(objectId);
    }

    PackList pList = packList.get();
    SEARCH: for (;;) {
      for (final PackFile p : pList.packs) {
        try {
          final ObjectLoader ldr = p.get(curs, objectId);
          if (ldr != null)
            return ldr;
        } catch (PackMismatchException e) {
          // Pack was modified; refresh the entire pack list.
          //
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

    }
  }

  private void verifyAndInsertLooseObject(final AnyObjectId id,
      final byte[] compressed) throws IOException {
    final ObjectLoader uol;
    try {
      uol = UnpackedObject.parse(compressed, id);
    } catch (CorruptObjectException parsingError) {
      // Some HTTP servers send back a "200 OK" status with an HTML
      // page that explains the requested file could not be found.
      // These servers are most certainly misconfigured, but many
      // of them exist in the world, and many of those are hosting
      // Git repositories.
      //
      // Since an HTML page is unlikely to hash to one of our loose
      // objects we treat this condition as a FileNotFoundException
      // and attempt to recover by getting the object from another
      // source.
      //
      final FileNotFoundException e;
      e = new FileNotFoundException(id.name());
      e.initCause(parsingError);
      throw e;
    }

    final int type = uol.getType();
    final byte[] raw = uol.getCachedBytes();
    if (objCheck != null) {
      try {
        objCheck.check(type, raw);
      } catch (CorruptObjectException e) {
        throw new TransportException(MessageFormat.format(JGitText.get().transportExceptionInvalid
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

  }

  private void writeWholeObjectDeflate(PackOutputStream out,
      final ObjectToPack otp) throws IOException {
    final Deflater deflater = deflater();
    final ObjectLoader ldr = reader.open(otp, otp.getType());

    out.writeHeader(otp, ldr.getSize());

    deflater.reset();
    DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
    ldr.copyTo(dst);
    dst.finish();
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

      IncorrectObjectTypeException, IOException {
    TreeWithData tree = treeCache.get(id);
    if (tree != null)
      return tree.buf;

    ObjectLoader ldr = reader.open(id, OBJ_TREE);
    byte[] buf = ldr.getCachedBytes(Integer.MAX_VALUE);
    treeCache.add(new TreeWithData(id, buf));
    return buf;
  }
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

        continue;

      if (needBaseObjectIds)
        baseObjectIds.add(baseId);

      final ObjectLoader ldr;
      try {
        ldr = readCurs.open(baseId);
      } catch (MissingObjectException notFound) {
        missing.add(baseId);
        continue;
      }

      final DeltaVisit visit = new DeltaVisit();
      visit.data = ldr.getCachedBytes(Integer.MAX_VALUE);
      visit.id = baseId;
      final int typeCode = ldr.getType();
      final PackedObjectInfo oe = newInfo(baseId, null, null);

      if (onAppendBase(typeCode, visit.data, oe))
        entries[entryCount++] = oe;
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

      }
    }

    if (isCheckObjectCollisions()) {
      try {
        final ObjectLoader ldr = readCurs.open(id, type);
        final byte[] existingData = ldr.getCachedBytes(data.length);
        if (!Arrays.equals(data, existingData)) {
          throw new IOException(MessageFormat.format(
              JGitText.get().collisionOn, id.name()));
        }
      } catch (MissingObjectException notLocal) {
View Full Code Here

Examples of org.eclipse.jgit.lib.ObjectLoader

  }

  public ObjectLoader open(AnyObjectId objectId, int typeHint)
      throws MissingObjectException, IncorrectObjectTypeException,
      IOException {
    final ObjectLoader ldr = db.openObject(this, objectId);
    if (ldr == null) {
      if (typeHint == OBJ_ANY)
        throw new MissingObjectException(objectId.copy(), "unknown");
      throw new MissingObjectException(objectId.copy(), typeHint);
    }
    if (typeHint != OBJ_ANY && ldr.getType() != typeHint)
      throw new IncorrectObjectTypeException(objectId.copy(), typeHint);
    return ldr;
  }
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.