processing / processing-android-archive

96 stars 50 forks source link

Exception thrown in Android mode on right-click->Find in Reference #66

Closed GKFX closed 10 years ago

GKFX commented 10 years ago

Opening Processing in Android mode, typing/pasting the sketch below, selecting ellipse, and clicking right-click->Find in Reference gave an error dialog ("Could not open...") and the following stack trace.

void setup() {
  size(300, 300);
}

void draw() {
  ellipse(
}
java.net.URISyntaxException: Illegal character in authority at index 7: file://C:\Program Files (dev)\Processing\build\windows\work\modes\java\reference\ellipse_.html
    at java.net.URI$Parser.fail(Unknown Source)
    at java.net.URI$Parser.parseAuthority(Unknown Source)
    at java.net.URI$Parser.parseHierarchical(Unknown Source)
    at java.net.URI$Parser.parse(Unknown Source)
    at java.net.URI.<init>(Unknown Source)
    at processing.app.Platform.openURL(Platform.java:115)
    at processing.app.Base.openURL(Base.java:1956)
    at processing.mode.android.AndroidEditor.showReference(AndroidEditor.java:192)
    at processing.app.Editor.handleFindReference(Editor.java:1997)
    at processing.app.Editor$TextAreaPopup$9.actionPerformed(Editor.java:2669)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Pasting the URL from the stack trace into Firefox worked, but it auto-corrected it to file:///C:/Program%20Files%20%28dev%29/Processing/build/windows/work/modes/java/reference/ellipse_.html. (Extra slash at start and backslashes to forward-slashes). No similar bug was observed in Java mode. Windows XP SP3.

anotech commented 10 years ago

I got the same problem and the same error message. Win7 32bit processing 2.2.1 Android mode (ON Java mode no problem)

GKFX commented 10 years ago

I'm on it!

GKFX commented 10 years ago

OK, I don't have a Windows in front of me but I'm guessing Base.openURL("file://" + file.getAbsolutePath()); needs to be replaced with Base.openURL(file.toURI().toString());, because we're currently missing some single character, and Java's libraries can do the whole thing for us.

GKFX commented 10 years ago

We're at processing/processing-android#51 now.