Do not throw NPE from IFile.getContents(false) #2290
#2291
+92
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IFile.getContents(false)does thread unsafe existence checks, resulting in random exceptions.eclipse.platform/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/File.java
Lines 354 to 362 in b7cb30f
Ideally, read operations should be synchronized with write operations, but that might break backward compatibility.
This PR works around one of such exceptions by adding an explicit null check.
Error handling is copied from thread-unsafe check:
eclipse.platform/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Resource.java
Lines 367 to 378 in b7cb30f
Fixes #2290