henning     2003/07/15 03:15:18

  Modified:    src/java/org/apache/turbine/services/intake/model Field.java
                        Group.java
  Log:
  Added some debugging which helps tremendously when looking for Intake
  Bugs.
  
  Revision  Changes    Path
  1.12      +52 -2     
jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Field.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Field.java        11 Apr 2003 13:15:09 -0000      1.11
  +++ Field.java        15 Jul 2003 10:15:18 -0000      1.12
  @@ -183,8 +183,16 @@
       private Object[] valArray;
       /** The object containing the field data. */
       protected ValueParser parser;
  +
       /** Logging */
  -    private static Log log = LogFactory.getLog(Field.class);
  +    private static final Log log;
  +    private static final boolean isDebugEnabled;
  +
  +    static
  +    {
  +        log = LogFactory.getLog(Field.class);
  +        isDebugEnabled = log.isDebugEnabled();
  +    }
   
       /**
        * Constructs a field based on data in the xml specification
  @@ -353,6 +361,10 @@
   
           if (pp.containsKey(getKey()))
           {
  +            if (isDebugEnabled)
  +            {
  +                log.debug(name + ": Found our Key in the request, setting Value");
  +            }
               setFlag = true;
               validate();
           }
  @@ -586,10 +598,22 @@
        */
       protected boolean validate()
       {
  +        log.debug(name + ": validate()");
  +
           if (isMultiValued)
           {
               stringValues = parser.getStrings(getKey());
   
  +            if (isDebugEnabled)
  +            {
  +                log.debug(name + ": Multi-Valued");
  +                for (int i = 0; i < stringValues.length; i++)
  +                {
  +                    log.debug(name + ": " + i + ". Wert: " + stringValues[i]);
  +                }
  +            }
  +
  +            
               if (validator != null)
               {
                   // set the test value as a String[] which might be replaced by
  @@ -616,6 +640,12 @@
           else
           {
               stringValue = parser.getString(getKey());
  +
  +            if (isDebugEnabled)
  +            {
  +                log.debug(name + ": Single Valued, Value is " + stringValue);
  +            }
  +
               if (validator != null)
               {
                   // set the test value as a String which might be replaced by
  @@ -625,10 +655,12 @@
                   try
                   {
                       validator.assertValidity(stringValue);
  +                    log.debug(name + ": Value is ok");
                       doSetValue();
                   }
                   catch (ValidationException ve)
                   {
  +                    log.debug(name + ": Value failed validation!");
                       setMessage(ve.getMessage());
                   }
               }
  @@ -819,6 +851,11 @@
        */
       public void setProperty(Object obj) throws IntakeException
       {
  +        if (isDebugEnabled)
  +        {
  +            log.debug(name + ".setProperty(" + obj.getClass().getName() + ")");
  +        }
  +
           if (!isValid())
           {
               throw new IntakeException(
  @@ -827,6 +864,12 @@
           if (isSet())
           {
               valArray[0] = getTestValue();
  +
  +            if (isDebugEnabled)
  +            {
  +                log.debug(name + ": Property is set, value is " + valArray[0]);
  +            }
  +
               try
               {
                   setter.invoke(obj, valArray);
  @@ -845,6 +888,13 @@
               {
                   throwSetGetException("setter", obj, this.getDisplayName(),
                           this.group.getIntakeGroupName(), e);
  +            }
  +        }
  +        else
  +        {
  +            if (isDebugEnabled)
  +            {
  +                log.debug(name+ ": Property is not set, skipping");
               }
           }
       }
  
  
  
  1.9       +8 -1      
jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Group.java
  
  Index: Group.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/Group.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Group.java        11 Apr 2003 13:15:10 -0000      1.8
  +++ Group.java        15 Jul 2003 10:15:18 -0000      1.9
  @@ -390,8 +390,14 @@
       public void setProperties(Object obj) throws IntakeException
       {
           Class cls = obj.getClass();
  +
           while (cls != null)
           {
  +            if (isDebugEnabled)
  +            {
  +                log.debug("setProperties(" + cls.getName() + ")");
  +            }
  +
               Field[] flds = (Field[]) mapToObjectFields.get(cls.getName());
               if (flds != null)
               {
  @@ -403,6 +409,7 @@
   
               cls = cls.getSuperclass();
           }
  +        log.debug("setProperties() finished");
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to