mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vfs] read cached file content using cached file length (EA-77680)
This commit is contained in:
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -489,9 +489,11 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
boolean reloadFromDelegate;
|
||||
boolean outdated;
|
||||
int fileId;
|
||||
long length = -1L;
|
||||
|
||||
synchronized (myInputLock) {
|
||||
fileId = getFileId(file);
|
||||
outdated = checkFlag(fileId, MUST_RELOAD_CONTENT) || FSRecords.getLength(fileId) == -1L;
|
||||
outdated = checkFlag(fileId, MUST_RELOAD_CONTENT) || (length = FSRecords.getLength(fileId)) == -1L;
|
||||
reloadFromDelegate = outdated || (contentStream = readContent(file)) == null;
|
||||
}
|
||||
|
||||
@@ -529,9 +531,8 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
}
|
||||
else {
|
||||
try {
|
||||
final int length = (int)file.getLength();
|
||||
assert length >= 0 : file;
|
||||
return FileUtil.loadBytes(contentStream, length);
|
||||
return FileUtil.loadBytes(contentStream, (int)length);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw FSRecords.handleError(e);
|
||||
|
||||
Reference in New Issue
Block a user