Skip to content

Commit d10d95f

Browse files
author
Sharon Shabtai
committed
add message to exception
1 parent 48f3f90 commit d10d95f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

ds3-sdk/src/main/java/com/spectralogic/ds3client/Ds3InputStreamEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void writeTo(final OutputStream outStream) throws IOException {
5050
final long endTime = PerformanceUtils.getCurrentTime();
5151

5252
if (this.getContentLength() != -1 && totalBytes != this.getContentLength()) {
53-
throw new ContentLengthNotMatchException(String.format("The Content length (%d) not match the number of byte read (%d)", this.getContentLength(), totalBytes));
53+
throw new ContentLengthNotMatchException(path, this.getContentLength(), totalBytes);
5454
}
5555

5656
PerformanceUtils.logMbps(startTime, endTime, totalBytes, path, true);

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/GetObjectResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected void download(final WritableByteChannel destinationChannel, final int
5454
final long endTime = PerformanceUtils.getCurrentTime();
5555

5656
if (this.objectSize != -1 && totalBytes != this.objectSize) {
57-
throw new ContentLengthNotMatchException(String.format("The Content length (%d) not match the number of byte read (%d)", objectSize, totalBytes));
57+
throw new ContentLengthNotMatchException(objName, objectSize, totalBytes);
5858
}
5959

6060
PerformanceUtils.logMbps(startTime, endTime, totalBytes, objName, false);

ds3-sdk/src/main/java/com/spectralogic/ds3client/exceptions/ContentLengthNotMatchException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.io.IOException;
1919

2020
public class ContentLengthNotMatchException extends IOException {
21-
public ContentLengthNotMatchException(final String message) {
22-
super(message);
21+
public ContentLengthNotMatchException(final String fileName, final long contentLenght, final long totalBytes) {
22+
super(String.format("The Content length for %s (%d) not match the number of byte read (%d)", fileName, contentLenght, totalBytes));
2323
}
2424
}

0 commit comments

Comments
 (0)