DESCRIPTION

TMF: Fix IndexOutOfBoundException when querying state system

Fixes bug 432191 where the size of the stateInfo array may be smaller than
the ongoingStateInfo when the method is called. We use the size we know is the
smallest to avoid this exception to be thrown.

Change-Id: I1494940726b952ffe94560a7bed6e5764ff3d8f9
Signed-off-by: Aryana Jones xxx@xxx.xxx


COMMENTS

author: Annalise Jimenez
date: 2014-04-08 18:41:23.000000000

Uploaded patch set 1.

-------------------------------------
author: Annalise Jimenez
date: 2014-04-08 18:44:43.000000000

Patch Set 1:

This fixes the bug, but finding why there is an attribute that is added while querying the state system and preventing that might be a better long term way to go.

Unless we say we don't really care: we won't delay a write just to read coherently the values while this simple fix avoids the problem...

-------------------------------------
author: Braxton Mccarthy
date: 2014-04-08 19:09:46.000000000

Patch Set 1: Code-Review+2

I had the -1 hammer ready ;) , but after looking at it carefully I can't find any problems with this patch.

It is indeed possible that attributes get created between getNbAttributes() and a query. But since they can only be added (getNbAttributes() will never return a smaller number as time goes on), then iterating on stateInfo should be safe. There might be more new data in ongoingStateInfo, but we simply won't be querying it.

However I wonder if now it would not be simpler to just return a "snapshot" of the array (ImmutableList?!), instead of using an "out" parameter...

-------------------------------------
author: Ivy Mitchell
date: 2014-04-08 19:10:51.000000000

Patch Set 1:

(1 comment)

Line:347, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/TransientState.java -> should this be !=?

-------------------------------------
author: Annalise Jimenez
date: 2014-04-08 19:16:39.000000000

Patch Set 1:

(1 comment)

Waiting for hudson to do its job...

Line:347, lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/internal/tmf/core/statesystem/TransientState.java -> != would only throw IlllegalArgumentException instead of IndexOutOfBounds... stateInfo can have smaller size, it doesn't matter.

-------------------------------------
author: Brenden Conley
date: 2014-04-08 19:36:40.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-04-08 20:14:20.000000000

Patch Set 1: Verified+1

Build Successful 

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

-------------------------------------
author: Annalise Jimenez
date: 2014-04-09 01:50:39.000000000

Patch Set 1: Verified+1 Code-Review+2

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