Package org.eclipse.jgit.errors

Examples of org.eclipse.jgit.errors.LargeObjectException$OutOfMemory


    // If it really is too big to work with, abort out now.
    //
    long sz = ldr.getSize();
    if (config.getBigFileThreshold() <= sz || Integer.MAX_VALUE < sz)
      throw new LargeObjectException(objId.copy());

    // Its considered to be large by the loader, but we really
    // want it in byte array format. Try to make it happen.
    //
    byte[] buf;
    try {
      buf = new byte[(int) sz];
    } catch (OutOfMemoryError noMemory) {
      LargeObjectException e;

      e = new LargeObjectException(objId.copy());
      e.initCause(noMemory);
      throw e;
    }
    InputStream in = ldr.openStream();
    try {
      IO.readFully(in, buf, 0, buf.length);
View Full Code Here


              JGitText.get().corruptObjectNegativeSize);
        if (hdr[p.value++] != 0)
          throw new CorruptObjectException(id,
              JGitText.get().corruptObjectGarbageAfterSize);
        if (path == null && Integer.MAX_VALUE < size)
          throw new LargeObjectException(id.copy());
        if (size < wc.getStreamFileThreshold() || path == null) {
          byte[] data = new byte[(int) size];
          int n = avail - p.value;
          if (n > 0)
            System.arraycopy(hdr, p.value, data, 0, n);
          IO.readFully(zIn, data, n, data.length - n);
          checkValidEndOfStream(in, inf, id, hdr);
          return new ObjectLoader.SmallObject(type, data);
        }
        return new LargeObject(type, size, path, id, wc.db);

      } else {
        readSome(in, hdr, 2, 18);
        int c = hdr[0] & 0xff;
        int type = (c >> 4) & 7;
        long size = c & 15;
        int shift = 4;
        int p = 1;
        while ((c & 0x80) != 0) {
          c = hdr[p++] & 0xff;
          size += (c & 0x7f) << shift;
          shift += 7;
        }

        switch (type) {
        case Constants.OBJ_COMMIT:
        case Constants.OBJ_TREE:
        case Constants.OBJ_BLOB:
        case Constants.OBJ_TAG:
          // Acceptable types for a loose object.
          break;
        default:
          throw new CorruptObjectException(id,
              JGitText.get().corruptObjectInvalidType);
        }

        if (path == null && Integer.MAX_VALUE < size)
          throw new LargeObjectException(id.copy());
        if (size < wc.getStreamFileThreshold() || path == null) {
          in.reset();
          IO.skipFully(in, p);
          Inflater inf = wc.inflater();
          InputStream zIn = inflate(in, inf);
View Full Code Here

      return true;
    }

    @Override
    public byte[] getCachedBytes() throws LargeObjectException {
      throw new LargeObjectException(id);
    }
View Full Code Here

  }

  @Override
  public byte[] getCachedBytes() throws LargeObjectException {
    try {
      throw new LargeObjectException(getObjectId());
    } catch (IOException cannotObtainId) {
      throw new LargeObjectException();
    }
  }
View Full Code Here

    DeltaIndex idx = ent.index;
    if (idx == null) {
      try {
        idx = new DeltaIndex(buffer(ent));
      } catch (OutOfMemoryError noMemory) {
        LargeObjectException e = new LargeObjectException(ent.object);
        e.initCause(noMemory);
        throw e;
      }
      if (0 < maxMemory)
        loaded += idx.getIndexSize() - idx.getSourceSize();
      ent.index = idx;
View Full Code Here

  }

  @Override
  public byte[] getCachedBytes() throws LargeObjectException {
    try {
      throw new LargeObjectException(getObjectId());
    } catch (IOException cannotObtainId) {
      throw new LargeObjectException();
    }
  }
View Full Code Here

      // At this point there is at least one delta to apply to data.
      // (Whole objects with no deltas to apply return early above.)

      if (data == null)
        throw new LargeObjectException();

      do {
        // Cache only the base immediately before desired object.
        if (cached)
          cached = false;
        else if (delta.next == null)
          ctx.getDeltaBaseCache().put(key, delta.basePos, type, data);

        pos = delta.deltaPos;

        byte[] cmds = decompress(pos + delta.hdrLen, delta.deltaSize, ctx);
        if (cmds == null) {
          data = null; // Discard base in case of OutOfMemoryError
          throw new LargeObjectException();
        }

        final long sz = BinaryDelta.getResultSize(cmds);
        if (Integer.MAX_VALUE <= sz)
          throw new LargeObjectException.ExceedsByteArrayLimit();
View Full Code Here

          return true;
        }

        @Override
        public byte[] getCachedBytes() throws LargeObjectException {
          throw new LargeObjectException();
        }
      };
    }
View Full Code Here

          return true;
        }

        @Override
        public byte[] getCachedBytes() throws LargeObjectException {
          throw new LargeObjectException();
        }
      };
    }
View Full Code Here

      return true;
    }

    @Override
    public byte[] getCachedBytes() throws LargeObjectException {
      throw new LargeObjectException(id);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.errors.LargeObjectException$OutOfMemory

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.