private void report(@NonNull ErrorType err, @Nullable AnyObjectId id, String why) throws CorruptObjectException { if (errors.contains(err) && (id == null || skipList == null || !skipList.contains(id))) { if (id != null) { throw new CorruptObjectException(err, id, why); } throw new CorruptObjectException(why); } }
} catch (InvalidPathException e) { CorruptObjectException p = new CorruptObjectException(e.getMessage()); if (e.getCause() != null) p.initCause(e.getCause()); throw p;
/** * Verify the integrity of the object. * * @param id * identity of the object to be checked. * @param type * the type of the object. * @param data * raw content of the object. * @throws org.eclipse.jgit.errors.CorruptObjectException * @since 4.9 */ protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) throws CorruptObjectException { if (objCheck != null) { try { objCheck.check(id, type, data); } catch (CorruptObjectException e) { if (e.getErrorType() != null) { throw e; } throw new CorruptObjectException( MessageFormat.format(JGitText.get().invalidObject, Constants.typeString(type), id.name(), e.getMessage()), e); } } }
new ObjectChecker().checkTree(raw); } catch (CorruptObjectException error) { r.append("*** ERROR: ").append(error.getMessage()).append("\n"); r.append('\n');
/** * Construct a CorruptObjectException for reporting a problem not associated * with a specific object id. * * @param why * message describing the corruption. * @param cause * optional root cause exception * @since 3.4 */ public CorruptObjectException(String why, Throwable cause) { super(why); initCause(cause); }
/** {@inheritDoc} */ @Override protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) { try { super.verifySafeObject(id, type, data); } catch (CorruptObjectException e) { corruptObjects.add( new CorruptObject(id.toObjectId(), type, e.getErrorType())); } }
throw new TransportException(MessageFormat.format( JGitText.get().transportExceptionInvalid, Constants.typeString(type), id.name(), e.getMessage()));
/** * Construct a CorruptObjectException for reporting a problem not associated * with a specific object id. * * @param why * message describing the corruption. * @param cause * optional root cause exception * @since 3.4 */ public CorruptObjectException(String why, Throwable cause) { super(why); initCause(cause); }
/** {@inheritDoc} */ @Override protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) { try { super.verifySafeObject(id, type, data); } catch (CorruptObjectException e) { corruptObjects.add( new CorruptObject(id.toObjectId(), type, e.getErrorType())); } }
private byte[] inflate(PackedObjectInfo obj, long zpos, int sz) throws IOException, CorruptObjectException { try { return packOut.inflate(zpos, sz); } catch (DataFormatException dfe) { throw new CorruptObjectException( MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, Long.valueOf(obj.getOffset()), tmpPack.getAbsolutePath()), dfe); } }
coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$ coe.initCause(gone); throw coe;
/** * Verify the integrity of the object. * * @param id * identity of the object to be checked. * @param type * the type of the object. * @param data * raw content of the object. * @throws org.eclipse.jgit.errors.CorruptObjectException * @since 4.9 */ protected void verifySafeObject(final AnyObjectId id, final int type, final byte[] data) throws CorruptObjectException { if (objCheck != null) { try { objCheck.check(id, type, data); } catch (CorruptObjectException e) { if (e.getErrorType() != null) { throw e; } throw new CorruptObjectException( MessageFormat.format(JGitText.get().invalidObject, Constants.typeString(type), id.name(), e.getMessage()), e); } } }
new ObjectChecker().checkTree(raw); } catch (CorruptObjectException error) { r.append("*** ERROR: ").append(error.getMessage()).append("\n"); r.append('\n');
/** * Construct a CorruptObjectException for reporting a problem not associated * with a specific object id. * * @param why * message describing the corruption. * @param cause * optional root cause exception * @since 3.4 */ public CorruptObjectException(String why, Throwable cause) { super(why); initCause(cause); }
@Override public int read(byte[] b, int off, int cnt) throws IOException { try { int r = super.read(b, off, cnt); if (r > 0) remaining -= r; return r; } catch (ZipException badStream) { throw new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); } }
private byte[] inflate(PackedObjectInfo obj, long zpos, int sz) throws IOException, CorruptObjectException { try { return packOut.inflate(ctx, zpos, sz); } catch (DataFormatException dfe) { CorruptObjectException coe = new CorruptObjectException( MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, Long.valueOf(obj.getOffset()), packDsc.getFileName(PackExt.PACK))); coe.initCause(dfe); throw coe; } }
objCheck.check(id, type, data); } catch (CorruptObjectException e) { if (e.getErrorType() != null) { throw e; throw new CorruptObjectException(MessageFormat.format( JGitText.get().invalidObject, Constants.typeString(type), readCurs.abbreviate(id, 10).name(), e.getMessage()), e);
new ObjectChecker().checkTree(raw); } catch (CorruptObjectException error) { r.append("*** ERROR: ").append(error.getMessage()).append("\n"); r.append('\n');
static void checkValidEndOfStream(InputStream in, Inflater inf, AnyObjectId id, final byte[] buf) throws IOException, CorruptObjectException { for (;;) { int r; try { r = inf.inflate(buf); } catch (DataFormatException e) { throw new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); } if (r != 0) throw new CorruptObjectException(id, JGitText.get().corruptObjectIncorrectLength); if (inf.finished()) { if (inf.getRemaining() != 0 || in.read() != -1) throw new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); break; } if (!inf.needsInput()) throw new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); r = in.read(buf); if (r <= 0) throw new CorruptObjectException(id, JGitText.get().corruptObjectBadStream); inf.setInput(buf, 0, r); } }
return BinaryDelta.getResultSize(getDeltaHeader(ctx, deltaAt)); } catch (DataFormatException dfe) { CorruptObjectException coe = new CorruptObjectException( MessageFormat.format( JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos), getPackName())); coe.initCause(dfe); throw coe;