You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by "Stefan Broetz (JIRA)" <ji...@apache.org> on 2006/03/02 15:35:39 UTC

[jira] Created: (TRB-9) Intake: Handling of empty values

Intake: Handling of empty values
--------------------------------

         Key: TRB-9
         URL: http://issues.apache.org/jira/browse/TRB-9
     Project: Turbine
        Type: Bug
  Components: Turbine 2.3  
    Versions: Core 2.3.2    
    Reporter: Stefan Broetz
    Priority: Blocker


It seems to be impossible transmit the empty string as a value: In the HTTP request

  http://.../turbine/...?aaa=123&bbb=&ccc=456

the parameter bbb is ignored.

If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:

        if (pp.containsKey(getKey()))
        {
            if (isDebugEnabled)
            {
                log.debug(name + ": Found our Key in the request, setting Value");
            }
            if (StringUtils.isNotEmpty(pp.getString(getKey())))
            {
                setFlag = true;
            }
            validate();
        }
        else if (pp.containsKey(getValueIfAbsent()) &&
                pp.getString(getValueIfAbsent()) != null)
        {
            pp.add(getKey(), pp.getString(getValueIfAbsent()));
            setFlag = true;
            validate();
        }

The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TRB-9) Intake: Handling of empty values

Posted by "Scott Eade (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/TRB-9?page=comments#action_12417424 ] 

Scott Eade commented on TRB-9:
------------------------------

Is the attached patch solving one or two problems?

The change:
-            if (StringUtils.isNotEmpty(pp.getString(getKey())))
+            if (pp.getString(getKey()) != null)
would appear to address this issue, but the changes concerning setter.invoke() appear to be addressing a different problem.

It isn't really a problem, but I would at least like to be able to more accurately describe what is being addressed in the change log and the commit message.

> Intake: Handling of empty values
> --------------------------------
>
>          Key: TRB-9
>          URL: http://issues.apache.org/jira/browse/TRB-9
>      Project: Turbine
>         Type: Bug

>   Components: Turbine 2.3
>     Versions: Core 2.3.2
>     Reporter: Stefan Broetz
>     Priority: Blocker
>  Attachments: patch_TRB-9.txt
>
> It seems to be impossible transmit the empty string as a value: In the HTTP request
>   http://.../turbine/...?aaa=123&bbb=&ccc=456
> the parameter bbb is ignored.
> If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:
>         if (pp.containsKey(getKey()))
>         {
>             if (isDebugEnabled)
>             {
>                 log.debug(name + ": Found our Key in the request, setting Value");
>             }
>             if (StringUtils.isNotEmpty(pp.getString(getKey())))
>             {
>                 setFlag = true;
>             }
>             validate();
>         }
>         else if (pp.containsKey(getValueIfAbsent()) &&
>                 pp.getString(getValueIfAbsent()) != null)
>         {
>             pp.add(getKey(), pp.getString(getValueIfAbsent()));
>             setFlag = true;
>             validate();
>         }
> The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TRB-9) Intake: Handling of empty values

Posted by "Jürgen Hoffmann (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/TRB-9?page=comments#action_12417432 ] 

Jürgen Hoffmann commented on TRB-9:
-----------------------------------

Yes this patch fixes this problem.

The other patch is to make it possible to add an attribute mapToObject within the group element, Without having to map all fields to properties of the Object.

To clear this a bit more. I have had a group which was mapped to a Business Object. Then I needed two checkboxes which should not be mapped. (They were to decide on who should receive e-mail confirmation). No I saw NPEs inside the logs. The reason was that I have done group.setProperties(...) which in turn tries to call field.setProperty(...) on each field. Since I have not set the Attribute mapToProperty on these two confirmation fields, The setter Value was null causing this NPE.

The Patch now checks for the setter not being null before trying to invoke it. If null I am logging a detailed message, to let the user know if he had a typo.

> Intake: Handling of empty values
> --------------------------------
>
>          Key: TRB-9
>          URL: http://issues.apache.org/jira/browse/TRB-9
>      Project: Turbine
>         Type: Bug

>   Components: Turbine 2.3
>     Versions: Core 2.3.2
>     Reporter: Stefan Broetz
>     Priority: Blocker
>  Attachments: patch_TRB-9.txt
>
> It seems to be impossible transmit the empty string as a value: In the HTTP request
>   http://.../turbine/...?aaa=123&bbb=&ccc=456
> the parameter bbb is ignored.
> If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:
>         if (pp.containsKey(getKey()))
>         {
>             if (isDebugEnabled)
>             {
>                 log.debug(name + ": Found our Key in the request, setting Value");
>             }
>             if (StringUtils.isNotEmpty(pp.getString(getKey())))
>             {
>                 setFlag = true;
>             }
>             validate();
>         }
>         else if (pp.containsKey(getValueIfAbsent()) &&
>                 pp.getString(getValueIfAbsent()) != null)
>         {
>             pp.add(getKey(), pp.getString(getValueIfAbsent()));
>             setFlag = true;
>             validate();
>         }
> The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (TRB-9) Intake: Handling of empty values

