Unverified 提交 5cdf0cb3 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #745 from katzyn/FileDisk

Fix #744: TestFile failure on Java 9 and Java 10
...@@ -436,9 +436,11 @@ class FileDisk extends FileBase { ...@@ -436,9 +436,11 @@ class FileDisk extends FileBase {
if (readOnly) { if (readOnly) {
throw new NonWritableChannelException(); throw new NonWritableChannelException();
} }
if (newLength < file.length()) { /*
file.setLength(newLength); * RandomAccessFile.setLength() does not always work here since Java 9 for
} * unknown reason so use FileChannel.truncate().
*/
file.getChannel().truncate(newLength);
return this; return this;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论