Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException caused by invalid directive #712

Closed
bwilkerson opened this issue Dec 6, 2011 · 2 comments
Closed

IllegalArgumentException caused by invalid directive #712

bwilkerson opened this issue Dec 6, 2011 · 2 comments

Comments

@bwilkerson
Copy link
Member

Compiling the following source


import('dart:html');

import('file:');

class hello {

  hello() {
  }

  void run() {
    write("Hello World!");
  }

  void write(String message) {
    // the HTML library defines a global "document" variable
    document.query('#status').innerHTML = message;
  }
}

void main() {
  new hello().run();
}


produces the following stack trace:


!SUBENTRY 1 com.google.dart.tools.core 4 0 2011-12-06 14:05:48.331
!MESSAGE Failed to parse file:/Users/brianwilkerson/dart/hello/hello.dart
!STACK 0
java.lang.IllegalArgumentException
    at java.net.URI.create(URI.java:842)
    at java.net.URI.resolve(URI.java:1028)
    at com.google.dart.compiler.UrlLibrarySource.getImportFor(UrlLibrarySource.java:46)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$LibraryWithSuppliedSources.getImportFor(DartCompilerUtilities.java:293)
    at com.google.dart.compiler.DartCompiler$Compiler.updateLibraries(DartCompiler.java:359)
    at com.google.dart.compiler.DartCompiler$Compiler.updateAndResolve(DartCompiler.java:202)
    at com.google.dart.compiler.DartCompiler$Compiler.access$4(DartCompiler.java:193)
    at com.google.dart.compiler.DartCompiler.analyzeLibrary(DartCompiler.java:1184)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:770)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:433)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:93)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:753)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:735)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:699)
    at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2010)
    at com.google.dart.tools.ui.internal.text.editor.DartElementHyperlinkDetector.internalDetectHyperlinks(DartElementHyperlinkDetector.java:76)
    at com.google.dart.tools.ui.internal.text.editor.DartElementHyperlinkDetector.detectHyperlinks(DartElementHyperlinkDetector.java:47)
    at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:286)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:258)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:462)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:211)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3971)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3610)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at com.google.dart.tools.deploy.DartIDEApplication.start(DartIDEApplication.java:44)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.net.URISyntaxException: Expected scheme-specific part at index 5: file:
    at java.net.URI$Parser.fail(URI.java:2809)
    at java.net.URI$Parser.failExpecting(URI.java:2815)
    at java.net.URI$Parser.parse(URI.java:3018)
    at java.net.URI.<init>(URI.java:578)
    at java.net.URI.create(URI.java:840)
    ... 50 more


While the code is clearly illegal, we need to gracefully handle this kind of error. This is likely a problem with other kinds of directives as well.

@DartBot
Copy link

DartBot commented Dec 7, 2011

This comment was originally written by zundel@google.com


Got a patch up for this.

http://codereview.chromium.org/8855010

Here's the new output:

zundel/ill.dart:2: Could not parse import: file:
     1: #import('dart:html');
     2: #import('file:');


cc @scheglov.
Set owner to zundel@google.com.
Added Started label.

@DartBot
Copy link

DartBot commented Dec 7, 2011

This comment was originally written by zundel@google.com


r2197


Added Fixed label.

copybara-service bot pushed a commit that referenced this issue Jun 14, 2022
Changes:
```
> git log --format="%C(auto) %h %s" 2993ea5..0c22930
 https://dart.googlesource.com/http.git/+/0c22930 Add browser support for response header tests. (#716)
 https://dart.googlesource.com/http.git/+/9f1416e A browser tests for request headers. (#715)
 https://dart.googlesource.com/http.git/+/557d9a3 Support executing tests when run as a package (#714)
 https://dart.googlesource.com/http.git/+/2b4f988 Set async min version to match pinned flutter version (#713)
 https://dart.googlesource.com/http.git/+/a479221 Add browser tests for the response body. (#712)
 https://dart.googlesource.com/http.git/+/0e20ff9 Run the request body tests against the browser client. (#711)
 https://dart.googlesource.com/http.git/+/c09fb1d Run the redirect tests against the browser client. (#708)
 https://dart.googlesource.com/http.git/+/2f723b0 Use the Uri.http constructor in docs and tests (#707)
 https://dart.googlesource.com/http.git/+/346f25d add a LICENSE file; tweaks to the readmes (#709)
 https://dart.googlesource.com/http.git/+/9700bb0 Add a conformance test package for http Clients (#706)
 https://dart.googlesource.com/http.git/+/ae8a9a8 Fix the repository page for monorepoization (#705)
 https://dart.googlesource.com/http.git/+/06649af Mono (#704)

```

