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>
|
<body>
|
||||||
|
|
||||||
<release version="3.6" date="2016-MM-DD" description="TBD">
|
<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-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-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>
|
<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>
|
* and predictably.</p>
|
||||||
*
|
*
|
||||||
* @param count the length of random string to create
|
* @param count the length of random string to create
|
||||||
* @param start the position in set of chars to start at
|
* @param start the position in set of chars to start at (inclusive)
|
||||||
* @param end the position in set of chars to end before
|
* @param end the position in set of chars to end before (exclusive)
|
||||||
* @param letters only allow letters?
|
* @param letters only allow letters?
|
||||||
* @param numbers only allow numbers?
|
* @param numbers only allow numbers?
|
||||||
* @param chars the set of chars to choose randoms from, must not be empty.
|
* @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 char[] buffer = new char[count];
|
||||||
final int gap = end - start;
|
final int gap = end - start;
|
||||||
|
|
||||||
|
|
|
@ -311,6 +311,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
|
* <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
|
||||||
*
|
*
|
||||||
|
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* StringUtils.isBlank(null) = true
|
* StringUtils.isBlank(null) = true
|
||||||
* StringUtils.isBlank("") = true
|
* StringUtils.isBlank("") = true
|
||||||
|
@ -340,6 +342,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
|
* <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>
|
* <pre>
|
||||||
* StringUtils.isNotBlank(null) = false
|
* StringUtils.isNotBlank(null) = false
|
||||||
* StringUtils.isNotBlank("") = false
|
* StringUtils.isNotBlank("") = false
|
||||||
|
@ -361,6 +365,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if any one of the CharSequences are blank ("") or null and not whitespace only.</p>
|
* <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>
|
* <pre>
|
||||||
* StringUtils.isAnyBlank(null) = true
|
* StringUtils.isAnyBlank(null) = true
|
||||||
* StringUtils.isAnyBlank(null, "foo") = true
|
* StringUtils.isAnyBlank(null, "foo") = true
|
||||||
|
@ -391,6 +397,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if any one of the CharSequences are not blank ("") or null and not whitespace only.</p>
|
* <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>
|
* <pre>
|
||||||
* StringUtils.isAnyNotBlank(null) = false
|
* StringUtils.isAnyNotBlank(null) = false
|
||||||
* StringUtils.isAnyNotBlank(null, "foo") = true
|
* StringUtils.isAnyNotBlank(null, "foo") = true
|
||||||
|
@ -421,6 +429,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if none of the CharSequences are blank ("") or null and whitespace only.</p>
|
* <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>
|
* <pre>
|
||||||
* StringUtils.isNoneBlank(null) = false
|
* StringUtils.isNoneBlank(null) = false
|
||||||
* StringUtils.isNoneBlank(null, "foo") = false
|
* StringUtils.isNoneBlank(null, "foo") = 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})
|
* @param seq the CharSequence to check (may be {@code null})
|
||||||
* @return {@code true} if the CharSequence is not empty and
|
* @return {@code true} if the CharSequence is not empty and
|
||||||
* contains at least 1 whitespace character
|
* contains at least 1 (breaking) whitespace character
|
||||||
* @see java.lang.Character#isWhitespace
|
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
// From org.springframework.util.StringUtils, under Apache License 2.0
|
// From org.springframework.util.StringUtils, under Apache License 2.0
|
||||||
|
@ -7074,6 +7086,8 @@ public class StringUtils {
|
||||||
/**
|
/**
|
||||||
* <p>Checks if the CharSequence contains only whitespace.</p>
|
* <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}.
|
* <p>{@code null} will return {@code false}.
|
||||||
* An empty CharSequence (length()=0) will return {@code true}.</p>
|
* An empty CharSequence (length()=0) will return {@code true}.</p>
|
||||||
*
|
*
|
||||||
|
@ -7221,6 +7235,8 @@ public class StringUtils {
|
||||||
* <p>Returns either the passed in CharSequence, or if the CharSequence is
|
* <p>Returns either the passed in CharSequence, or if the CharSequence is
|
||||||
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.</p>
|
* whitespace, empty ("") or {@code null}, the value of {@code defaultStr}.</p>
|
||||||
*
|
*
|
||||||
|
* </p>Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
|
||||||
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* StringUtils.defaultIfBlank(null, "NULL") = "NULL"
|
* StringUtils.defaultIfBlank(null, "NULL") = "NULL"
|
||||||
* StringUtils.defaultIfBlank("", "NULL") = "NULL"
|
* StringUtils.defaultIfBlank("", "NULL") = "NULL"
|
||||||
|
|
|
@ -206,6 +206,14 @@ public class RandomStringUtilsTest {
|
||||||
RandomStringUtils.random(-1, 'a', 'z', false, false, DUMMY, new Random());
|
RandomStringUtils.random(-1, 'a', 'z', false, false, DUMMY, new Random());
|
||||||
fail();
|
fail();
|
||||||
} catch (final IllegalArgumentException ex) {}
|
} 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