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

Side by Side Diff: compiler/java/com/google/dart/runner/BundleLibrarySource.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.runner; 5 package com.google.dart.runner;
6 6
7 import com.google.dart.compiler.DartSource; 7 import com.google.dart.compiler.DartSource;
8 import com.google.dart.compiler.LibrarySource; 8 import com.google.dart.compiler.LibrarySource;
9 import com.google.dart.compiler.UrlDartSource; 9 import com.google.dart.compiler.UrlDartSource;
10 import com.google.dart.compiler.UrlSource; 10 import com.google.dart.compiler.UrlSource;
(...skipping 20 matching lines...) Expand all
31 31
32 public BundleLibrarySource(ClassLoader loader, String basePath, String filenam e) 32 public BundleLibrarySource(ClassLoader loader, String basePath, String filenam e)
33 throws URISyntaxException { 33 throws URISyntaxException {
34 super(loader.getResource(basePath + filename).toURI()); 34 super(loader.getResource(basePath + filename).toURI());
35 this.loader = loader; 35 this.loader = loader;
36 this.basePath = basePath; 36 this.basePath = basePath;
37 this.filename = filename; 37 this.filename = filename;
38 } 38 }
39 39
40 @Override 40 @Override
41 public LibrarySource getImportFor(String filename) { 41 public LibrarySource getImportFor(String relPath) {
42 try { 42 try {
43 return new BundleLibrarySource(loader, basePath, filename); 43 return new BundleLibrarySource(loader, basePath, relPath);
44 } catch (URISyntaxException e) { 44 } catch (URISyntaxException e) {
45 throw new AssertionError(); 45 return null;
46 } 46 }
47 } 47 }
48 48
49 @Override 49 @Override
50 public DartSource getSourceFor(final String relPath) { 50 public DartSource getSourceFor(String relPath) {
51 try { 51 try {
52 return new BundleDartSource(loader, basePath, relPath); 52 return new BundleDartSource(loader, basePath, relPath);
53 } catch (URISyntaxException e) { 53 } catch (URISyntaxException e) {
54 throw new AssertionError(e); 54 return null;
55 } 55 }
56 } 56 }
57 57
58 @Override 58 @Override
59 public String getName() { 59 public String getName() {
60 return basePath + filename; 60 return basePath + filename;
61 } 61 }
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698