You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by dp...@apache.org on 2017/11/09 17:24:07 UTC

logging-log4net git commit: Fix regression in the ReadOnlyPropertiesDictionary (fixes LOG4NET-581)

Repository: logging-log4net
Updated Branches:
  refs/heads/develop 33d074993 -> 68aaff9a4


Fix regression in the ReadOnlyPropertiesDictionary (fixes LOG4NET-581)

The patch moves the null check condition to a better place and now prevents
NullReferenceException's to be thrown. Thanks go to Vlad Lee who kindly
provided the patch.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4net/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4net/commit/68aaff9a
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4net/tree/68aaff9a
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4net/diff/68aaff9a

Branch: refs/heads/develop
Commit: 68aaff9a4cd8ad69480a673ba639557078961165
Parents: 33d0749
Author: Dominik Psenner <dp...@apache.org>
Authored: Thu Nov 9 18:19:42 2017 +0100
Committer: Dominik Psenner <dp...@apache.org>
Committed: Thu Nov 9 18:19:42 2017 +0100

----------------------------------------------------------------------
 src/Util/ReadOnlyPropertiesDictionary.cs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4net/blob/68aaff9a/src/Util/ReadOnlyPropertiesDictionary.cs
----------------------------------------------------------------------
diff --git a/src/Util/ReadOnlyPropertiesDictionary.cs b/src/Util/ReadOnlyPropertiesDictionary.cs
index e7e0fe1..3efa0a9 100644
--- a/src/Util/ReadOnlyPropertiesDictionary.cs
+++ b/src/Util/ReadOnlyPropertiesDictionary.cs
@@ -216,13 +216,18 @@ namespace log4net.Util
 				string entryKey = entry.Key as string;
 				object entryValue = entry.Value;
 
+				if (entryKey == null || entryValue == null)
+				{
+					continue;
+				}
+
 				// If value is serializable then we add it to the list
 #if NETSTANDARD1_3
 				bool isSerializable = entryValue.GetType().GetTypeInfo().IsSerializable;
 #else
 				bool isSerializable = entryValue.GetType().IsSerializable;
 #endif
-				if (entryKey != null && entryValue != null && isSerializable)
+				if (isSerializable)
 				{
 					// Store the keys as an Xml encoded local name as it may contain colons (':')
 					// which are NOT escaped by the Xml Serialization framework.