Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 45311200BCB for ; Wed, 9 Nov 2016 17:54:14 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 44262160AEB; Wed, 9 Nov 2016 16:54:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 921AB160AFA for ; Wed, 9 Nov 2016 17:54:13 +0100 (CET) Received: (qmail 42628 invoked by uid 500); 9 Nov 2016 16:54:12 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 42611 invoked by uid 99); 9 Nov 2016 16:54:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 16:54:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ACA65EF9A0; Wed, 9 Nov 2016 16:54:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ptupitsyn@apache.org To: commits@ignite.apache.org Date: Wed, 09 Nov 2016 16:54:13 -0000 Message-Id: In-Reply-To: <9f9e4fe1e6324c1e8b3e9abb6bc2e62a@git.apache.org> References: <9f9e4fe1e6324c1e8b3e9abb6bc2e62a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] ignite git commit: IGNITE-4185 .NET: Fix NullReferenceException in IgniteOutputCacheProvider when igniteConfiguration is missing archived-at: Wed, 09 Nov 2016 16:54:14 -0000 IGNITE-4185 .NET: Fix NullReferenceException in IgniteOutputCacheProvider when igniteConfiguration is missing Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d775ad12 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d775ad12 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d775ad12 Branch: refs/heads/master Commit: d775ad12a8eedce5d3bd80c296de76b9ca2d49b7 Parents: 986e276 Author: Pavel Tupitsyn Authored: Tue Nov 8 19:13:48 2016 +0300 Committer: Pavel Tupitsyn Committed: Wed Nov 9 19:53:44 2016 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.AspNet.Tests/App.config | 1 + .../IgniteSessionStateStoreProviderTest.cs | 21 +++++++++++++++++--- .../Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 5 +++++ 3 files changed, 24 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/d775ad12/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/App.config ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/App.config b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/App.config index 86ee3d4..7d2c1d0 100644 --- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/App.config +++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/App.config @@ -22,6 +22,7 @@
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/d775ad12/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs index 2c73359..9c3b07c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.AspNet.Tests/IgniteSessionStateStoreProviderTest.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.AspNet.Tests { using System; using System.Collections.Specialized; + using System.Configuration; using System.Linq; using System.Reflection; using System.Threading; @@ -116,14 +117,28 @@ namespace Apache.Ignite.AspNet.Tests Assert.Throws(() => stateProvider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId, out actions)); - // Invalid section. - Assert.Throws(() => + // Missing section. + var ex = Assert.Throws(() => stateProvider.Initialize("testName", new NameValueCollection { - {SectionNameAttr, "invalidSection"}, + {SectionNameAttr, "missingSection"}, {CacheNameAttr, CacheName} })); + Assert.IsInstanceOf(ex.InnerException); + + // Invalid section with missing content. + stateProvider = new IgniteSessionStateStoreProvider(); + + ex = Assert.Throws(() => + stateProvider.Initialize("testName", new NameValueCollection + { + {SectionNameAttr, "igniteConfigurationInvalid"}, + {CacheNameAttr, CacheName} + })); + + Assert.IsInstanceOf(ex.InnerException); + // Valid grid. stateProvider = GetProvider(); http://git-wip-us.apache.org/repos/asf/ignite/blob/d775ad12/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs index a162d81..fc93c7e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs +++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/ConfigUtil.cs @@ -86,6 +86,11 @@ namespace Apache.Ignite.AspNet.Impl "Could not find {0} with name '{1}'", typeof(IgniteConfigurationSection).Name, sectionName)); config = section.IgniteConfiguration; + + if (config == null) + throw new ConfigurationErrorsException(string.Format(CultureInfo.InvariantCulture, + "{0} with name '{1}' is defined in , but not present in configuration", + typeof(IgniteConfigurationSection).Name, sectionName)); } else config = new IgniteConfiguration {GridName = gridName};