You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Travis Reeder (JIRA)" <ji...@apache.org> on 2007/11/08 10:53:50 UTC

[jira] Created: (LANG-372) MULTI_LINE_STYLE does not print anything from appendToString methods.

MULTI_LINE_STYLE does not print anything from appendToString methods.
---------------------------------------------------------------------

                 Key: LANG-372
                 URL: https://issues.apache.org/jira/browse/LANG-372
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.3
            Reporter: Travis Reeder
             Fix For: 2.4


To reproduce, just use the following sample on an object:

return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .appendToString(ob1.toString())
                .appendToString(ob2.toString())
                .append("something", something)
                .toString();

You won't see the ob1.toString or the ob2.toString

And this works correctly:

return new ToStringBuilder(this)
                .appendToString(ob1.toString())
                .appendToString(ob2.toString())
                .append("something", something)
                .toString();

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


[jira] Closed: (LANG-372) ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-372.
------------------------------

    Resolution: Won't Fix

Marking this as WONTFIX. It's a design bug rather than a code bug, and I don't see any obvious ways to surgically fix it.

I've also added Bjorn's unit test as a proof of this so if it does change in the future we can notice (r594387).

> ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.
> --------------------------------------------------------------------------------------
>
>                 Key: LANG-372
>                 URL: https://issues.apache.org/jira/browse/LANG-372
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Travis Reeder
>             Fix For: 2.4
>
>         Attachments: LANG-327-test.patch
>
>
> To reproduce, just use the following sample on an object:
> return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();
> You won't see the ob1.toString or the ob2.toString
> And this works correctly:
> return new ToStringBuilder(this)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();

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


[jira] Commented: (LANG-372) ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542013 ] 

Henri Yandell commented on LANG-372:
------------------------------------

Yep - it even says so in ToStringBuilder (doh):

     * <p>This method assumes that the other object uses the same <code>ToStringStyle</code>
     * as this one.</p>

Just not in ToStringStyle where it's obvious when digging into the code.

I've added Javadoc in ToStringStyle to that effect (r594386). 

> ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.
> --------------------------------------------------------------------------------------
>
>                 Key: LANG-372
>                 URL: https://issues.apache.org/jira/browse/LANG-372
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Travis Reeder
>             Fix For: 2.4
>
>         Attachments: LANG-327-test.patch
>
>
> To reproduce, just use the following sample on an object:
> return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();
> You won't see the ob1.toString or the ob2.toString
> And this works correctly:
> return new ToStringBuilder(this)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();

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


[jira] Updated: (LANG-372) ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.

Posted by "Travis Reeder (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Reeder updated LANG-372:
-------------------------------

    Summary: ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.  (was: MULTI_LINE_STYLE does not print anything from appendToString methods.)

> ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.
> --------------------------------------------------------------------------------------
>
>                 Key: LANG-372
>                 URL: https://issues.apache.org/jira/browse/LANG-372
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Travis Reeder
>             Fix For: 2.4
>
>
> To reproduce, just use the following sample on an object:
> return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();
> You won't see the ob1.toString or the ob2.toString
> And this works correctly:
> return new ToStringBuilder(this)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();

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


[jira] Updated: (LANG-372) ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.

Posted by "Bjorn Townsend (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bjorn Townsend updated LANG-372:
--------------------------------

    Attachment: LANG-327-test.patch

Looks like ToStringBuilder doesn't like appending toStrings built with different style types. The multiline style calls setContentEnd to change the content end string from ] to \n]. It fails to append toStrings built with the plain style because it can't find this string.  So the workaround is to use a single style in every object.

I'm attaching a JUnit test patch that reproduces this issue.

> ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.
> --------------------------------------------------------------------------------------
>
>                 Key: LANG-372
>                 URL: https://issues.apache.org/jira/browse/LANG-372
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Travis Reeder
>             Fix For: 2.4
>
>         Attachments: LANG-327-test.patch
>
>
> To reproduce, just use the following sample on an object:
> return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();
> You won't see the ob1.toString or the ob2.toString
> And this works correctly:
> return new ToStringBuilder(this)
>                 .appendToString(ob1.toString())
>                 .appendToString(ob2.toString())
>                 .append("something", something)
>                 .toString();

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