Skip to content

Commit f7c85bb

Browse files
authored
docs: fix Javadoc for StringUtils.equals() and repeat() null handling (#6640)
1 parent c0cf30c commit f7c85bb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

utils/src/main/java/software/amazon/awssdk/utils/StringUtils.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ public static String trimToEmpty(final String str) {
299299
* equal sequences of characters.</p>
300300
*
301301
* <p>{@code null}s are handled without exceptions. Two {@code null}
302-
* references are considered to be equal. The comparison is case sensitive.</p>
302+
* references are considered to be unequal. The comparison is case sensitive.</p>
303303
*
304304
* <pre>
305-
* StringUtils.equals(null, null) = true
305+
* StringUtils.equals(null, null) = false
306306
* StringUtils.equals(null, "abc") = false
307307
* StringUtils.equals("abc", null) = false
308308
* StringUtils.equals("abc", "abc") = true
@@ -312,7 +312,7 @@ public static String trimToEmpty(final String str) {
312312
* @see Object#equals(Object)
313313
* @param cs1 the first String, may be {@code null}
314314
* @param cs2 the second String, may be {@code null}
315-
* @return {@code true} if the Strings are equal (case-sensitive), or both {@code null}
315+
* @return {@code true} if the Strings are equal (case-sensitive), or {@code false} if either is {@code null}
316316
*/
317317
public static boolean equals(final String cs1, final String cs2) {
318318
if (cs1 == null || cs2 == null) {
@@ -932,18 +932,19 @@ public static boolean safeStringToBoolean(String value) {
932932

933933
throw new IllegalArgumentException("Value was defined as '" + value + "', but should be 'false' or 'true'");
934934
}
935-
935+
936936
/**
937937
* Returns a string whose value is the concatenation of this string repeated {@code count} times.
938938
* <p>
939939
* If this string is empty or count is zero then the empty string is returned.
940+
* A {@code null} input string returns {@code null}.
940941
* <p>
941942
* Logical clone of JDK11's {@link String#repeat(int)}.
942943
*
943-
* @param value the string to repeat
944+
* @param value the string to repeat, may be null
944945
* @param count number of times to repeat
945-
* @return A string composed of this string repeated {@code count} times or the empty string if this string is empty or count
946-
* is zero
946+
* @return A string composed of this string repeated {@code count} times, the empty string if this string is empty or count
947+
* is zero, or {@code null} if input is {@code null}
947948
* @throws IllegalArgumentException if the {@code count} is negative.
948949
*/
949950
public static String repeat(String value, int count) {

0 commit comments

Comments
 (0)