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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/DartProjectImpl.java

Issue 10444057: Fix for 3204 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/model/DartProjectImpl.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/DartProjectImpl.java (revision 8057)
+++ editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/DartProjectImpl.java (working copy)
@@ -594,7 +594,8 @@
// Only update the .children file if the specified was in the .children file to be removed,
// or if the children file doesn't exist yet.
- if (foundAndRemoved || !getChildrenFile().exists()) {
+ File childrenFile = getChildrenFile();
+ if (foundAndRemoved || childrenFile == null || !childrenFile.exists()) {
// Write out the new contents to the .children file
setChildPaths(projectInfo, childPaths);
@@ -796,7 +797,7 @@
}
childPaths = new ArrayList<String>();
File file = getChildrenFile();
- if (recomputeLibrarySet || !file.exists()) {
+ if (recomputeLibrarySet || file == null || !file.exists()) {
computeChildPaths(childPaths);
return childPaths;
}
@@ -875,6 +876,9 @@
protected void setChildPaths(DartProjectInfo info, List<String> paths) {
info.setChildPaths(paths);
File file = getChildrenFile();
+ if (file == null) {
+ return;
+ }
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
@@ -981,14 +985,23 @@
}
/**
- * Return the file that contains the project-relative paths of the children of the project. The
- * file might not exist.
+ * Return the file that contains the project-relative paths of the children of the project, or
+ * <code>null</code> if the location of the file cannot be determined, such as when the project no
+ * longer exists. Even if non-<code>null</code>, the returned file might not exist.
*
* @return the file that contains the paths to the project's children
*/
private File getChildrenFile() {
// new File(DartCore.getPlugin().getStateLocation().append(getProject().getName()).append(CHILDREN_FILE_NAME).toOSString());
- return new File(getProject().getLocation().append(CHILDREN_FILE_NAME).toOSString());
+ IProject project = getProject();
+ if (project == null) {
+ return null;
+ }
+ IPath location = project.getLocation();
+ if (location == null) {
+ return null;
+ }
+ return new File(location.append(CHILDREN_FILE_NAME).toOSString());
}
private String getRelativePath(DartStringLiteral literal) {
« 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