You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/03/27 12:05:38 UTC
stratos git commit: Fixing LifeCycleStateManager.getPreviousState()
method to avoid array index out of bound exception
Repository: stratos
Updated Branches:
refs/heads/master ce6831e42 -> 427d66ef5
Fixing LifeCycleStateManager.getPreviousState() method to avoid array index out of bound exception
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/427d66ef
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/427d66ef
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/427d66ef
Branch: refs/heads/master
Commit: 427d66ef5651ec224ff09a8dc05f7f2a2451db1d
Parents: ce6831e
Author: Imesh Gunaratne <im...@apache.org>
Authored: Fri Mar 27 16:35:00 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Mar 27 16:35:32 2015 +0530
----------------------------------------------------------------------
.../domain/topology/lifecycle/LifeCycleStateManager.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/427d66ef/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
index 9d125cf..fd09de5 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
@@ -127,7 +127,11 @@ public class LifeCycleStateManager<T extends LifeCycleState> implements Serializ
* @return previous state
*/
public T getPreviousState() {
- return stateStack.get(stateStack.size() - 2);
+ int index = stateStack.size() - 2;
+ if((index >= 0) && (index < stateStack.size())) {
+ return stateStack.get(index);
+ }
+ return null;
}
/**