commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bjorn Townsend (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LANG-372) ToStringBuilder: MULTI_LINE_STYLE does not print anything from appendToString methods.
Date Mon, 12 Nov 2007 23:43:50 GMT

     [ 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.


Mime
View raw message