cvs commit: logging-log4net/src/Core LoggingEvent.cs

2005-04-03 Thread nicko
nicko   2005/04/03 11:07:17

  Modified:src/Core LoggingEvent.cs
  Log:
  Fix for LOG4NET-21. Remove from fixedProperties any key-value pairs where the 
key or value (or fixed value) is null
  
  Revision  ChangesPath
  1.20  +17 -8 logging-log4net/src/Core/LoggingEvent.cs
  
  Index: LoggingEvent.cs
  ===
  RCS file: /home/cvs/logging-log4net/src/Core/LoggingEvent.cs,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- LoggingEvent.cs   28 Jan 2005 20:47:28 -  1.19
  +++ LoggingEvent.cs   3 Apr 2005 18:07:17 -   1.20
  @@ -1281,19 +1281,28 @@
   
PropertiesDictionary fixedProperties = new 
PropertiesDictionary();
   
  - // Fix any IFixingRequired objects
  + // Validate properties
foreach(DictionaryEntry entry in 
flattenedProperties)
{
  - string key = (string)entry.Key;
  - object val = entry.Value;
  + string key = entry.Key as string;
   
  - IFixingRequired fixingRequired = val as 
IFixingRequired;
  - if (fixingRequired != null)
  + if (key != null)
{
  - val = 
fixingRequired.GetFixedObject();
  - }
  + object val = entry.Value;
   
  - fixedProperties[key] = val;
  + // Fix any IFixingRequired 
objects
  + IFixingRequired fixingRequired 
= val as IFixingRequired;
  + if (fixingRequired != null)
  + {
  + val = 
fixingRequired.GetFixedObject();
  + }
  +
  + // Strip keys with null values
  + if (val != null)
  + {
  + fixedProperties[key] = 
val;
  + }
  + }
}
   
m_data.Properties = fixedProperties;
  
  
  


[jira] Resolved: (LOG4NET-21) RemotingAppender failes once NDC becomes empty

2005-04-03 Thread Nicko Cadell (JIRA)
 [ http://issues.apache.org/jira/browse/LOG4NET-21?page=history ]
 
Nicko Cadell resolved LOG4NET-21:
-

 Resolution: Fixed
Fix Version: 1.2.10

Fixed by not serialising key-value pairs from the LoggingEvent Properties if 
the key or value is null.

 RemotingAppender failes once NDC becomes empty
 --

  Key: LOG4NET-21
  URL: http://issues.apache.org/jira/browse/LOG4NET-21
  Project: Log4net
 Type: Bug
   Components: Core
 Versions: 1.2.9
 Reporter: Nicko Cadell
 Assignee: Nicko Cadell
 Priority: Critical
  Fix For: 1.2.10


 If an NDC, or any form of Context.Stack, is set on the current thread and 
 then becomes empty the RemotingAppender will fail. This is caused by the 
 LoggingEvent Properties failing to serialise due to an unexpected null value 
 in the properties map.
 The issue is caused by the GetObjectData method of 
 log4net.Util.ReadOnlyPropertiesDictionary not coping with null values.
 Issue reported by Sam Smoot.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira