commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@btopenworld.com>
Subject Re: svn commit: r826960 - /commons/proper/lang/trunk/src/java/org/apache/commons/lang/ObjectUtils.java
Date Sat, 24 Oct 2009 11:05:41 GMT
bayard@apache.org wrote:
> URL: http://svn.apache.org/viewvc?rev=826960&view=rev
> Log:
> Moved identityToString(StringBuffer, Object) to identityToString(Appendable, Object)
per LANG-542
> @@ -178,13 +178,17 @@
>       * @param object  the object to create a toString for
>       * @since 2.4
>       */
> -    public static void identityToString(StringBuffer buffer, Object object) {
> +    public static void identityToString(Appendable buffer, Object object) {
>          if (object == null) {
>              throw new NullPointerException("Cannot get the toString of a null identity");
>          }
> -        buffer.append(object.getClass().getName())
> -              .append('@')
> -              .append(Integer.toHexString(System.identityHashCode(object)));
> +        try {
> +            buffer.append(object.getClass().getName())
> +                  .append('@')
> +                  .append(Integer.toHexString(System.identityHashCode(object)));
> +        } catch(java.io.IOException ioe) {
> +            // can't happen - Appendable API forces it upon us
> +        }
>      }

This change is invalid.

IO classes such as Writer implement Appendable, and appending to those 
can throw an IOException.

Stephen

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


Mime
View raw message