Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2308] improvement(server): More detailed and clear logs on reading failure for FileSegmentManagedBuffer #2309

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ 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 +111,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
Loading