Commons Lang
  1. Commons Lang
  2. LANG-79

[lang] ReflectionToStringBuilder.toString(null) throws exception by design

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      Calling ReflectionToStringBuilder.toString(null) throws an exception by design.
      I think it should just return null. Right now I need to do nasty things like:

      public String toString()

      { // dive into commons http client object as they do not implement toString(). return new ToStringBuilder(this).append("url", this.url).append("retryCount", this.retryCount).append( "multiThreadedHttpConnectionManager", this.multiThreadedHttpConnectionManager == null ? null : ReflectionToStringBuilder .toString(this.multiThreadedHttpConnectionManager)).append( "secureProtocolSocketFactory", this.secureProtocolSocketFactory == null ? null : ReflectionToStringBuilder .toString(this.secureProtocolSocketFactory)).toString(); }

      Will attach patch proposal.

        Issue Links

          Activity

          Error rendering 'com.atlassian.jirafisheyeplugin:fisheye-issuepanel'. Please contact your JIRA administrators.

          Gavin made changes -
          Link This issue is depended upon by LANG-126 [ LANG-126 ]
          Gavin made changes -
          Link This issue blocks LANG-126 [ LANG-126 ]
          Mark Thomas made changes -
          Reporter Gary Gregory [ ggregory@seagullsw.com ] Gary D. Gregory [ garydgregory ]
          Mark Thomas made changes -
          Workflow jira [ 12370267 ] Default workflow, editable Closed status [ 12602048 ]
          Henri Yandell made changes -
          Fix Version/s 2.1 Final [ 12311701 ]
          Henri Yandell made changes -
          Affects Version/s 2.0 Final [ 12311706 ]
          Henri Yandell made changes -
          Key COM-1210 LANG-79
          Affects Version/s 2.0 Final [ 12311658 ]
          Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
          Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
          Fix Version/s 2.1 Final [ 12311659 ]
          Component/s Lang [ 12311121 ]
          made changes -
          Link This issue blocks COM-1211 [ COM-1211 ]
          Henri Yandell made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 27876 12341362
          Hide
          Henri Yandell added a comment -

          2.1 released, closing.

          Show
          Henri Yandell added a comment - 2.1 released, closing.
          Hide
          ggregory@seagullsw.com added a comment -

          Fixed in CVS.
          ReflectionToStringBuilder.toString is now null-safe and returns the style's
          nullText.
          ToStringBuilder constructors are now null-safe. A new ToStringBuilder on a null
          followed by a call to toString returns "".

          Show
          ggregory@seagullsw.com added a comment - Fixed in CVS. ReflectionToStringBuilder.toString is now null-safe and returns the style's nullText. ToStringBuilder constructors are now null-safe. A new ToStringBuilder on a null followed by a call to toString returns "".
          Hide
          ggregory@seagullsw.com added a comment -

          Actually, passing null in should return the ToStringStyle nullText.

          Show
          ggregory@seagullsw.com added a comment - Actually, passing null in should return the ToStringStyle nullText.
          ggregory@seagullsw.com created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Gary Gregory
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development