Eat own dog food: Replace "" with StringUtils.EMPTY.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1095935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2011-04-22 13:51:53 +00:00
parent 9d2f0b9a18
commit 10e83fc8e6
1 changed files with 2 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import java.util.Formattable;
import java.util.Formatter; import java.util.Formatter;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
/** /**
@ -128,7 +129,7 @@ public class FormattableUtils {
"Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, precision); "Specified ellipsis '%1$s' exceeds precision of %2$s", ellipsis, precision);
StringBuilder buf = new StringBuilder(seq); StringBuilder buf = new StringBuilder(seq);
if (precision >= 0 && precision < seq.length()) { if (precision >= 0 && precision < seq.length()) {
CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, ""); CharSequence _ellipsis = ObjectUtils.defaultIfNull(ellipsis, StringUtils.EMPTY);
buf.replace(precision - _ellipsis.length(), seq.length(), _ellipsis.toString()); buf.replace(precision - _ellipsis.length(), seq.length(), _ellipsis.toString());
} }
boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY; boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY;