Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-lang.git
This commit is contained in:
commit
429c847b24
|
@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<body>
|
||||
|
||||
<release version="3.6" date="2016-MM-DD" description="TBD">
|
||||
<action issue="LANG-1287" type="fix" dev="pschumacher" due-to="Ivan Morozov">RandomStringUtils#random can enter infinite loop if end parameter is to small</action>
|
||||
<action issue="LANG-1285" type="fix" dev="pschumacher" due-to="Francesco Chicchiriccò">NullPointerException in FastDateParser$TimeZoneStrategy</action>
|
||||
<action issue="LANG-1281" type="fix" dev="pschumacher" due-to="Andreas Lundblad">Javadoc of StringUtils.ordinalIndexOf is contradictory.</action>
|
||||
<action issue="LANG-1269" type="fix" dev="pschumacher">Wrong name or result of StringUtils#getJaroWinklerDistance</action>
|
||||
|
|
|
@ -327,8 +327,8 @@ public class RandomStringUtils {
|
|||
* and predictably.</p>
|
||||
*
|
||||
* @param count the length of random string to create
|
||||
* @param start the position in set of chars to start at
|
||||
* @param end the position in set of chars to end before
|
||||
* @param start the position in set of chars to start at (inclusive)
|
||||
* @param end the position in set of chars to end before (exclusive)
|
||||
* @param letters only allow letters?
|
||||
* @param numbers only allow numbers?
|
||||
* @param chars the set of chars to choose randoms from, must not be empty.
|
||||
|
@ -368,6 +368,17 @@ public class RandomStringUtils {
|
|||
}
|
||||
}
|
||||
|
||||
final int zero_digit_ascii = 48;
|
||||
final int first_letter_ascii = 65;
|
||||
|
||||
if (chars == null) {
|
||||
if (numbers && end <= zero_digit_ascii
|
||||
|| letters && end <= first_letter_ascii) {
|
||||
throw new IllegalArgumentException("Parameter end (" + end + ") must be greater then (" + zero_digit_ascii + ") for generating digits " +
|
||||
"or greater then (" + first_letter_ascii + ") for generating letters.");
|
||||
}
|
||||
}
|
||||
|
||||
final char[] buffer = new char[count];
|
||||
final int gap = end - start;
|
||||
|
||||
|
|
|
@ -310,6 +310,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isBlank(null) = true
|
||||
|
@ -339,6 +341,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isNotBlank(null) = false
|
||||
|
@ -360,6 +364,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if any one of the CharSequences are blank ("") or null and not whitespace only.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isAnyBlank(null) = true
|
||||
|
@ -390,6 +396,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if any one of the CharSequences are not blank ("") or null and not whitespace only.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isAnyNotBlank(null) = false
|
||||
|
@ -420,6 +428,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if none of the CharSequences are blank ("") or null and whitespace only.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.isNoneBlank(null) = false
|
||||
|
@ -1926,11 +1936,13 @@ public class StringUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check whether the given CharSequence contains any whitespace characters.
|
||||
* <p>Check whether the given CharSequence contains any whitespace characters.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* @param seq the CharSequence to check (may be {@code null})
|
||||
* @return {@code true} if the CharSequence is not empty and
|
||||
* contains at least 1 whitespace character
|
||||
* @see java.lang.Character#isWhitespace
|
||||
* contains at least 1 (breaking) whitespace character
|
||||
* @since 3.0
|
||||
*/
|
||||
// From org.springframework.util.StringUtils, under Apache License 2.0
|
||||
|
@ -7073,6 +7085,8 @@ public class StringUtils {
|
|||
|
||||
/**
|
||||
* <p>Checks if the CharSequence contains only whitespace.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <p>{@code null} will return {@code false}.
|
||||
* An empty CharSequence (length()=0) will return {@code true}.</p>
|
||||
|
@ -7220,6 +7234,8 @@ public class StringUtils {
|
|||
/**
|
||||
* <p>Returns either the passed in CharSequence, or if the CharSequence is
|
||||
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.</p>
|
||||
*
|
||||
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.defaultIfBlank(null, "NULL") = "NULL"
|
||||
|
|
|
@ -206,6 +206,14 @@ public class RandomStringUtilsTest {
|
|||
RandomStringUtils.random(-1, 'a', 'z', false, false, DUMMY, new Random());
|
||||
fail();
|
||||
} catch (final IllegalArgumentException ex) {}
|
||||
try {
|
||||
RandomStringUtils.random(8, 32, 48, false, true);
|
||||
fail();
|
||||
} catch (final IllegalArgumentException ex) {}
|
||||
try {
|
||||
RandomStringUtils.random(8, 32, 65, true, false);
|
||||
fail();
|
||||
} catch (final IllegalArgumentException ex) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue