1 Reply Latest reply on May 30, 2007 6:56 PM by ToneDeF71

    Bug in com.adobe.flexbuilder.project.internal.FlexProject?

    ToneDeF71
      I believe that I found a bug in com.adobe.flexbuilder.project.internal.FlexProject.

      I'm using a URL for my flex application that has no web context (i.e. http://localhost:8080/). When I try to launch the application from FlexBuilder 2, a dialog box pops up with the generic error message: "An internal error occurred during: Launching".

      The stack trace is as follows:

      java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      at java.lang.String.charAt(Unknown Source)
      at com.adobe.flexbuilder.project.internal.FlexProject.trimSeparators(Unknown Source)
      at com.adobe.flexbuilder.project.internal.FlexProject.getDefaultLaunchURL(Unknown Source)
      at com.adobe.flexbuilder.debug.launching.FlexLaunchConfiguration.getDefaultLaunchURL(FlexLau nchConfiguration.java:157)
      at com.adobe.flexbuilder.debug.launching.FlexLaunchConfiguration.getLaunchURL(FlexLaunchConf iguration.java:136)
      at com.adobe.flexbuilder.debug.launching.AbstractFlexLaunchDelegate.preLaunchCheck(AbstractF lexLaunchDelegate.java:420)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:607)
      at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:565)
      at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:754)
      at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(DebugUIPlugin.java:944)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

      Also, if I try to edit an existing launch configuration, a dialog box appears with the generic error message: "Problems occurred when invoking code from plug-in: org.eclipse.jface"

      The stack trace is as follows:

      java.lang.StringIndexOutOfBoundsException: String index out of range: 0
      at java.lang.String.charAt(Unknown Source)
      at com.adobe.flexbuilder.project.internal.FlexProject.trimSeparators(Unknown Source)
      at com.adobe.flexbuilder.project.internal.FlexProject.getDefaultLaunchURL(Unknown Source)
      at com.adobe.flexbuilder.debug.ui.launching.FlexLaunchTab.updateURLs(FlexLaunchTab.java:192)
      at com.adobe.flexbuilder.debug.ui.launching.FlexLaunchTab.abstractHandleProjectChanged(FlexL aunchTab.java:208)
      at com.adobe.flexbuilder.debug.ui.launching.AbstractFlexLaunchTab.handleProjectChanged(Abstr actFlexLaunchTab.java:546)
      at com.adobe.flexbuilder.debug.ui.launching.AbstractFlexMainTab.handleProjectChanged(Abstrac tFlexMainTab.java:124)
      at com.adobe.flexbuilder.debug.ui.launching.AbstractFlexMainTab$1.modifyText(AbstractFlexMai nTab.java:97)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:196)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:933)
      at org.eclipse.swt.widgets.Text.wmCommandChild(Text.java:2143)
      at org.eclipse.swt.widgets.Control.WM_COMMAND(Control.java:3375)
      at org.eclipse.swt.widgets.Control.windowProc(Control.java:3249)
      at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
      at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
      at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:1851)
      at org.eclipse.swt.widgets.Text.callWindowProc(Text.java:131)
      at org.eclipse.swt.widgets.Control.windowProc(Control.java:3334)
      at org.eclipse.swt.widgets.Text.windowProc(Text.java:1841)
      at org.eclipse.swt.widgets.Display.windowProc(Display.java:4025)
      at org.eclipse.swt.internal.win32.OS.SetWindowTextW(Native Method)
      at org.eclipse.swt.internal.win32.OS.SetWindowText(OS.java:2650)
      at org.eclipse.swt.widgets.Text.setText(Text.java:1657)
      at com.adobe.flexbuilder.debug.ui.launching.AbstractFlexMainTab.initializeFrom(AbstractFlexM ainTab.java:167)
      at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchCon figurationTabGroup.java:86)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.disp layInstanceTabs(LaunchConfigurationTabGroupViewer.java:655)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$6.ru n(LaunchConfigurationTabGroupViewer.java:548)
      at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inpu tChanged(LaunchConfigurationTabGroupViewer.java:565)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setI nput(LaunchConfigurationTabGroupViewer.java:529)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunc hConfigurationSelectionChanged(LaunchConfigurationsDialog.java:928)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$4.selection Changed(LaunchConfigurationsDialog.java:547)
      at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:839)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
      at org.eclipse.core.runtime.Platform.run(Platform.java:843)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
      at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java :837)
      at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1578)
      at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:384)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunc hConfigurationSelectionChanged(LaunchConfigurationsDialog.java:922)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$4.selection Changed(LaunchConfigurationsDialog.java:547)
      at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:839)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
      at org.eclipse.core.runtime.Platform.run(Platform.java:843)
      at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
      at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149)
      at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java :837)
      at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1143)
      at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1163)
      at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:236)
      at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:230)
      at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:404)
      at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
      at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
      at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
      at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
      at org.eclipse.jface.window.Window.open(Window.java:796)
      at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(Launch ConfigurationsDialog.java:1086)
      at org.eclipse.debug.ui.DebugUITools$1.run(DebugUITools.java:383)
      at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
      at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java: 387)
      at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java: 329)
      at org.eclipse.debug.ui.actions.LaunchAction.runWithEvent(LaunchAction.java:79)
      at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionI tem.java:539)
      at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
      at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java :400)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
      at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLau ncher.java:92)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.jav a:68)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
      at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
      at org.eclipse.core.launcher.Main.run(Main.java:977)
      at org.eclipse.core.launcher.Main.main(Main.java:952)

      I believe that the trimSeparators method needs to be more robust:

      private String trimSeparators(IPath ipath) {
      ipath = ipath.removeTrailingSeparator();
      String s = ipath.toString();
      if (s.charAt(0) == '/')
      s = s.substring(1);
      return s;
      }

      I believe that there should be a check to see if the string variable is null or empty before calling the charAt() method on it.
        • 1. Re: Bug in com.adobe.flexbuilder.project.internal.FlexProject?
          ToneDeF71 Level 1
          I forgot to mention that the exception described above occurred in the FlexBuilder plug-in for Eclipse. Unfortunately, the same exception is also thrown in the stand-alone version of FlexBuilder:

          java.lang.StringIndexOutOfBoundsException: String index out of range: 0
          at java.lang.String.charAt(Unknown Source)
          at com.adobe.flexbuilder.project.internal.FlexProject.trimSeparators(Unknown Source)
          at com.adobe.flexbuilder.project.internal.FlexProject.getDefaultLaunchURL(Unknown Source)
          at com.adobe.flexbuilder.debug.launching.FlexLaunchConfigurationWorkingCopy.populateDefaultL aunchConfiguration(FlexLaunchConfigurationWorkingCopy.java:111)
          at com.adobe.flexbuilder.debug.ui.launching.FlexLaunchShortcut.createConfigurationWorkingCop y(FlexLaunchShortcut.java:309)
          at com.adobe.flexbuilder.standalone.actions.LaunchApplicationAction.<init>(LaunchApplication Action.java:53)
          at com.adobe.flexbuilder.standalone.actions.AbstractLaunchAction.run(AbstractLaunchAction.ja va:108)
          at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:246)
          at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:223)
          at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionI tem.java:538)
          at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
          at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java :400)
          at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
          at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
          at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3125)
          at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2758)
          at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
          at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
          at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
          at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
          at com.adobe.flexbuilder.standalone.FlexBuilderApplication.run(FlexBuilderApplication.java:1 03)
          at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
          at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
          at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
          at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
          at org.eclipse.core.launcher.Main.run(Main.java:973)
          at org.eclipse.core.launcher.Main.main(Main.java:948)