Use new StoredObjectRepresentationNotAvailableException constructor

In 5e7eed4 a new StoredObjectRepresentationNotAvailableException
constructor was added, that takes a Throwable to initialize the
exception cause.

Update more call sites to use this constructor instead of first
instantiating it and explicitly calling initCause().

All callers now use the new constructor, so annotate the other one as
deprecated.

Change-Id: I6d2a7e289a95f0360ddebf904cfd8b6c18fef10c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2017-12-19 11:19:10 +09:00
parent 8a6af368c4
commit 365c6cb387
3 changed files with 14 additions and 21 deletions

View File

@ -56,8 +56,12 @@ public class StoredObjectRepresentationNotAvailableException extends Exception {
*
* @param otp
* the object whose current representation is no longer present.
* @deprecated use
* {@link #StoredObjectRepresentationNotAvailableException(ObjectToPack, Throwable)}
* instead.
* @since 3.0
*/
@Deprecated
public StoredObjectRepresentationNotAvailableException(ObjectToPack otp) {
// Do nothing.
}

View File

@ -660,16 +660,12 @@ void copyAsIs(PackOutputStream out, DfsObjectToPack src,
Long.valueOf(src.offset), getFileName()));
corruptObject.initCause(dataFormat);
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(corruptObject);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
corruptObject);
} catch (IOException ioError) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(ioError);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
ioError);
}
if (quickCopy != null) {

View File

@ -518,16 +518,12 @@ private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
Long.valueOf(src.offset), getPackFile()));
corruptObject.initCause(dataFormat);
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(corruptObject);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
corruptObject);
} catch (IOException ioError) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(src);
gone.initCause(ioError);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(src,
ioError);
}
if (quickCopy != null) {
@ -612,11 +608,8 @@ private synchronized void beginCopyAsIs(ObjectToPack otp)
try {
doOpen();
} catch (IOException thisPackNotValid) {
StoredObjectRepresentationNotAvailableException gone;
gone = new StoredObjectRepresentationNotAvailableException(otp);
gone.initCause(thisPackNotValid);
throw gone;
throw new StoredObjectRepresentationNotAvailableException(otp,
thisPackNotValid);
}
}
}