DESCRIPTION

tmf: Fix simple resource leak warnings

Many warnings left in ControlFlow and Resource Views, where they
get a reference to a (closeable) analysis module, and then the
compiler expects them to close it.

Since the view don't really use the module for anything other than
getting the state system, we could provide a utility class to get
the state system from an analysis module directly, without leaking
references. Shouldn't be hard to do, but outside of the scope of
this patch.

At some point we should revisit the ITmfTrace#getAnalysisModule(s)
methods. Maybe it is not such a good idea to expose closeable objects
publicly.

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


COMMENTS

author: Braxton Mccarthy
date: 2014-06-17 18:30:34.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2014-06-17 19:51:40.000000000

Patch Set 2:

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

-------------------------------------
author: Brenden Conley
date: 2014-06-17 20:35:13.000000000

Patch Set 2: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/7397/ : FAILURE

-------------------------------------
author: Brenden Conley
date: 2014-06-19 01:34:47.000000000

Patch Set 2: -Verified

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

-------------------------------------
author: Brenden Conley
date: 2014-06-19 02:34:50.000000000

Patch Set 2: Verified+1

Build Successful 

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

-------------------------------------
author: Annalise Jimenez
date: 2014-06-19 13:38:50.000000000

Patch Set 2: Code-Review-1

(2 comments)

We're stuck with the autocloseable modules at least for all 3.x, so we might as well solve some of those warnings :p

Just 2 small comments for tests that will not fail. When that is corrected, you have my +1

Line:142, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/analysis/AnalysisModuleHelperTest.java -> Same comment as below

Line:161, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/analysis/AnalysisModuleHelperTest.java -> If there is an exception, this code will not run, the test will pass while it should fail. At least the assertNull(exception) should be moved outside the try.

-------------------------------------
author: Braxton Mccarthy
date: 2014-06-19 18:38:04.000000000

Patch Set 2:

(1 comment)

Line:161, lttng/org.eclipse.linuxtools.tmf.core.tests/src/org/eclipse/linuxtools/tmf/core/tests/analysis/AnalysisModuleHelperTest.java -> hmm, that's a weird way to do it... You can just have a test method throw the exception, if it's not expected it will fail the test, and you will get the complete call stack in the failure report.

If you want to expect an exception (like the second case here), you can do

 xxx@xxx.xxx

and the test will *fail* if this exception is not received.

Any way, food for thought, I'll just keep it as it is for now.

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