Diff: https://dart.googlesource.com/http.git/+/2993ea5dff5ffb066b4a35c707e7a2b8dcfa17c2~..0c2293062d7c1fa472f299da764a7dbb3895ee22/
Change-Id: I967ccd6cc1fda757696099ededc53dbbf942e6a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248351
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
copybara-service bot pushed a commit that referenced this issue Nov 2, 2023
…lob, http_multi_server, http_parser, json_rpc_2, mockito, native, package_config, pool, sync_http, usage, webkit_inspection_protocol

Revisions updated by `dart tools/rev_sdk_deps.dart`.

args (https://github.com/dart-lang/args/compare/df9b428..46d5033):
  46d5033  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#258)
  5f7c8b5  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#259)

bazel_worker (https://github.com/dart-lang/bazel_worker/compare/b1b6a66..3d9cd58):
  3d9cd58  2023-11-02  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#83)
  1d7bed3  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#84)

benchmark_harness (https://github.com/dart-lang/benchmark_harness/compare/59aea95..e59f675):
  e59f675  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#96)
  1899e39  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#95)

collection (https://github.com/dart-lang/collection/compare/d27bfaf..e8d7e92):
  e8d7e92  2023-11-02  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#318)
  1f5c234  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#319)

file (https://github.com/google/file.dart/compare/e7c03aa..cd3a932):
  cd3a932  2023-11-01  dependabot[bot]  Bump actions/checkout from 3.6.0 to 4.1.1 (#232)

glob (https://github.com/dart-lang/glob/compare/0046533..7c9a121):
  7c9a121  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#86)
  713142b  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#85)

http_multi_server (https://github.com/dart-lang/http_multi_server/compare/03041aa..2238a6b):
  2238a6b  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#60)

http_parser (https://github.com/dart-lang/http_parser/compare/c557f57..1cf5b7c):
  1cf5b7c  2023-11-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#80)
  cb6f142  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#81)

json_rpc_2 (https://github.com/dart-lang/json_rpc_2/compare/0521afb..460545c):
  460545c  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#105)
  189b1a8  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#106)

mockito (https://github.com/dart-lang/mockito/compare/b7d752e..fcb9779):
  fcb9779  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#713)
  1c4a6ff  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#712)

native (https://github.com/dart-lang/native/compare/de9d59e..c72ed16):
  c72ed16  2023-11-01  Daco Harkes  [native_toolchain_c] Bump version to 0.3.2 (#184)
  4c9a50f  2023-11-01  Daco Harkes  [native_toolchain_c] Add workaround for minSdkVersion 19 and 20 (#181)
  45b5e6c  2023-11-01  Daco Harkes  [infra] Bump NDK version (#183)

package_config (https://github.com/dart-lang/package_config/compare/100533d..33dd246):
  33dd246  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#144)
  30c8f25  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#143)

pool (https://github.com/dart-lang/pool/compare/c78cef4..3c1bd42):
  3c1bd42  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#77)

sync_http (https://github.com/dart-lang/sync_http/compare/8233f74..d8e9f3d):
  d8e9f3d  2023-11-01  dependabot[bot]  Bump actions/checkout from 3.6.0 to 4.1.1 (#40)
  c59b6d4  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.0 to 1.6.0 (#41)

usage (https://github.com/dart-lang/usage/compare/d7d2964..e99690a):
  e99690a  2023-11-02  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (#201)
  a540a6d  2023-11-01  dependabot[bot]  Bump actions/checkout from 4.1.0 to 4.1.1 (#200)

webkit_inspection_protocol (https://github.com/google/webkit_inspection_protocol.dart/compare/2c6f8b6..667c55e):
  667c55e  2023-11-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.0 to 1.6.0 (#113)

Change-Id: Ie6f2f0df0060cd77b9d56dc40172c134605417e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants