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

Unified Diff: compiler/java/com/google/dart/compiler/UrlLibrarySource.java

Issue 9420011: Issue 1548. If URI can not be parsed, return null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
Index: compiler/java/com/google/dart/compiler/UrlLibrarySource.java
diff --git a/compiler/java/com/google/dart/compiler/UrlLibrarySource.java b/compiler/java/com/google/dart/compiler/UrlLibrarySource.java
index c5b6992e1316b6de8a1aeedcf568b26d06b4db1d..6f5c83e817316cc63e033553875363005f5d6fbc 100644
--- a/compiler/java/com/google/dart/compiler/UrlLibrarySource.java
+++ b/compiler/java/com/google/dart/compiler/UrlLibrarySource.java
@@ -1,18 +1,15 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-
package com.google.dart.compiler;
import java.io.File;
import java.net.URI;
-import java.net.URISyntaxException;
/**
* A {@link LibrarySource} backed by a URL.
*/
public class UrlLibrarySource extends UrlSource implements LibrarySource {
-
public UrlLibrarySource(URI uri, SystemLibraryManager slm) {
super(uri, slm);
}
@@ -36,13 +33,17 @@ public class UrlLibrarySource extends UrlSource implements LibrarySource {
// Force the creation of an escaped relative URI to deal with spaces, etc.
URI uri = getUri().resolve(new URI(null, null, relPath, null)).normalize();
return new UrlDartSource(uri, relPath, this, systemLibraryManager);
- } catch (URISyntaxException e) {
- throw new AssertionError(e);
+ } catch (Throwable e) {
+ return null;
}
}
@Override
public LibrarySource getImportFor(String relPath) {
- return new UrlLibrarySource(getUri().resolve(relPath).normalize(), systemLibraryManager);
+ try {
+ return new UrlLibrarySource(getUri().resolve(relPath).normalize(), systemLibraryManager);
+ } catch (Throwable e) {
+ return null;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698