Posted by "Jürgen Hoffmann (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/TRB-9?page=comments#action_12417306 ] 

Jürgen Hoffmann commented on TRB-9:
-----------------------------------

This patch also addresses the issue of intake, not being able to use default validators i.e. BooleanValidator, if the rules are empty.

> Intake: Handling of empty values
> --------------------------------
>
>          Key: TRB-9
>          URL: http://issues.apache.org/jira/browse/TRB-9
>      Project: Turbine
>         Type: Bug

>   Components: Turbine 2.3
>     Versions: Core 2.3.2
>     Reporter: Stefan Broetz
>     Priority: Blocker
>  Attachments: patch_TRB-9.txt
>
> It seems to be impossible transmit the empty string as a value: In the HTTP request
>   http://.../turbine/...?aaa=123&bbb=&ccc=456
> the parameter bbb is ignored.
> If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:
>         if (pp.containsKey(getKey()))
>         {
>             if (isDebugEnabled)
>             {
>                 log.debug(name + ": Found our Key in the request, setting Value");
>             }
>             if (StringUtils.isNotEmpty(pp.getString(getKey())))
>             {
>                 setFlag = true;
>             }
>             validate();
>         }
>         else if (pp.containsKey(getValueIfAbsent()) &&
>                 pp.getString(getValueIfAbsent()) != null)
>         {
>             pp.add(getKey(), pp.getString(getValueIfAbsent()));
>             setFlag = true;
>             validate();
>         }
> The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Resolved: (TRB-9) Intake: Handling of empty values

Posted by "Scott Eade (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/TRB-9?page=all ]
     
Scott Eade resolved TRB-9:
--------------------------

    Resolution: Fixed

Patch applied.

Thanks.

> Intake: Handling of empty values
> --------------------------------
>
>          Key: TRB-9
>          URL: http://issues.apache.org/jira/browse/TRB-9
>      Project: Turbine
>         Type: Bug

>   Components: Turbine 2.3
>     Versions: Core 2.3.2
>     Reporter: Stefan Broetz
>     Priority: Blocker
>  Attachments: patch_TRB-9.txt
>
> It seems to be impossible transmit the empty string as a value: In the HTTP request
>   http://.../turbine/...?aaa=123&bbb=&ccc=456
> the parameter bbb is ignored.
> If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:
>         if (pp.containsKey(getKey()))
>         {
>             if (isDebugEnabled)
>             {
>                 log.debug(name + ": Found our Key in the request, setting Value");
>             }
>             if (StringUtils.isNotEmpty(pp.getString(getKey())))
>             {
>                 setFlag = true;
>             }
>             validate();
>         }
>         else if (pp.containsKey(getValueIfAbsent()) &&
>                 pp.getString(getValueIfAbsent()) != null)
>         {
>             pp.add(getKey(), pp.getString(getValueIfAbsent()));
>             setFlag = true;
>             validate();
>         }
> The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (TRB-9) Intake: Handling of empty values

Posted by "Jürgen Hoffmann (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/TRB-9?page=all ]

Jürgen Hoffmann updated TRB-9:
------------------------------

    Attachment: patch_TRB-9.txt

Changed from using StringUtils.isnotEmpty(String) which returned false even for the empty string, to just check for null values.

> Intake: Handling of empty values
> --------------------------------
>
>          Key: TRB-9
>          URL: http://issues.apache.org/jira/browse/TRB-9
>      Project: Turbine
>         Type: Bug

>   Components: Turbine 2.3
>     Versions: Core 2.3.2
>     Reporter: Stefan Broetz
>     Priority: Blocker
>  Attachments: patch_TRB-9.txt
>
> It seems to be impossible transmit the empty string as a value: In the HTTP request
>   http://.../turbine/...?aaa=123&bbb=&ccc=456
> the parameter bbb is ignored.
> If you look at org.apache.turbine.services.intake.model.Field.init(ValueParser pp) you find:
>         if (pp.containsKey(getKey()))
>         {
>             if (isDebugEnabled)
>             {
>                 log.debug(name + ": Found our Key in the request, setting Value");
>             }
>             if (StringUtils.isNotEmpty(pp.getString(getKey())))
>             {
>                 setFlag = true;
>             }
>             validate();
>         }
>         else if (pp.containsKey(getValueIfAbsent()) &&
>                 pp.getString(getValueIfAbsent()) != null)
>         {
>             pp.add(getKey(), pp.getString(getValueIfAbsent()));
>             setFlag = true;
>             validate();
>         }
> The StringUtils.isNotEmpty() condition (line 342) prevents that a field can take up the empty string as its value.

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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