Skip to content

Commit

Permalink
[apache#2308] improvement(server): More detailed and clear logs on re…
Browse files Browse the repository at this point in the history
…ading failure for FileSegmentManagedBuffer
  • Loading branch information
Junfan Zhang committed Dec 27, 2024
1 parent 1c56e74 commit a47d3b8
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ public ByteBuffer nioByteBuffer() {
buf.flip();
return buf;
} catch (IOException e) {
String errorMessage = "Error in reading " + this;
String fileName = file.getAbsolutePath();
String errorMessage = String.format("Errors on reading localfile data with offset[%s] length[%s] from [%s]. ", offset, length, fileName);
try {
if (channel != null) {
long size = channel.size();
errorMessage = "Error in reading " + this + " (actual file length " + size + ")";
errorMessage += String.format("The actual file length: %s", size);
}
} catch (IOException ignored) {
// ignore
Expand Down Expand Up @@ -107,7 +108,7 @@ public Object convertToNetty() {
try {
fileChannel = FileChannel.open(file.toPath(), StandardOpenOption.READ);
} catch (IOException e) {
throw new RssException("Error in reading " + file);
throw new RssException("Errors on reading " + file.getAbsolutePath(), e);
}
return new DefaultFileRegion(fileChannel, offset, length);
}
Expand Down

0 comments on commit a47d3b8

Please sign in to comment.