Don't unnecessarily explicitly call CorruptObjectException#initCause
CorruptObjectException has a constructor that takes Throwable and calls initCause with it. Use that instead of instantiating the exception and explicitly calling initCause. Change-Id: I1f2747d6c4cc5249e93401b9787eb4ceb50cb995 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
365c6cb387
commit
0f1c160aa7
|
@ -616,13 +616,12 @@ private byte[] inflate(PackedObjectInfo obj, long zpos, int sz)
|
|||
try {
|
||||
return packOut.inflate(ctx, zpos, sz);
|
||||
} catch (DataFormatException dfe) {
|
||||
CorruptObjectException coe = new CorruptObjectException(
|
||||
throw new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream,
|
||||
Long.valueOf(obj.getOffset()),
|
||||
packDsc.getFileName(PackExt.PACK)));
|
||||
coe.initCause(dfe);
|
||||
throw coe;
|
||||
packDsc.getFileName(PackExt.PACK)),
|
||||
dfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -657,8 +657,8 @@ void copyAsIs(PackOutputStream out, DfsObjectToPack src,
|
|||
CorruptObjectException corruptObject = new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream,
|
||||
Long.valueOf(src.offset), getFileName()));
|
||||
corruptObject.initCause(dataFormat);
|
||||
Long.valueOf(src.offset), getFileName()),
|
||||
dataFormat);
|
||||
|
||||
throw new StoredObjectRepresentationNotAvailableException(src,
|
||||
corruptObject);
|
||||
|
@ -866,12 +866,11 @@ else if (delta.next == null)
|
|||
return new ObjectLoader.SmallObject(type, data);
|
||||
|
||||
} catch (DataFormatException dfe) {
|
||||
CorruptObjectException coe = new CorruptObjectException(
|
||||
throw new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos),
|
||||
getFileName()));
|
||||
coe.initCause(dfe);
|
||||
throw coe;
|
||||
getFileName()),
|
||||
dfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1014,12 +1013,11 @@ long getObjectSize(DfsReader ctx, long pos)
|
|||
try {
|
||||
return BinaryDelta.getResultSize(getDeltaHeader(ctx, deltaAt));
|
||||
} catch (DataFormatException dfe) {
|
||||
CorruptObjectException coe = new CorruptObjectException(
|
||||
throw new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream, Long.valueOf(pos),
|
||||
getFileName()));
|
||||
coe.initCause(dfe);
|
||||
throw coe;
|
||||
getFileName()),
|
||||
dfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -515,8 +515,8 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
|
|||
CorruptObjectException corruptObject = new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream,
|
||||
Long.valueOf(src.offset), getPackFile()));
|
||||
corruptObject.initCause(dataFormat);
|
||||
Long.valueOf(src.offset), getPackFile()),
|
||||
dataFormat);
|
||||
|
||||
throw new StoredObjectRepresentationNotAvailableException(src,
|
||||
corruptObject);
|
||||
|
@ -895,12 +895,11 @@ else if (delta.next == null)
|
|||
return new ObjectLoader.SmallObject(type, data);
|
||||
|
||||
} catch (DataFormatException dfe) {
|
||||
CorruptObjectException coe = new CorruptObjectException(
|
||||
throw new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream,
|
||||
Long.valueOf(pos), getPackFile()));
|
||||
coe.initCause(dfe);
|
||||
throw coe;
|
||||
Long.valueOf(pos), getPackFile()),
|
||||
dfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -582,13 +582,12 @@ private byte[] inflate(PackedObjectInfo obj, long zpos, int sz)
|
|||
try {
|
||||
return packOut.inflate(zpos, sz);
|
||||
} catch (DataFormatException dfe) {
|
||||
CorruptObjectException coe = new CorruptObjectException(
|
||||
throw new CorruptObjectException(
|
||||
MessageFormat.format(
|
||||
JGitText.get().objectAtHasBadZlibStream,
|
||||
Long.valueOf(obj.getOffset()),
|
||||
tmpPack.getAbsolutePath()));
|
||||
coe.initCause(dfe);
|
||||
throw coe;
|
||||
tmpPack.getAbsolutePath()),
|
||||
dfe);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue