Author: nicko
Date: Sun Oct 30 17:07:59 2005
New Revision: 329689

URL: http://svn.apache.org/viewcvs?rev=329689&view=rev
Log:
LOG4NET-52 Allow XML configurator to set properties of type Object.
Fixed check for Level type that was too wide; it matched Object when it should 
not have. Level is a sealed type so an equals check on the type is all that is 
required.
Fixed conversion of String to Object. There is an implicit conversion because 
it is a supertype, but the code in OptionConverter did not account for this.

Modified:
    logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs
    logging/log4net/trunk/src/Util/OptionConverter.cs

Modified: 
logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs
URL: 
http://svn.apache.org/viewcvs/logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs?rev=329689&r1=329688&r2=329689&view=diff
==============================================================================
--- logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs 
(original)
+++ logging/log4net/trunk/src/Repository/Hierarchy/XmlHierarchyConfigurator.cs 
Sun Oct 30 17:07:59 2005
@@ -879,7 +879,7 @@
                protected object ConvertStringTo(Type type, string value)
                {
                        // Hack to allow use of Level in property
-                       if (type.IsAssignableFrom(typeof(Level)))
+                       if (typeof(Level) == type)
                        {
                                // Property wants a level
                                Level levelValue = m_hierarchy.LevelMap[value];

Modified: logging/log4net/trunk/src/Util/OptionConverter.cs
URL: 
http://svn.apache.org/viewcvs/logging/log4net/trunk/src/Util/OptionConverter.cs?rev=329689&r1=329688&r2=329689&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/OptionConverter.cs (original)
+++ logging/log4net/trunk/src/Util/OptionConverter.cs Sun Oct 30 17:07:59 2005
@@ -271,7 +271,7 @@
                        }
 
                        // If we want a string we already have the correct type
-                       if (target == typeof(string))
+                       if (typeof(string) == target || typeof(object) == 
target)
                        {
                                return txt;
                        }


Reply via email to