You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/08/08 11:25:29 UTC

(commons-lang) branch master updated (0d9bda896 -> 69cb99626)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


    from 0d9bda896 Javadoc
     new 956c795f2 Make RandomUtils.insecure() public
     new f3de6a463 Deprecate static RandomUtils.next*() methods in favor or .secure() and .insecure() versions
     new 69cb99626 Deprecate static RandomStringUtils.random*() methods in favor or .secure() and .insecure() versions

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            | 10 +++---
 src/changes/changes.xml                            |  3 ++
 .../apache/commons/lang3/RandomStringUtils.java    | 38 ++++++++++++++++++++++
 .../java/org/apache/commons/lang3/RandomUtils.java | 22 +++++++++++++
 4 files changed, 68 insertions(+), 5 deletions(-)


(commons-lang) 03/03: Deprecate static RandomStringUtils.random*() methods in favor or .secure() and .insecure() versions

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 69cb996265ba603e0be5b1c98097775f2467a6c2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 8 07:25:21 2024 -0400

    Deprecate static RandomStringUtils.random*() methods in favor or
    .secure() and .insecure() versions
---
 src/changes/changes.xml                            |  1 +
 .../apache/commons/lang3/RandomStringUtils.java    | 38 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 862e4225b..e6ac9e638 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,7 @@ The <action> type attribute can be add,update,fix,remove.
   <release version="3.16.1" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
     <!-- FIX -->
     <action                   type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate static RandomUtils.next*() methods in favor or .secure() and .insecure() versions.</action>
+    <action                   type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate static RandomStringUtils.random*() methods in favor or .secure() and .insecure() versions.</action>
     <!-- ADD -->
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Make RandomUtils.insecure() public.</action>
     <!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
index d64ec5ebf..37b243d37 100644
--- a/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/RandomStringUtils.java
@@ -107,7 +107,9 @@ public class RandomStringUtils {
      * @param count the length of random string to create
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count) {
         return secure().next(count);
     }
@@ -124,7 +126,9 @@ public class RandomStringUtils {
      * @param numbers if {@code true}, generated string may include numeric characters
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count, final boolean letters, final boolean numbers) {
         return secure().next(count, letters, numbers);
     }
@@ -140,7 +144,9 @@ public class RandomStringUtils {
      * @param chars the character array containing the set of characters to use, may be null
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count, final char... chars) {
         return secure().next(count, chars);
     }
