Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357893 - [LTTng] maximize and restore Events view caused (java.lang.ArithmeticException: / by zero)
Summary: [LTTng] maximize and restore Events view caused (java.lang.ArithmeticExceptio...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: LinuxTools (show other bugs)
Version: unspecified   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Francois Chouinard CLA
QA Contact: Francois Chouinard CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-15 19:23 EDT by Yufen Kuo CLA
Modified: 2022-01-13 14:52 EST (History)
0 users

See Also:


Attachments
Fix (2.97 KB, patch)
2011-09-19 17:06 EDT, Francois Chouinard CLA
fchouinard: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yufen Kuo CLA 2011-09-15 19:23:33 EDT
Build Identifier: I20110613-1736

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArithmeticException: / by zero)
	at org.eclipse.swt.SWT.error(SWT.java:4282)
	at org.eclipse.swt.SWT.error(SWT.java:4197)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
	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 org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	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.lang.ArithmeticException: / by zero
	at org.eclipse.linuxtools.lttng.ui.views.histogram.HistogramDataModel.scaleTo(HistogramDataModel.java:221)
	at org.eclipse.linuxtools.lttng.ui.views.histogram.Histogram$1.run(Histogram.java:383)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	... 23 more

Reproducible: Always

Steps to Reproduce:
1.Create LTTng project
2.Import some trace files
3.double click on the imported trace to display the traces
4.Maximize the Events view, then restore the view
5.You will now receive the SWTException on ava.lang.ArithmeticException: / by zero
	at org.eclipse.linuxtools.lttng.ui.views.histogram.HistogramDataModel.scaleTo(HistogramDataModel.java:221)
Comment 1 Francois Chouinard CLA 2011-09-19 12:55:25 EDT
I'll take this one.
Comment 2 Francois Chouinard CLA 2011-09-19 17:06:26 EDT
Created attachment 203626 [details]
Fix

Couldn't reproduce the problem in my environment but there is definitely a possibility for div by 0.

The method had assert statements to cover for this case but, in Java, you have to provide a run-time switch (-ea) to enable them.

The patch does the following:

- Replace "assert" by an an AssertionError
- Ensure that the caller validates its data before calling this method
- Added a unit test
Comment 3 Francois Chouinard CLA 2011-09-19 17:10:39 EDT
Comment on attachment 203626 [details]
Fix

Patch committed
Comment 4 Francois Chouinard CLA 2011-09-19 17:11:05 EDT
Done.
Comment 5 Yufen Kuo CLA 2011-09-21 16:17:37 EDT
I have verified the fix with latest code in master and I am no longer getting the ArithmeticException.
thanks for fixing it quickly!
Comment 6 Francois Chouinard CLA 2011-09-21 17:52:05 EDT
(In reply to comment #5)
> I have verified the fix with latest code in master and I am no longer getting
> the ArithmeticException.
> thanks for fixing it quickly!

You're welcome.
Comment 7 Francois Chouinard CLA 2012-03-26 13:56:32 EDT
Delivered in 0.9.0