siddharthb / Kide

Kide- The Kappa IDE for Eclipse
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Executing bin fails with 'Unhandled event loop exception' #22

Open donal-s opened 13 years ago

donal-s commented 13 years ago

After creating a bin file 'a1' in project 'testproject', the Kappa Binaries View shows an entry for a1.bin [/testproject/]. However selecting 'Load binary...' (with options of 1000 events) causes the following error message:

java.lang.StringIndexOutOfBoundsException: String index out of range: -6 at java.lang.String.substring(String.java:1937) at fr.jussieu.pps.keditor.wizards.SimulateWizard.performFinish(SimulateWizard.java:78) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at fr.jussieu.pps.keditor.views.KappaBinariesView$4.run(KappaBinariesView.java:395) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) 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:369) 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:620) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

donal-s commented 12 years ago

Ok, looking at this issue again. The problem seems to be the expectation of there being a '/' path separator in the command path. This isn't the case on Linux (or OSX I imagine). Nor would it be the case if the KaSim binaries were in the current directory. spawn.main(path,workbench.getActiveWorkbenchWindow(),model.commandLine,path.substring(path.lastIndexOf(' '),path.lastIndexOf('/')+1)+model.outfile);

I'd suggest manipulating external binaries as File objects, then file.getParent(), or file.getName() will separate the components when needed.

btw - lastIndexOf('/') occurs in 24 places in the codebase... gotta get them all :)