提交 ca010854 authored 作者: Thomas Mueller's avatar Thomas Mueller

The wrong error message was thrown when trying to open a database where the…

The wrong error message was thrown when trying to open a database where the database file could not be read for some reason (for example because the split file system was used, and the file was split at the wrong position). 
上级 5c625d99
......@@ -526,7 +526,9 @@ public class FileStore {
* Release the file lock.
*/
public void releaseLock() {
file.releaseLock();
if (file != null) {
file.releaseLock();
}
}
}
......@@ -239,20 +239,27 @@ public class FileSystemSplit extends FileSystem {
long l = o.length();
length += l;
if (l != maxLength) {
throw new IOException("Expected file length: " + maxLength + " got: " + l + " for " + o.getName());
closeAndThrow(array, o, maxLength);
}
}
o = array[array.length - 1];
long l = o.length();
length += l;
if (l > maxLength) {
throw new IOException("Expected file length: " + maxLength + " got: " + l + " for " + o.getName());
closeAndThrow(array, o, maxLength);
}
}
FileObjectSplit fo = new FileObjectSplit(fileName, mode, array, length, maxLength);
return fo;
}
private void closeAndThrow(FileObject[] array, FileObject o, long maxLength) throws IOException {
for (FileObject f : array) {
f.close();
}
throw new IOException("Expected file length: " + maxLength + " got: " + o.length() + " for " + o.getName());
}
public OutputStream openFileOutputStream(String fileName, boolean append) {
fileName = translateFileName(fileName);
// TODO the output stream is not split
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论