StoredObjectRepresentationNotAvailableException: Add constructor that takes cause
If the cause can be passed into the constructor, callers don't need to instantiate it and then explicitly call initCause. Note that the constructors in this class cause "non-API parameter type" warnings because ObjectToPack is internal, however it's probably OK since the only non-internal reference to it is in the pgm.debug package. Change-Id: Ia4eab24e79f9afe6214ea8160137d941d4048319 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
parent
1e141469f1
commit
5e7eed41f6
|
@ -61,4 +61,19 @@ public class StoredObjectRepresentationNotAvailableException extends Exception {
|
|||
public StoredObjectRepresentationNotAvailableException(ObjectToPack otp) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an error for an object.
|
||||
*
|
||||
* @param otp
|
||||
* the object whose current representation is no longer present.
|
||||
* @param cause
|
||||
* cause
|
||||
* @since 4.10
|
||||
*/
|
||||
public StoredObjectRepresentationNotAvailableException(ObjectToPack otp,
|
||||
Throwable cause) {
|
||||
super(cause);
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -533,10 +533,8 @@ void copyAsIs(PackOutputStream out, DfsObjectToPack src,
|
|||
try {
|
||||
readFully(src.offset, buf, 0, 20, ctx);
|
||||
} catch (IOException ioError) {
|
||||
StoredObjectRepresentationNotAvailableException gone;
|
||||
gone = new StoredObjectRepresentationNotAvailableException(src);
|
||||
gone.initCause(ioError);
|
||||
throw gone;
|
||||
throw new StoredObjectRepresentationNotAvailableException(src,
|
||||
ioError);
|
||||
}
|
||||
int c = buf[0] & 0xff;
|
||||
final int typeCode = (c >> 4) & 7;
|
||||
|
|
Loading…
Reference in New Issue