Skip to content

Commit

Permalink
Improve error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
leerho committed Oct 31, 2018
1 parent c862134 commit 8034c6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/yahoo/memory/AllocateDirectMap.java
Expand Up @@ -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);
Expand Down

0 comments on commit 8034c6c

Please sign in to comment.