[logback-dev] svn commit: r855 - in logback/trunk/logback-core/src: main/java/ch/qos/logback/core/joran/action main/java/ch/qos/logback/core/util test/input/joran test/java/ch/qos/logback/core/joran test/java/ch/qos/logback/core/joran/ia

noreply.ceki at qos.ch noreply.ceki at qos.ch
Thu Nov 2 20:06:38 CET 2006


Author: ceki
Date: Thu Nov  2 20:06:37 2006
New Revision: 855

Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java
   logback/trunk/logback-core/src/test/input/joran/simplePropertyIA1.xml
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/SimpleConfigurator.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/Fruit.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/FruitContextAction.java
   logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/SimplePropertyIATest.java

Log:

Fixed bug #27.

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/joran/action/NestedSimplePropertyIA.java	Thu Nov  2 20:06:37 2006
@@ -57,8 +57,6 @@
     
     ContainmentType containmentType = parentBean.canContainComponent(nestedElementTagName);
 
-    System.out.println("==="+containmentType);
-    
     switch (containmentType) {
     case NOT_FOUND:
     case AS_SINGLE_COMPONENT:
@@ -70,7 +68,7 @@
       ImplicitActionData ad = new ImplicitActionData(parentBean, containmentType);
       ad.propertyName = nestedElementTagName;
       actionDataStack.push(ad);
-      //System.out.println("in NestedSimplePropertyIA deemed applicable <" + pattern + ">");
+      addInfo("NestedSimplePropertyIA deemed applicable <" + pattern + ">");
       return true;
     default:
       addError("PropertySetter.canContainComponent returned " + containmentType);
@@ -89,9 +87,8 @@
     //System.out.println("body "+body+", finalBody="+finalBody);
     // get the action data object pushed in isApplicable() method call
     ImplicitActionData actionData = (ImplicitActionData) actionDataStack.peek();
-    
     switch (actionData.containmentType) {
-    case AS_SINGLE_COMPONENT:
+    case AS_SINGLE_PROPERTY:
       actionData.parentBean.setProperty(actionData.propertyName, finalBody);
       break;
     case AS_PROPERTY_COLLECTION:

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/util/PropertySetter.java	Thu Nov  2 20:06:37 2006
@@ -113,8 +113,7 @@
     name = Introspector.decapitalize(name);
 
     PropertyDescriptor prop = getPropertyDescriptor(name);
-
-    // LogLog.debug("---------Key: "+name+", type="+prop.getPropertyType());
+   
     if (prop == null) {
       addWarn("No such property [" + name + "] in " + objClass.getName() + ".");
     } else {
@@ -287,8 +286,8 @@
     }
 
     name = capitalizeFirstLetter(name);
-
     Method adderMethod = getMethod("add" + name);
+ 
     if (adderMethod == null) {
       addError("No adder for property [" + name + "].");
       return;
@@ -308,12 +307,12 @@
       return;
     }
 
+
     if (arg == null) {
       addError("Conversion to type [" + paramTypes[0] + "] failed.");
     } else {
-
       try {
-        adderMethod.invoke(obj, new Object[] { arg });
+        adderMethod.invoke(obj, arg);
       } catch (Exception ex) {
         addError("Failed to invoke adder for " + name, ex);
       }

Modified: logback/trunk/logback-core/src/test/input/joran/simplePropertyIA1.xml
==============================================================================
--- logback/trunk/logback-core/src/test/input/joran/simplePropertyIA1.xml	(original)
+++ logback/trunk/logback-core/src/test/input/joran/simplePropertyIA1.xml	Thu Nov  2 20:06:37 2006
@@ -4,5 +4,6 @@
     <fruit class="ch.qos.logback.core.joran.ia.Fruit">
       <name>blue</name>
       <text>hello</text>
+      <text>world</text>
     </fruit> 
 </context>
\ No newline at end of file

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/SimpleConfigurator.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/SimpleConfigurator.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/SimpleConfigurator.java	Thu Nov  2 20:06:37 2006
@@ -34,7 +34,7 @@
     interpreter.addImplicitAction(nestedIA);
 
     NestedSimplePropertyIA nestedSimpleIA = new NestedSimplePropertyIA();
-    nestedIA.setContext(context);
+    nestedSimpleIA.setContext(context);
     interpreter.addImplicitAction(nestedSimpleIA);
   }
 
@@ -42,7 +42,6 @@
   protected void addInstanceRules(RuleStore rs) {
     for(Pattern pattern : rulesMap.keySet()) {
       Action action = rulesMap.get(pattern);
-      System.out.println("Adding "+pattern +" "+action);
       rs.addRule(pattern, action);
     }
   }

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/Fruit.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/Fruit.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/Fruit.java	Thu Nov  2 20:06:37 2006
@@ -9,11 +9,10 @@
   List<String> textList = new ArrayList<String>();
   
   public Fruit() {
-    System.out.println("Fruit constructor called");
   }
 
-  public void setName(String name) {
-    this.name = name;
+  public void setName(String n) {
+    this.name = n;
   }
 
   public String getName() {

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/FruitContextAction.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/FruitContextAction.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/FruitContextAction.java	Thu Nov  2 20:06:37 2006
@@ -25,7 +25,6 @@
   public void begin(InterpretationContext ec, String name, Attributes attributes)
       throws ActionException {
 
- 
     inError = false;
     
     try {

Modified: logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/SimplePropertyIATest.java
==============================================================================
--- logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/SimplePropertyIATest.java	(original)
+++ logback/trunk/logback-core/src/test/java/ch/qos/logback/core/joran/ia/SimplePropertyIATest.java	Thu Nov  2 20:06:37 2006
@@ -44,7 +44,9 @@
       
       Fruit f0 = fList.get(0);
       assertEquals("blue", f0.getName());
-      assertEquals(1, f0.textList.size());
+      assertEquals(2, f0.textList.size());
+      assertEquals("hello", f0.textList.get(0));
+      assertEquals("world", f0.textList.get(1));
     } catch (Exception je) {
       StatusPrinter.print(fruitContext);
       throw je;



More information about the logback-dev mailing list