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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2664313002: Catch Uri.parse() FormatException and skip the URI. (Closed)
Patch Set: Created 3 years, 11 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 | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/file_state.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index facf11f3a5912bfeab5009df057429bfb36ab812..1fdc870638459785ea05120fb8157f05c9144069 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -492,7 +492,12 @@ class FileState {
* Return the [FileState] for the given [relativeUri].
Brian Wilkerson 2017/01/31 21:51:23 Maybe mention that `null` is an expected result.
*/
FileState _fileForRelativeUri(String relativeUri) {
- Uri absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
+ Uri absoluteUri;
+ try {
+ absoluteUri = resolveRelativeUri(uri, Uri.parse(relativeUri));
+ } on FormatException catch (e) {
+ return null;
+ }
return _fsState.getFileForUri(absoluteUri);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/file_state_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698