Merge branch 'master' into release
This commit is contained in:
commit
535ec32c68
|
@ -142,7 +142,7 @@ o StringUtils.stripAccents(String) doesn't handle T with stroke. Than
|
|||
o LANG-1735: Fix Javadoc for FluentBitSet.setInclusive(int, int) #1222. Thanks to Tobias Kiecker.
|
||||
o Same Javadoc changes as [TEXT-234] #1223. Thanks to Tobias Kiecker.
|
||||
o Remove duplicate static data in SerializationUtils.ClassLoaderAwareObjectInputStream. Thanks to Gary Gregory.
|
||||
o Reimplement RandomStringUtils on top of SecureRandom#getInstanceStrong() #1235. Thanks to Gary Gregory, Henri Yandell, Fabrice Benhamouda.
|
||||
o Reimplement RandomUtils and RandomStringUtils on top of SecureRandom#getInstanceStrong() #1235. Thanks to Gary Gregory, Henri Yandell, Fabrice Benhamouda.
|
||||
o LANG-1657: DiffBuilder: Type constraint for method append(..., DiffResult) too strict #786. Thanks to Matthias Welz, Andrew Thomas, Gary Gregory.
|
||||
|
||||
Changes:
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -167,7 +167,7 @@
|
|||
|
||||
<!-- Commons Release Plugin -->
|
||||
<commons.bc.version>3.14.0</commons.bc.version>
|
||||
<commons.rc.version>RC1</commons.rc.version>
|
||||
<commons.rc.version>RC2</commons.rc.version>
|
||||
<commons.release.isDistModule>true</commons.release.isDistModule>
|
||||
<commons.distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/lang</commons.distSvnStagingUrl>
|
||||
<!-- JaCoCo: Don't make code coverage worse than: -->
|
||||
|
|
|
@ -143,7 +143,7 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
<action issue="LANG-1735" type="fix" dev="ggregory" due-to="Tobias Kiecker">Fix Javadoc for FluentBitSet.setInclusive(int, int) #1222.</action>
|
||||
<action type="fix" dev="ggregory" due-to="Tobias Kiecker">Same Javadoc changes as [TEXT-234] #1223.</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">Remove duplicate static data in SerializationUtils.ClassLoaderAwareObjectInputStream.</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory, Henri Yandell, Fabrice Benhamouda">Reimplement RandomStringUtils on top of SecureRandom#getInstanceStrong() #1235.</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory, Henri Yandell, Fabrice Benhamouda">Reimplement RandomUtils and RandomStringUtils on top of SecureRandom#getInstanceStrong() #1235.</action>
|
||||
<action issue="LANG-1657" type="fix" dev="ggregory" due-to="Matthias Welz, Andrew Thomas, Gary Gregory">DiffBuilder: Type constraint for method append(..., DiffResult) too strict #786.</action>
|
||||
<!-- UPDATE -->
|
||||
<action type="update" dev="sebb" due-to="Dependabot, Gary Gregory">Bump commons-parent from 64 to 71 #1194, #1233.</action>
|
||||
|
|
|
@ -62,7 +62,7 @@ public class RandomStringUtils {
|
|||
}
|
||||
});
|
||||
|
||||
private static SecureRandom random() {
|
||||
static SecureRandom random() {
|
||||
return RANDOM.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,10 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* Utility library that supplements the standard {@link Random} class.
|
||||
*
|
||||
* <p>Caveat: Instances of {@link Random} are not cryptographically secure.</p>
|
||||
*
|
||||
* <p>Please note that the Apache Commons project provides a component
|
||||
* dedicated to pseudo-random number generation, namely
|
||||
* <a href="https://commons.apache.org/proper/commons-rng/">Commons RNG</a>, that may be
|
||||
|
@ -43,7 +40,7 @@ public class RandomUtils {
|
|||
* @since 3.5
|
||||
*/
|
||||
public static boolean nextBoolean() {
|
||||
return random().nextBoolean();
|
||||
return RandomStringUtils.random().nextBoolean();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,9 +53,8 @@ public class RandomUtils {
|
|||
*/
|
||||
public static byte[] nextBytes(final int count) {
|
||||
Validate.isTrue(count >= 0, "Count cannot be negative.");
|
||||
|
||||
final byte[] result = new byte[count];
|
||||
random().nextBytes(result);
|
||||
RandomStringUtils.random().nextBytes(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -89,12 +85,10 @@ public class RandomUtils {
|
|||
Validate.isTrue(endExclusive >= startInclusive,
|
||||
"Start value must be smaller or equal to end value.");
|
||||
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
|
||||
|
||||
if (startInclusive == endExclusive) {
|
||||
return startInclusive;
|
||||
}
|
||||
|
||||
return startInclusive + (endExclusive - startInclusive) * random().nextDouble();
|
||||
return startInclusive + (endExclusive - startInclusive) * RandomStringUtils.random().nextDouble();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,12 +118,10 @@ public class RandomUtils {
|
|||
Validate.isTrue(endExclusive >= startInclusive,
|
||||
"Start value must be smaller or equal to end value.");
|
||||
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
|
||||
|
||||
if (startInclusive == endExclusive) {
|
||||
return startInclusive;
|
||||
}
|
||||
|
||||
return startInclusive + (endExclusive - startInclusive) * random().nextFloat();
|
||||
return startInclusive + (endExclusive - startInclusive) * RandomStringUtils.random().nextFloat();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,12 +151,10 @@ public class RandomUtils {
|
|||
Validate.isTrue(endExclusive >= startInclusive,
|
||||
"Start value must be smaller or equal to end value.");
|
||||
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
|
||||
|
||||
if (startInclusive == endExclusive) {
|
||||
return startInclusive;
|
||||
}
|
||||
|
||||
return startInclusive + random().nextInt(endExclusive - startInclusive);
|
||||
return startInclusive + RandomStringUtils.random().nextInt(endExclusive - startInclusive);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,10 +181,9 @@ public class RandomUtils {
|
|||
long bits;
|
||||
long val;
|
||||
do {
|
||||
bits = random().nextLong() >>> 1;
|
||||
bits = RandomStringUtils.random().nextLong() >>> 1;
|
||||
val = bits % n;
|
||||
} while (bits - val + n - 1 < 0);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -214,18 +203,12 @@ public class RandomUtils {
|
|||
Validate.isTrue(endExclusive >= startInclusive,
|
||||
"Start value must be smaller or equal to end value.");
|
||||
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
|
||||
|
||||
if (startInclusive == endExclusive) {
|
||||
return startInclusive;
|
||||
}
|
||||
|
||||
return startInclusive + nextLong(endExclusive - startInclusive);
|
||||
}
|
||||
|
||||
private static ThreadLocalRandom random() {
|
||||
return ThreadLocalRandom.current();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link RandomUtils} instances should NOT be constructed in standard
|
||||
* programming. Instead, the class should be used as
|
||||
|
|
Loading…
Reference in New Issue