You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by se...@apache.org on 2006/06/26 04:09:43 UTC

svn commit: r417111 - in /jakarta/turbine/core/branches/TURBINE_2_3_BRANCH: src/java/org/apache/turbine/services/intake/model/Field.java xdocs/changes.xml

Author: seade
Date: Sun Jun 25 19:09:43 2006
New Revision: 417111

URL: http://svn.apache.org/viewvc?rev=417111&view=rev
Log:
TRB-9: Intake was not handling empty values correctly.
Also, Intake now handles the case where the mapToObject does not map to all fields in the group.
Thanks to Jürgen Hoffmann for the patch.

Modified:
    jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/intake/model/Field.java
    jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml

Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/intake/model/Field.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/intake/model/Field.java?rev=417111&r1=417110&r2=417111&view=diff
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/intake/model/Field.java (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/src/java/org/apache/turbine/services/intake/model/Field.java Sun Jun 25 19:09:43 2006
@@ -340,7 +340,7 @@
             {
                 log.debug(name + ": Found our Key in the request, setting Value");
             }
-            if (StringUtils.isNotEmpty(pp.getString(getKey())))
+            if (pp.getString(getKey()) != null)
             {
                 setFlag = true;
             }
@@ -885,7 +885,25 @@
 
         try
         {
-            setter.invoke(obj, valArray);
+            /*
+             * In the case we map a Group to an Object using mapToObject, and we
+             * want to add an additional Field which should not be mapped, and
+             * we leave the mapToProperty empty, we will get a NPE here. So we
+             * have to double check, if we really have a setter set.
+             */
+            if(setter != null)
+            {
+                setter.invoke(obj, valArray);
+            }
+            else if (isDebugEnabled)
+            {
+                log.debug(name + ": has a null setter for the mapToProperty"
+                        + " Attribute, although all Fields should be mapped"
+                        + " to " + mapToObject + ". If this is unwanted, You"
+                        + " should doublecheck the mapToProperty Attribute, and"
+                        + " consult the logs. The Turbine Intake Serice will"
+                        + " have logged a detailed Message with the error.");
+            }                
         }
         catch (IllegalAccessException e)
         {

Modified: jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml?rev=417111&r1=417110&r2=417111&view=diff
==============================================================================
--- jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml (original)
+++ jakarta/turbine/core/branches/TURBINE_2_3_BRANCH/xdocs/changes.xml Sun Jun 25 19:09:43 2006
@@ -25,6 +25,13 @@
 
 <body>
   <release version="2.3.3-dev" date="in Subversion">
+    <action type="update" dev="seade" issue="TRB-9" due-to="J&uuml;rgen Hoffmann">
+      Intake now handles the case where the mapToObject does not map to all
+      fields in the group.
+    </action>
+    <action type="fix" dev="seade" issue="TRB-9" due-to="J&uuml;rgen Hoffmann">
+      Intake was not handling empty values correctly.
+    </action>
     <action type="fix" dev="seade" issue="TRB-8" due-to="Gunther Olesch">
       A FileItem in a ParameterParser added to TurbineURI or TemplateURI was
       resulting in a NPE.



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org