Skip to content
Permalink
Browse files
Improve error message.
  • Loading branch information
leerho committed Oct 31, 2018
1 parent c862134 commit 8034c6c183bd0a4d92035a9b14564f4b6a17bda7
Showing 1 changed file with 4 additions and 1 deletion.
@@ -99,7 +99,10 @@ class AllocateDirectMap implements Map {
resourceReadOnly = isFileReadOnly(file);
final long fileLength = file.length();
if ((localReadOnly || resourceReadOnly) && ((fileOffsetBytes + capacityBytes) > fileLength)) {
throw new IllegalArgumentException("Requested map length is greater than file length.");
throw new IllegalArgumentException(
"Read-only mode and requested map length is greater than current file length: "
+ "Requested Length = " + (fileOffsetBytes + capacityBytes)
+ ", Current File Length = " + fileLength);
}
raf = mapper(file, fileOffsetBytes, capacityBytes, resourceReadOnly);
nativeBaseOffset = map(raf.getChannel(), resourceReadOnly, fileOffsetBytes, capacityBytes);

0 comments on commit 8034c6c

Please sign in to comment.