@@ -159,7 +165,9 @@ public class RandomStringUtils {
      * @param numbers if {@code true}, generated string may include numeric characters
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count, final int start, final int end, final boolean letters,
             final boolean numbers) {
         return secure().next(count, start, end, letters, numbers);
@@ -183,7 +191,9 @@ public class RandomStringUtils {
      * @return the random string
      * @throws ArrayIndexOutOfBoundsException if there are not {@code (end - start) + 1} characters in the set array.
      * @throws IllegalArgumentException       if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count, final int start, final int end, final boolean letters,
             final boolean numbers, final char... chars) {
         return secure().next(count, start, end, letters, numbers, chars);
@@ -219,7 +229,9 @@ public class RandomStringUtils {
      * @throws ArrayIndexOutOfBoundsException if there are not {@code (end - start) + 1} characters in the set array.
      * @throws IllegalArgumentException       if {@code count} &lt; 0 or the provided chars array is empty.
      * @since 2.0
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(int count, int start, int end, final boolean letters, final boolean numbers,
             final char[] chars, final Random random) {
         if (count == 0) {
@@ -361,7 +373,9 @@ public class RandomStringUtils {
      * @param chars the String containing the set of characters to use, may be null, but must not be empty
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0 or the string is empty.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String random(final int count, final String chars) {
         return secure().next(count, chars);
     }
@@ -376,7 +390,9 @@ public class RandomStringUtils {
      * @param count the length of random string to create
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAlphabetic(final int count) {
         return secure().nextAlphabetic(count);
     }
@@ -392,7 +408,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAlphabetic(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextAlphabetic(minLengthInclusive, maxLengthExclusive);
     }
@@ -407,7 +425,9 @@ public class RandomStringUtils {
      * @param count the length of random string to create
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAlphanumeric(final int count) {
         return secure().nextAlphanumeric(count);
     }
@@ -423,7 +443,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAlphanumeric(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextAlphanumeric(minLengthInclusive, maxLengthExclusive);
     }
@@ -439,7 +461,9 @@ public class RandomStringUtils {
      * @param count the length of random string to create
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAscii(final int count) {
         return secure().nextAscii(count);
     }
@@ -456,7 +480,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomAscii(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextAscii(minLengthInclusive, maxLengthExclusive);
     }
@@ -473,7 +499,9 @@ public class RandomStringUtils {
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomGraph(final int count) {
         return secure().nextGraph(count);
     }
@@ -489,7 +517,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomGraph(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextGraph(minLengthInclusive, maxLengthExclusive);
     }
@@ -504,7 +534,9 @@ public class RandomStringUtils {
      * @param count the length of random string to create
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomNumeric(final int count) {
         return secure().nextNumeric(count);
     }
@@ -520,7 +552,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomNumeric(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextNumeric(minLengthInclusive, maxLengthExclusive);
     }
@@ -537,7 +571,9 @@ public class RandomStringUtils {
      * @return the random string
      * @throws IllegalArgumentException if {@code count} &lt; 0.
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomPrint(final int count) {
         return secure().nextPrint(count);
     }
@@ -553,7 +589,9 @@ public class RandomStringUtils {
      * @param maxLengthExclusive the exclusive maximum length of the string to generate
      * @return the random string
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static String randomPrint(final int minLengthInclusive, final int maxLengthExclusive) {
         return secure().nextPrint(minLengthInclusive, maxLengthExclusive);
     }


(commons-lang) 01/03: Make RandomUtils.insecure() public

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 956c795f2949dd3afdab93fa1ee6eb1ba84e8b6b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 8 07:24:37 2024 -0400

    Make RandomUtils.insecure() public
---
 pom.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5f353edfc..de977dd11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>commons-lang3</artifactId>
-  <version>3.16.1-SNAPSHOT</version>
+  <version>3.17.0-SNAPSHOT</version>
   <name>Apache Commons Lang</name>
 
   <inceptionYear>2001</inceptionYear>
@@ -53,7 +53,7 @@
     <connection>scm:git:http://gitbox.apache.org/repos/asf/commons-lang.git</connection>
     <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/commons-lang.git</developerConnection>
     <url>https://gitbox.apache.org/repos/asf?p=commons-lang.git</url>
-    <tag>rel/commons-lang-3.15.0</tag>
+    <tag>rel/commons-lang-3.17.0</tag>
   </scm>
 
   <!-- Lang should depend on very little -->
@@ -142,8 +142,8 @@
     <commons.packageId>lang3</commons.packageId>
     <commons.module.name>org.apache.commons.lang3</commons.module.name>
     <!-- Current 3.x release series -->
-    <commons.release.version>3.16.0</commons.release.version>
-    <commons.release.next>3.16.1</commons.release.next>
+    <commons.release.version>3.17.0</commons.release.version>
+    <commons.release.next>3.17.1</commons.release.next>
     <commons.release.desc>(Java 8+)</commons.release.desc>
     <!-- Previous 2.x release series -->
     <commons.release.2.version>2.6</commons.release.2.version>
@@ -166,7 +166,7 @@
     <uberjar.name>benchmarks</uberjar.name>
 
     <!-- Commons Release Plugin -->
-    <commons.bc.version>3.15.0</commons.bc.version>
+    <commons.bc.version>3.16.0</commons.bc.version>
     <commons.rc.version>RC1</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>


(commons-lang) 02/03: Deprecate static RandomUtils.next*() methods in favor or .secure() and .insecure() versions

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit f3de6a4633976753c931fb008e7de704581a49fd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 8 07:24:43 2024 -0400

    Deprecate static RandomUtils.next*() methods in favor or .secure() and
    .insecure() versions
---
 src/changes/changes.xml                            |  2 ++
 .../java/org/apache/commons/lang3/RandomUtils.java | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 01e7a86d8..862e4225b 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,8 @@ The <action> type attribute can be add,update,fix,remove.
   </properties>
   <body>
   <release version="3.16.1" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
+    <!-- FIX -->
+    <action                   type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate static RandomUtils.next*() methods in favor or .secure() and .insecure() versions.</action>
     <!-- ADD -->
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Make RandomUtils.insecure() public.</action>
     <!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/lang3/RandomUtils.java b/src/main/java/org/apache/commons/lang3/RandomUtils.java
index 96ae715ed..c0ef5f246 100644
--- a/src/main/java/org/apache/commons/lang3/RandomUtils.java
+++ b/src/main/java/org/apache/commons/lang3/RandomUtils.java
@@ -92,7 +92,9 @@ public class RandomUtils {
      *
      * @return the random boolean
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static boolean nextBoolean() {
         return secure().randomBoolean();
     }
@@ -103,7 +105,9 @@ public class RandomUtils {
      * @param count the size of the returned array
      * @return the random byte array
      * @throws IllegalArgumentException if {@code count} is negative
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static byte[] nextBytes(final int count) {
         return secure().randomBytes(count);
     }
@@ -114,7 +118,9 @@ public class RandomUtils {
      * @return the random double
      * @see #nextDouble(double, double)
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static double nextDouble() {
         return secure().randomDouble();
     }
@@ -127,7 +133,9 @@ public class RandomUtils {
      * @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
      *                                  negative
      * @return the random double
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static double nextDouble(final double startInclusive, final double endExclusive) {
         return secure().randomDouble(startInclusive, endExclusive);
     }
@@ -138,7 +146,9 @@ public class RandomUtils {
      * @return the random float
      * @see #nextFloat(float, float)
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static float nextFloat() {
         return secure().randomFloat();
     }
@@ -151,7 +161,9 @@ public class RandomUtils {
      * @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
      *                                  negative
      * @return the random float
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static float nextFloat(final float startInclusive, final float endExclusive) {
         return secure().randomFloat(startInclusive, endExclusive);
     }
@@ -162,7 +174,9 @@ public class RandomUtils {
      * @return the random integer
      * @see #nextInt(int, int)
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static int nextInt() {
         return secure().randomInt();
     }
@@ -175,7 +189,9 @@ public class RandomUtils {
      * @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
      *                                  negative
      * @return the random integer
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static int nextInt(final int startInclusive, final int endExclusive) {
         return secure().randomInt(startInclusive, endExclusive);
     }
@@ -186,7 +202,9 @@ public class RandomUtils {
      * @return the random long
      * @see #nextLong(long, long)
      * @since 3.5
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static long nextLong() {
         return secure().randomLong();
     }
@@ -196,7 +214,9 @@ public class RandomUtils {
      *
      * @param n Bound on the random number to be returned. Must be positive.
      * @return a random {@code long} value between 0 (inclusive) and {@code n} (exclusive).
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     private static long nextLong(final long n) {
         return secure().randomLong(n);
     }
@@ -209,7 +229,9 @@ public class RandomUtils {
      * @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
      *                                  negative
      * @return the random long
+     * @deprecated Use {@link #secure()} or {@link #insecure()}.
      */
+    @Deprecated
     public static long nextLong(final long startInclusive, final long endExclusive) {
         return secure().randomLong(startInclusive, endExclusive);
     }