mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-14 14:05:17 +00:00
LANG-1131: StrBuilder.equals(StrBuilder) doesn't check for null inputs
This commit is contained in:
parent
e2ec4f2fdb
commit
fc73151cfc
@ -22,6 +22,7 @@
|
||||
<body>
|
||||
|
||||
<release version="3.5" date="tba" description="tba">
|
||||
<action issue="LANG-1131" type="fix" dev="britter">StrBuilder.equals(StrBuilder) doesn't check for null inputs</action>
|
||||
<action issue="LANG-1105" type="add" dev="britter" due-to="Hendrik Saly">Add ThreadUtils - A utility class which provides helper methods related to java.lang.Thread</action>
|
||||
<action issue="LANG-1031" type="add" dev="britter" due-to="Felipe Adorno">Add annotations to exclude fields from ReflectionEqualsBuilder, ReflectionToStringBuilder and ReflectionHashCodeBuilder</action>
|
||||
<action issue="LANG-1127" type="add" dev="chas">Unit test helpers which set and reset default Locale and TimeZone</action>
|
||||
|
@ -2819,6 +2819,9 @@ public boolean equals(final StrBuilder other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.size != other.size) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1850,6 +1850,13 @@ public void testEquals() {
|
||||
assertFalse(sb1.equals("abc"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_LANG_1131_EqualsWithNullStrBuilder() throws Exception {
|
||||
final StrBuilder sb = new StrBuilder();
|
||||
final StrBuilder other = null;
|
||||
assertFalse(sb.equals(other));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user