logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject cvs commit: logging-log4net/src/Repository/Hierarchy Hierarchy.cs
Date Sun, 19 Dec 2004 19:24:00 GMT
nicko       2004/12/19 11:24:00

  Modified:    src/Repository/Hierarchy Hierarchy.cs
  Log:
  Updates suggested by FxCop.
  Minor naming changes to internal types.
  Perf improvements to type check + type cast code.
  
  Revision  Changes    Path
  1.12      +34 -23    logging-log4net/src/Repository/Hierarchy/Hierarchy.cs
  
  Index: Hierarchy.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Repository/Hierarchy/Hierarchy.cs,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Hierarchy.cs	13 Dec 2004 02:12:20 -0000	1.11
  +++ Hierarchy.cs	19 Dec 2004 19:24:00 -0000	1.12
  @@ -510,9 +510,10 @@
   			{
   				appenderList.Add(appender);
   
  -				if (appender is IAppenderAttachable)
  +				IAppenderAttachable container = appender as IAppenderAttachable;
  +				if (container != null)
   				{
  -					CollectAppenders(appenderList, (IAppenderAttachable)appender);
  +					CollectAppenders(appenderList, container);
   				}
   			}
   		}
  @@ -704,25 +705,27 @@
   					OnLoggerCreationEvent(logger);
   					return logger;
   				} 
  -				else if (node is Logger) 
  +				
  +				Logger nodeLogger = node as Logger;
  +				if (nodeLogger != null) 
   				{
  -					return (Logger)node;
  +					return nodeLogger;
   				} 
  -				else if (node is ProvisionNode) 
  +				
  +				ProvisionNode nodeProvisionNode = node as ProvisionNode;
  +				if (nodeProvisionNode != null) 
   				{
   					logger = factory.CreateLogger(name);
   					logger.Hierarchy = this; 
   					m_ht[key] = logger;
  -					UpdateChildren((ProvisionNode)node, logger);
  +					UpdateChildren(nodeProvisionNode, logger);
   					UpdateParents(logger);	
   					OnLoggerCreationEvent(logger);
   					return logger;
   				}
  -				else 
  -				{
  -					// It should be impossible to arrive here
  -					return null;  // but let's keep the compiler happy.
  -				}
  +
  +				// It should be impossible to arrive here but let's keep the compiler happy.
  +				return null;
   			}
   		}
   
  @@ -804,20 +807,28 @@
   					ProvisionNode pn = new ProvisionNode(log);
   					m_ht[key] = pn;
   				} 
  -				else if (node is Logger) 
  -				{
  -					parentFound = true;
  -					log.Parent = (Logger)node;
  -					break; // no need to update the ancestors of the closest ancestor
  -				} 
  -				else if (node is ProvisionNode) 
  -				{
  -					((ProvisionNode)node).Add(log);
  -				} 
   				else
   				{
  -					LogLog.Error("unexpected object type ["+node.GetType()+"] in ht.", new LogException());
  -				}
  +					Logger nodeLogger = node as Logger;
  +					if (nodeLogger != null)
  +					{
  +						parentFound = true;
  +						log.Parent = nodeLogger;
  +						break; // no need to update the ancestors of the closest ancestor
  +					}
  +					else
  +					{
  +						ProvisionNode nodeProvisionNode = node as ProvisionNode;
  +						if (nodeProvisionNode != null)
  +						{
  +							nodeProvisionNode.Add(log);
  +						}
  +						else
  +						{
  +							LogLog.Error("unexpected object type ["+node.GetType()+"] in ht.", new LogException());
  +						}
  +					} 
  +				} 
   			}
   
   			// If we could not find any existing parents, then link with root.
  
  
  

Mime
View raw message