Repository: ignite
Updated Branches:
  refs/heads/ignite-3199-1 99b78691b -> ebbc8903c


Fixed potential NPE on IgniteNode initialization.


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

Branch: refs/heads/ignite-3199-1
Commit: 3fb9894eb130e7e5d2fee460c785a4aacadb8373
Parents: cfdae56
Author: sboikov <sboi...@gridgain.com>
Authored: Wed Sep 14 14:02:00 2016 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Wed Sep 14 14:02:00 2016 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/yardstick/IgniteNode.java | 74 +++++++++++---------
 1 file changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3fb9894e/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index eed4450..a261b98 100644
--- 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -87,58 +87,64 @@ public class IgniteNode implements BenchmarkServer {
 
         assert appCtx != null;
 
-        for (CacheConfiguration cc : c.getCacheConfiguration()) {
-            // IgniteNode can not run in CLIENT_ONLY mode,
-            // except the case when it's used inside IgniteAbstractBenchmark.
-            boolean cl = args.isClientOnly() && (args.isNearCache() || 
clientMode);
+        CacheConfiguration[] ccfgs = c.getCacheConfiguration();
 
-            if (cl)
-                c.setClientMode(true);
+        if (ccfgs != null) {
+            for (CacheConfiguration cc : ccfgs) {
+                // IgniteNode can not run in CLIENT_ONLY mode,
+                // except the case when it's used inside 
IgniteAbstractBenchmark.
+                boolean cl = args.isClientOnly() && (args.isNearCache() || 
clientMode);
 
-            if (args.isNearCache()) {
-                NearCacheConfiguration nearCfg = new NearCacheConfiguration();
+                if (cl)
+                    c.setClientMode(true);
 
-                if (args.getNearCacheSize() != 0)
-                    nearCfg.setNearEvictionPolicy(new 
LruEvictionPolicy(args.getNearCacheSize()));
+                if (args.isNearCache()) {
+                    NearCacheConfiguration nearCfg = new 
NearCacheConfiguration();
 
-                cc.setNearConfiguration(nearCfg);
-            }
+                    if (args.getNearCacheSize() != 0)
+                        nearCfg.setNearEvictionPolicy(new 
LruEvictionPolicy(args.getNearCacheSize()));
 
-            cc.setWriteSynchronizationMode(args.syncMode());
+                    cc.setNearConfiguration(nearCfg);
+                }
 
-            if (args.orderMode() != null)
-                cc.setAtomicWriteOrderMode(args.orderMode());
+                cc.setWriteSynchronizationMode(args.syncMode());
 
-            cc.setBackups(args.backups());
+                if (args.orderMode() != null)
+                    cc.setAtomicWriteOrderMode(args.orderMode());
 
-            if (args.restTcpPort() != 0) {
-                ConnectorConfiguration ccc = new ConnectorConfiguration();
+                cc.setBackups(args.backups());
 
-                ccc.setPort(args.restTcpPort());
+                if (args.restTcpPort() != 0) {
+                    ConnectorConfiguration ccc = new ConnectorConfiguration();
 
-                if (args.restTcpHost() != null)
-                    ccc.setHost(args.restTcpHost());
+                    ccc.setPort(args.restTcpPort());
 
-                c.setConnectorConfiguration(ccc);
-            }
+                    if (args.restTcpHost() != null)
+                        ccc.setHost(args.restTcpHost());
 
-            if (args.isOffHeap()) {
-                cc.setOffHeapMaxMemory(0);
+                    c.setConnectorConfiguration(ccc);
+                }
 
-                if (args.isOffheapValues())
-                    cc.setMemoryMode(OFFHEAP_VALUES);
-                else
-                    cc.setEvictionPolicy(new LruEvictionPolicy(50000));
-            }
+                if (args.isOffHeap()) {
+                    cc.setOffHeapMaxMemory(0);
 
-            cc.setReadThrough(args.isStoreEnabled());
+                    if (args.isOffheapValues())
+                        cc.setMemoryMode(OFFHEAP_VALUES);
+                    else
+                        cc.setEvictionPolicy(new LruEvictionPolicy(50000));
+                }
 
-            cc.setWriteThrough(args.isStoreEnabled());
+                cc.setReadThrough(args.isStoreEnabled());
 
-            cc.setWriteBehindEnabled(args.isWriteBehind());
+                cc.setWriteThrough(args.isStoreEnabled());
 
-            BenchmarkUtils.println(cfg, "Cache configured with the following 
parameters: " + cc);
+                cc.setWriteBehindEnabled(args.isWriteBehind());
+
+                BenchmarkUtils.println(cfg, "Cache configured with the 
following parameters: " + cc);
+            }
         }
+        else
+            BenchmarkUtils.println(cfg, "There are no caches configured");
 
         TransactionConfiguration tc = c.getTransactionConfiguration();
 

Reply via email to