Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java

Issue 10920081: Fix for issues 3473 and 4909 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (revision 11839)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/index/impl/InMemoryIndex.java (working copy)
@@ -618,12 +618,12 @@
+ " (" + indexFile.getTotalSpace() + ")");
}
try {
- readIndexFrom(indexFile);
+ boolean wasRead = readIndexFrom(indexFile);
if (DartCoreDebug.TRACE_INDEX_STATISTICS) {
logIndexStats("After initializing the index from file");
}
synchronized (indexStore) {
- return indexStore.getResourceCount() > 0;
+ return wasRead && indexStore.getResourceCount() > 0;
}
} catch (Exception exception) {
DartCore.logError(
@@ -666,29 +666,32 @@
* Read the contents of this index from the given input stream.
*
* @param input the input stream from which this index will be read
+ * @return {@code true} if the file was correctly read
* @throws IOException if the index could not be read from the given input stream
*/
- private void readIndex(ObjectInputStream input) throws IOException {
+ private boolean readIndex(ObjectInputStream input) throws IOException {
IndexReader reader = indexStore.createIndexReader();
- reader.readIndex(input);
+ return reader.readIndex(input);
}
/**
* Read the contents of this index from the given file.
*
* @param indexFile the file from which this index will be read
+ * @return {@code true} if the file was correctly read
* @throws IOException if the index could not be read from the given file
*/
- private void readIndexFrom(File indexFile) throws IOException {
+ private boolean readIndexFrom(File indexFile) throws IOException {
ObjectInputStream input = null;
try {
input = new ObjectInputStream(new FileInputStream(indexFile));
long startTime = System.currentTimeMillis();
- readIndex(input);
+ boolean wasRead = readIndex(input);
if (DartCoreDebug.PERF_INDEX) {
long endTime = System.currentTimeMillis();
DartCore.logInformation("Reading the index took " + (endTime - startTime) + " ms");
}
+ return wasRead;
} finally {
if (input != null) {
try {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698