Community
Participate
Working Groups
It seems that sporadically when I paste something into a Text object, the entier application will exit with this exception: Exception in thread "main" org.eclipse.core.internal.runtime.AssertionFailedException: assertion failed: The application has not been initialized. at org.eclipse.core.internal.runtime.Assert.isTrue(Assert.java:101) at org.eclipse.core.internal.runtime.InternalPlatform.assertInitialized(InternalPlatform.java:180) at org.eclipse.core.internal.runtime.InternalPlatform.getPluginRegistry(InternalPlatform.java:399) at org.eclipse.core.internal.runtime.InternalPlatform.getRuntimePlugin(InternalPlatform.java:420) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:431) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:891) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:157) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1290) at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection(StructuredViewer.java:625) at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:813) at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:859) at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:821) at org.eclipse.jface.viewers.TableViewer.inputChanged(TableViewer.java:398) at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:238) at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:991) at net.sourceforge.wohenchan.WoHenChan.clearOutput(WoHenChan.java:645) at net.sourceforge.wohenchan.WoHenChan.autodetect(WoHenChan.java:425) at net.sourceforge.wohenchan.WoHenChan.access$000(WoHenChan.java:101) at net.sourceforge.wohenchan.WoHenChan$4.modifyText(WoHenChan.java:329) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:183) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:913) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:918) at org.eclipse.swt.widgets.Text.gtk_changed(Text.java:801) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1127) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2074) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:631) at org.eclipse.swt.internal.gtk.OS.gtk_main_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1428) at net.sourceforge.wohenchan.WoHenChan.main(WoHenChan.java:775) The main loop of the program looks like this: Shell s = new Shell(display); ... s.pack(); s.open(); while (!s.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } and clearOutput at WoHenChan.java:645 looks like: private void clearOutput() { m_results.setSize(0); m_outputList.setInput (null); }
I assume that an assertion failure is analagous to "Crash" as described in the Severity help, so I'm marking this "critical". I should mention that this happens about 30% of the time that I paste something into this text field. I am pasting with ^V. Is there some kind of function I can call to ensure that the "Application" has been initialized? Is there any kind of code that I should add to aid debugging?
I backed my changes out and re-applied them one by one to find out which one was to blame for the onset of this bug's symptoms. It was this change. m_outputList is an inaccurately named TableViewer -- the one, in fact, that is having its inputChanged method called through StricturedViewer.setInput(). --- WoHenChan.java 22 May 2003 02:59:51 -0000 1.80 +++ WoHenChan.java 22 May 2003 04:04:33 -0000 @@ -341,14 +341,24 @@ m_outputList.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged (SelectionChangedEvent evt) { - System.err.println ("Selected TODO"); -// List widget = (List) evt.widget; -// System.err.println( -// widget.getItem(widget.getSelectionIndex())); + Object selected = ((IStructuredSelection)evt.getSelection()) + .getFirstElement(); + try + { + setStatus (((ConverterEntryInterface) selected).getUnicode()); + } + catch (NoRepresentationException e) + { + setStatus ("No Unicode"); + } + catch (UnknownOutputException e) + { + setStatus ("No Unicode"); + } } });
Looks like JFace to me.
Is this a plugin you are writing for the Eclipse SDK? Or are you writing a standalone application using only SWT and JFace (and nothing else from the Eclipse SDK)?
Got confirmation from Core team that this assertion failure is due to using JFace outside of Eclipse (i.e as standalone SWT and JFace app). The problem is your listener is sometimes failing when run, causing the handleException block to execute internally. Core requires the Eclipse application to be initialized to proceed. That cannot be done when JFace is run outside of Eclipse. You can solve this particular problem by determining what is causing the exception in your listener. Then fixing your code so it does not fail anymore. We have no plans to make JFace not depended on Core runtime services. Nothing else we can do for this issue.
Hi all, I've actually probably found a solution (at least works for me!) => when you add a selectionChangeListener to your treeViewer (or structured Viewer for all it matters), the tv.setInput(...) generates a selectionChangeEvent =>in the method do this: SeleciontChanged(SelectionChangeEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); //DO NOT FORGET THIS OR IT WILL GENERATE THE ASSERTIONFAILEDEXCEPTION if (!selection.IsEmpty()) { (...) } } This solves it for me in a standalone application using SWT and JFace... Hope it works for others. Leroy Sébastien
tod please verify that this is fixed
JFace still depends on Core runtime in 3.0.