DESCRIPTION

tmf: Fix SD unit test with GTK3

Using a very recent Eclipse integration build (which now uses the GTK3 SWT
backend), one of the Sequence Diagram unit tests fails because of invalid
parameter values.

This patch fixes the test by clamping the height/width area values to 1.
It also fixes an instance of messing with Exception.

Change-Id: Idccbb3490e6a0ed9dc83c1f7582c61251ec09142
Signed-off-by: Braxton Mccarthy xxx@xxx.xxx


COMMENTS

author: Braxton Mccarthy
date: 2013-10-29 21:14:46.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2013-10-30 00:23:16.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/3793/

-------------------------------------
author: Brenden Conley
date: 2013-10-30 00:54:57.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/3793/ : SUCCESS

-------------------------------------
author: Ricky Reeves
date: 2013-10-30 14:02:42.000000000

Patch Set 2: Code-Review-1

(3 comments)

Line:1337, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java -> Good catch!

Line:1343, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java -> Shall we actually catch SWTError? We don't catch Error, Throwable or any runtime exceptions either. Also, in none of our code we catch SWTError.

I know there is a heated debate about when and if to catch Error/SWTError and I don't want to start that here.

Line:1345, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java -> returning null causes a SWTError later on in the code execution. Needs to be protected in the calling class.

-------------------------------------
author: Braxton Mccarthy
date: 2013-10-30 17:17:10.000000000

Patch Set 2:

(2 comments)

Line:1343, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java -> We used to catch Exception, which would catch SWTError. That's why I kept it here. But I'd prefer to let it pass too, it's a runtime exception, and honestly if getDisplay() doesn't work, you have much bigger problems than a unit test failing ;)

Line:1345, lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDWidget.java -> OK, I was not 100% sure here. My idea was that, before this patch, if the "new Image()" failed and an Exception was caught, dbuffer would remain null, and would be returned at the end. So this method could potentially return null already. Which is bad, I guess?

What would be better here? Prevent null from being returned, or add a check in the caller(s)?

-------------------------------------
