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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 1131593006: Report malformed URIs in library dependencies (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 3e5ddde094dd997f8b3c01f3725d8b95a6e8afd4..ca1dbc5bfb8fccb898cf2a0d6d294049cc4bc0ea 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -499,13 +499,23 @@ class _LibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
/**
* Handle an import/export tag by loading the referenced library and
* registering its dependency in [handler] for the computation of the import/
- * export scope.
+ * export scope. If the tag does not contain a valid URI, then its dependency
+ * is not registered in [handler].
*/
- Future registerLibraryFromTag(LibraryDependencyHandler handler,
- LibraryElement library,
- LibraryDependency tag) {
+ Future<Null> registerLibraryFromTag(LibraryDependencyHandler handler,
+ LibraryElement library,
+ LibraryDependency tag) {
Uri base = library.canonicalUri;
- Uri resolvedUri = base.resolve(tag.uri.dartString.slowToString());
+ String tagUriString = tag.uri.dartString.slowToString();
+ Uri resolvedUri;
+ try {
+ resolvedUri = base.resolve(tagUriString);
+ } on FormatException {
+ compiler.reportError(
+ tag.uri, MessageKind.INVALID_URI, {'uri': tagUriString});
+ // 'reportError' does not stop necessarily stop compilation
+ return new Future.value();
+ }
return createLibrary(handler, library, resolvedUri, tag.uri)
.then((LibraryElement loadedLibrary) {
if (loadedLibrary == null) return;
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698