wip arg checks

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

Branch: refs/heads/ignite-2324
Commit: b33534a5f641246ce105fd4815db6035ba3252f2
Parents: d615407
Author: Pavel Tupitsyn <ptupit...@gridgain.com>
Authored: Wed Jan 13 20:50:29 2016 +0300
Committer: Pavel Tupitsyn <ptupit...@gridgain.com>
Committed: Wed Jan 13 20:50:29 2016 +0300

----------------------------------------------------------------------
 .../dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs         | 6 +++++-
 .../dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs        | 7 ++++++-
 .../Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs       | 5 +++++
 .../dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs   | 3 +++
 .../Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs     | 4 +++-
 .../dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs | 3 +++
 .../dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs     | 3 +++
 7 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
index 69dc7ee..0e3c887 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Cache.Query
     using System.Diagnostics.CodeAnalysis;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Cache;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// SQL Query.
@@ -46,7 +47,7 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <param name="local">Whether query should be executed 
locally.</param>
         /// <param name="args">Arguments.</param>
         public SqlQuery(Type queryType, string sql, bool local, params 
object[] args) 
-            : this(queryType.Name, sql, local, args)
+            : this(queryType == null ? null : queryType.Name, sql, local, args)
         {
             // No-op.
         }
@@ -71,6 +72,9 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <param name="args">Arguments.</param>
         public SqlQuery(string queryType, string sql, bool local, params 
object[] args)
         {
+            IgniteArgumentCheck.NotNullOrEmpty("queryType", queryType);
+            IgniteArgumentCheck.NotNullOrEmpty("sql", sql);
+
             QueryType = queryType;
             Sql = sql;
             Local = local;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
index 8c7880f..e77d6e3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Cache.Query
     using System;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Cache;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Text query.
@@ -42,7 +43,8 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <param name="queryType">Type.</param>
         /// <param name="text">Text.</param>
         /// <param name="local">Whether query should be executed 
locally.</param>
-        public TextQuery(Type queryType, string text, bool local) : 
this(queryType.Name, text, local)
+        public TextQuery(Type queryType, string text, bool local)
+            : this(queryType == null ? null : queryType.Name, text, local)
         {
             // No-op.
         }
@@ -65,6 +67,9 @@ namespace Apache.Ignite.Core.Cache.Query
         /// <param name="local">Whether query should be executed 
locally.</param>
         public TextQuery(string queryType, string text, bool local)
         {
+            IgniteArgumentCheck.NotNullOrEmpty("queryType", queryType);
+            IgniteArgumentCheck.NotNullOrEmpty("text", text);
+
             QueryType = queryType;
             Text = text;
             Local = local;

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
index fe0aeaa..d9ad024 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Cache.Store
     using System;
     using System.Collections;
     using System.Linq;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Cache storage convenience adapter. It provides default implementation 
for 
@@ -74,6 +75,8 @@ namespace Apache.Ignite.Core.Cache.Store
         /// <param name="entries">The map.</param>
         public virtual void WriteAll(IDictionary entries)
         {
+            IgniteArgumentCheck.NotNull(entries, "entries");
+
             foreach (DictionaryEntry entry in entries)
                 Write(entry.Key, entry.Value);
         }
@@ -97,6 +100,8 @@ namespace Apache.Ignite.Core.Cache.Store
         /// the keys that were not successfully deleted.</param>
         public virtual void DeleteAll(ICollection keys)
         {
+            IgniteArgumentCheck.NotNull(keys, "keys");
+
             foreach (object key in keys)
                 Delete(key);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
index db2ab51..efd2778 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
@@ -21,6 +21,7 @@ namespace Apache.Ignite.Core.Compute
     using System.Collections.Generic;
     using Apache.Ignite.Core.Cluster;
     using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Convenience adapter for <see 
cref="IComputeTask{TArg,TJobRes,TTaskRes}"/> interface
@@ -45,6 +46,8 @@ namespace Apache.Ignite.Core.Compute
         public virtual ComputeJobResultPolicy 
OnResult(IComputeJobResult<TJobRes> res,
             IList<IComputeJobResult<TJobRes>> rcvd)
         {
+            IgniteArgumentCheck.NotNull(res, "res");
+
             Exception err = res.Exception;
 
             if (err != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
index e08af92..2348844 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
@@ -22,6 +22,7 @@ namespace Apache.Ignite.Core.Compute
     using Apache.Ignite.Core.Cluster;
     using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl;
+    using Apache.Ignite.Core.Impl.Common;
     using Apache.Ignite.Core.Impl.Compute;
 
     /// <summary>
@@ -63,7 +64,8 @@ namespace Apache.Ignite.Core.Compute
         /// <exception cref="IgniteException">Split returned no 
jobs.</exception>
         override public IDictionary<IComputeJob<TJobRes>, IClusterNode> 
Map(IList<IClusterNode> subgrid, TArg arg)
         {
-            Debug.Assert(subgrid != null && subgrid.Count > 0);
+            IgniteArgumentCheck.NotNull(subgrid, "subgrid");
+            IgniteArgumentCheck.Ensure(subgrid.Count > 0, "subgrid", "subgrid 
should not be empty");
 
             var jobs = Split(subgrid.Count, arg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
index d50e9b1..dcdf6d6 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
@@ -52,6 +52,9 @@ namespace Apache.Ignite.Core.Datastream
         /** <inheritdoc /> */
         public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, 
TV>> entries)
         {
+            IgniteArgumentCheck.NotNull(cache, "cache");
+            IgniteArgumentCheck.NotNull(entries, "entries");
+
             var keys = new List<TK>(entries.Count);
 
             foreach (var entry in entries)

http://git-wip-us.apache.org/repos/asf/ignite/blob/b33534a5/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
index 5d155d7..f5990b6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
@@ -48,6 +48,9 @@ namespace Apache.Ignite.Core.Datastream
         /** <inheritdoc /> */
         public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, 
TV>> entries)
         {
+            IgniteArgumentCheck.NotNull(cache, "cache");
+            IgniteArgumentCheck.NotNull(entries, "entries");
+
             foreach (var entry in entries)
                 _action(cache, entry);
         }

Reply via email to