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

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 2997153002: Guard the fix code against file system exceptions (Closed)
Patch Set: Created 3 years, 4 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: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index e25e759af336bc0d06d96fb26618bb6ba8fe76ff..2d0ea14caa9e570295f4530521cd83e0a7a4591c 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -809,10 +809,15 @@ class FixProcessor {
if (library != null) {
targetUnit = library.definingCompilationUnit;
Source targetSource = targetUnit.source;
- offset = targetSource.contents.data.length;
- filePath = targetSource.fullName;
- prefix = '$eol';
- suffix = '$eol';
+ try {
+ offset = targetSource.contents.data.length;
+ filePath = targetSource.fullName;
+ prefix = '$eol';
+ suffix = '$eol';
+ } on FileSystemException {
+ // If we can't read the file to get the offset, then we can't
+ // create a fix.
+ }
break;
}
}
« 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