You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Kevin Waugh (JIRA)" <ji...@apache.org> on 2007/05/02 22:11:15 UTC

[jira] Created: (BETWIXT-58) Empty string bug

Empty string bug
----------------

                 Key: BETWIXT-58
                 URL: https://issues.apache.org/jira/browse/BETWIXT-58
             Project: Commons Betwixt
          Issue Type: Bug
    Affects Versions: Nightly Builds
         Environment: N/A
            Reporter: Kevin Waugh
            Priority: Minor
             Fix For: Nightly Builds


If you create a bean with a string property and set the string to be the empty string then write the bean to xml using Betwixt upon reading the bean the string property will be set to null.

The stringToObject method in ConvertUtilsObjectStringConverter does not obey it's javadoc description.  The following patch still violates the description, but fixes the bug stated.

Index: src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java
===================================================================
--- src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (revision 534335)
+++ src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (working copy)
@@ -61,7 +61,7 @@
     public Object stringToObject(String value, Class type, String flavour, Context context) {
         if (value == null || "".equals(value))
         {
-            return null;
+            return value;
         }

         return ConvertUtils.convert( value, type );


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (BETWIXT-58) Empty string bug

Posted by "Martin van den Bemt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BETWIXT-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin van den Bemt resolved BETWIXT-58.
----------------------------------------

    Resolution: Fixed

Author: mvdb
Date: Sat Jun 30 02:26:22 2007
New Revision: 552123

URL: http://svn.apache.org/viewvc?view=rev&rev=552123
Log:
Fix BETWIXT-58. Thanx to Kevin Waugh for spotting this.

Modified:
    jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java
    jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/strategy/TestObjectStringConverters.java

> Empty string bug
> ----------------
>
>                 Key: BETWIXT-58
>                 URL: https://issues.apache.org/jira/browse/BETWIXT-58
>             Project: Commons Betwixt
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: N/A
>            Reporter: Kevin Waugh
>            Priority: Minor
>             Fix For: Nightly Builds
>
>
> If you create a bean with a string property and set the string to be the empty string then write the bean to xml using Betwixt upon reading the bean the string property will be set to null.
> The stringToObject method in ConvertUtilsObjectStringConverter does not obey it's javadoc description.  The following patch still violates the description, but fixes the bug stated.
> Index: src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java
> ===================================================================
> --- src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (revision 534335)
> +++ src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (working copy)
> @@ -61,7 +61,7 @@
>      public Object stringToObject(String value, Class type, String flavour, Context context) {
>          if (value == null || "".equals(value))
>          {
> -            return null;
> +            return value;
>          }
>          return ConvertUtils.convert( value, type );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (BETWIXT-58) Empty string bug

Posted by "Martin van den Bemt (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BETWIXT-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509268 ] 

Martin van den Bemt commented on BETWIXT-58:
--------------------------------------------

Oh forgot to add : since value can be null, I decided to just return "" instead of value (since the javadoc says it will not return null)

> Empty string bug
> ----------------
>
>                 Key: BETWIXT-58
>                 URL: https://issues.apache.org/jira/browse/BETWIXT-58
>             Project: Commons Betwixt
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>         Environment: N/A
>            Reporter: Kevin Waugh
>            Priority: Minor
>             Fix For: Nightly Builds
>
>
> If you create a bean with a string property and set the string to be the empty string then write the bean to xml using Betwixt upon reading the bean the string property will be set to null.
> The stringToObject method in ConvertUtilsObjectStringConverter does not obey it's javadoc description.  The following patch still violates the description, but fixes the bug stated.
> Index: src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java
> ===================================================================
> --- src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (revision 534335)
> +++ src/java/org/apache/commons/betwixt/strategy/ConvertUtilsObjectStringConverter.java (working copy)
> @@ -61,7 +61,7 @@
>      public Object stringToObject(String value, Class type, String flavour, Context context) {
>          if (value == null || "".equals(value))
>          {
> -            return null;
> +            return value;
>          }
>          return ConvertUtils.convert( value, type );

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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