From 4246a0cc40ce3c05f1a02c2da2653ac622703d77 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Tue, 8 Jan 2019 15:39:00 -0500 Subject: [PATCH] Appending a null Object/String to InternalStringBuilder is now a no-op, previously appended "null" --- .../beehive/netui/util/internal/InternalStringBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/InternalStringBuilder.java b/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/InternalStringBuilder.java index ca16189..83a62f0 100644 --- a/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/InternalStringBuilder.java +++ b/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/InternalStringBuilder.java @@ -45,7 +45,7 @@ public final class InternalStringBuilder public InternalStringBuilder( String str ) { - this( str.length() + 16 ); + this( (str == null ? 0 : str.length()) + 16 ); append( str ); } @@ -98,12 +98,13 @@ public final class InternalStringBuilder public InternalStringBuilder append( Object obj ) { + if ( obj == null ) return this; // this used to append "null" return append( String.valueOf( obj ) ); } public InternalStringBuilder append( String str ) { - if ( str == null ) str = String.valueOf( str ); + if ( str == null ) return this; // this used to append "null" like: str = String.valueOf( str ); int len = str.length(); ensureCapacity( _length + len ); str.getChars( 0, len, _buffer, _length );