fixed NPE

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2ad974e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2ad974e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2ad974e6

Branch: refs/heads/ignite-728
Commit: 2ad974e6af0767f4b639564092f9ae18116616cf
Parents: 77d092c
Author: Yakov Zhdanov <yzhda...@gridgain.com>
Authored: Wed Apr 29 13:59:30 2015 +0300
Committer: Yakov Zhdanov <yzhda...@gridgain.com>
Committed: Wed Apr 29 13:59:30 2015 +0300

----------------------------------------------------------------------
 ...gniteProjectionStartStopRestartSelfTest.java | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2ad974e6/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
 
b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
index 7fa5b4b..e175064 100644
--- 
a/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
+++ 
b/modules/ssh/src/test/java/org/apache/ignite/internal/IgniteProjectionStartStopRestartSelfTest.java
@@ -145,15 +145,21 @@ public class IgniteProjectionStartStopRestartSelfTest 
extends GridCommonAbstract
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        if (!ignite.cluster().nodes().isEmpty()) {
-            leftLatch = new CountDownLatch(ignite.cluster().nodes().size());
+        boolean wasEmpty = true;
 
-            ignite.cluster().stopNodes();
+        if (ignite != null) {
+            if (!ignite.cluster().nodes().isEmpty()) {
+                leftLatch = new 
CountDownLatch(ignite.cluster().nodes().size());
 
-            assert leftLatch.await(WAIT_TIMEOUT, MILLISECONDS);
-        }
+                ignite.cluster().stopNodes();
+
+                assert leftLatch.await(
+                    WAIT_TIMEOUT,
+                    MILLISECONDS);
+            }
 
-        boolean wasEmpty = ignite.cluster().nodes().isEmpty();
+            wasEmpty = ignite.cluster().nodes().isEmpty();
+        }
 
         G.stop(true);
 
@@ -163,7 +169,8 @@ public class IgniteProjectionStartStopRestartSelfTest 
extends GridCommonAbstract
         joinedLatch = null;
         leftLatch = null;
 
-        assert wasEmpty : "grid.isEmpty() returned false after all nodes were 
stopped [nodes=" + ignite.cluster().nodes() + ']';
+        assert wasEmpty : "grid.isEmpty() returned false after all nodes were 
stopped " +
+            "[nodes=" + ignite.cluster().nodes() + ']';
     }
 
     /** {@inheritDoc} */

Reply via email to