[commons-lang] branch master updated: Javadoc.

2021-12-04 Thread ggregory
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


The following commit(s) were added to refs/heads/master by this push:
 new 656d202  Javadoc.
656d202 is described below

commit 656d2023dcd149018cd126e283f675b4ffef9715
Author: Gary Gregory 
AuthorDate: Sat Dec 4 10:41:38 2021 -0500

Javadoc.
---
 src/main/java/org/apache/commons/lang3/Streams.java | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/main/java/org/apache/commons/lang3/Streams.java 
b/src/main/java/org/apache/commons/lang3/Streams.java
index 5c14901..d9227d3 100644
--- a/src/main/java/org/apache/commons/lang3/Streams.java
+++ b/src/main/java/org/apache/commons/lang3/Streams.java
@@ -86,12 +86,22 @@ public class Streams {
 this.stream = stream;
 }
 
+/**
+ * Throws IllegalStateException if this stream is already terminated.
+ *
+ * @throws IllegalStateException if this stream is already terminated.
+ */
 protected void assertNotTerminated() {
 if (terminated) {
 throw new IllegalStateException("This stream is already 
terminated.");
 }
 }
 
+/**
+ * Marks this stream as terminated.
+ *
+ * @throws IllegalStateException if this stream is already terminated.
+ */
 protected void makeTerminated() {
 assertNotTerminated();
 terminated = true;


[commons-lang] branch master updated: Remove unnecessary @SuppressWarnings("unchecked").

2021-12-04 Thread ggregory
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


The following commit(s) were added to refs/heads/master by this push:
 new ad1a8c9  Remove unnecessary @SuppressWarnings("unchecked").
ad1a8c9 is described below

commit ad1a8c937e0ecc3167dbd202b4129c1fe0c062ff
Author: Gary Gregory 
AuthorDate: Sat Dec 4 10:39:24 2021 -0500

Remove unnecessary @SuppressWarnings("unchecked").
---
 src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java   | 1 -
 src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java 
b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
index e5a8dab..ef20541 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutablePair.java
@@ -93,7 +93,6 @@ public final class ImmutablePair extends Pair {
  * @return an immutable pair of nulls.
  * @since 3.6
  */
-@SuppressWarnings("unchecked")
 public static  ImmutablePair nullPair() {
 return NULL;
 }
diff --git a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java 
b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
index d3b65ec..b8aad55 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/ImmutableTriple.java
@@ -78,7 +78,6 @@ public final class ImmutableTriple extends Triple {
  * @return an immutable triple of nulls.
  * @since 3.6
  */
-@SuppressWarnings("unchecked")
 public static  ImmutableTriple nullTriple() {
 return NULL;
 }


[commons-vfs] branch master updated: Fix NullPointerException when the current thread is stopped.

2021-12-04 Thread ggregory
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-vfs.git


The following commit(s) were added to refs/heads/master by this push:
 new 2f3fe3c  Fix NullPointerException when the current thread is stopped.
2f3fe3c is described below

commit 2f3fe3c6b5dc3b4f5019feba37131f9ec242f6f4
Author: Gary Gregory 
AuthorDate: Sat Dec 4 10:11:16 2021 -0500

Fix NullPointerException when the current thread is stopped.
---
 .../src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java   | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
index 4d9d442..8500ae3 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractTestSuite.java
@@ -133,6 +133,9 @@ public abstract class AbstractTestSuite extends TestSetup {
 
 private Thread[] createThreadSnapshot() {
 ThreadGroup tg = Thread.currentThread().getThreadGroup();
+if (tg == null) {
+return EMPTY_THREAD_ARRAY;
+}
 while (tg.getParent() != null) {
 tg = tg.getParent();
 }


[commons-lang] 02/03: Better param names.

2021-12-04 Thread ggregory
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 49cfcc2c479e606bfb9b1b26f50b63397222d965
Author: Gary Gregory 
AuthorDate: Sat Dec 4 10:02:28 2021 -0500

Better param names.
---
 .../java/org/apache/commons/lang3/ThreadUtils.java   | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java 
b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
index 15b13a4..db9c6c6 100644
--- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
@@ -213,7 +213,7 @@ public class ThreadUtils {
 /**
  * Select all active thread groups which match the given predicate and 
which is a subgroup of the given thread group (or one of its subgroups).
  *
- * @param group the thread group
+ * @param threadGroup the thread group
  * @param recurse if {@code true} then evaluate the predicate recursively 
on all thread groups in all subgroups of the given group
  * @param predicate the predicate
  * @return An unmodifiable {@code Collection} of active thread groups 
which match the given predicate and which is a subgroup of the given thread 
group
@@ -221,15 +221,15 @@ public class ThreadUtils {
  * @throws  SecurityException  if the current thread cannot modify
  *  thread groups from this thread's thread group up to the system 
thread group
  */
-public static Collection findThreadGroups(final ThreadGroup 
group, final boolean recurse, final ThreadGroupPredicate predicate) {
-Validate.notNull(group, "group");
+public static Collection findThreadGroups(final ThreadGroup 
threadGroup, final boolean recurse, final ThreadGroupPredicate predicate) {
+Validate.notNull(threadGroup, "group");
 Validate.notNull(predicate, "predicate");
 
-int count = group.activeGroupCount();
+int count = threadGroup.activeGroupCount();
 ThreadGroup[] threadGroups;
 do {
 threadGroups = new ThreadGroup[count + (count / 2) + 1]; 
//slightly grow the array size
-count = group.enumerate(threadGroups, recurse);
+count = threadGroup.enumerate(threadGroups, recurse);
 //return value of enumerate() must be strictly less than the array 
size according to javadoc
 } while (count >= threadGroups.length);
 
@@ -276,7 +276,7 @@ public class ThreadUtils {
 /**
  * Select all active threads which match the given predicate and which 
belongs to the given thread group (or one of its subgroups).
  *
- * @param group the thread group
+ * @param threadGroup the thread group
  * @param recurse if {@code true} then evaluate the predicate recursively 
on all threads in all subgroups of the given group
  * @param predicate the predicate
  * @return An unmodifiable {@code Collection} of active threads which 
match the given predicate and which belongs to the given thread group
@@ -284,15 +284,15 @@ public class ThreadUtils {
  * @throws  SecurityException  if the current thread cannot modify
  *  thread groups from this thread's thread group up to the system 
thread group
  */
-public static Collection findThreads(final ThreadGroup group, 
final boolean recurse, final ThreadPredicate predicate) {
-Validate.notNull(group, "The group must not be null");
+public static Collection findThreads(final ThreadGroup 
threadGroup, final boolean recurse, final ThreadPredicate predicate) {
+Validate.notNull(threadGroup, "The group must not be null");
 Validate.notNull(predicate, "The predicate must not be null");
 
-int count = group.activeCount();
+int count = threadGroup.activeCount();
 Thread[] threads;
 do {
 threads = new Thread[count + (count / 2) + 1]; //slightly grow the 
array size
-count = group.enumerate(threads, recurse);
+count = threadGroup.enumerate(threads, recurse);
 //return value of enumerate() must be strictly less than the array 
size according to javadoc
 } while (count >= threads.length);
 


[commons-lang] 01/03: Javadoc typos.

2021-12-04 Thread ggregory
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 bf48d8a53cc6f4e702412dd864a8741f2a06ea36
Author: Gary Gregory 
AuthorDate: Sat Dec 4 09:58:57 2021 -0500

Javadoc typos.
---
 .../java/org/apache/commons/lang3/ThreadUtils.java   | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java 
b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
index 3b53a5c..15b13a4 100644
--- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
@@ -58,7 +58,7 @@ public class ThreadUtils {
 }
 
 /**
- * A predicate implementation which matches a thread or threadgroup name.
+ * A predicate implementation which matches a thread or thread group name.
  */
 public static class NamePredicate implements ThreadPredicate, 
ThreadGroupPredicate {
 
@@ -67,7 +67,7 @@ public class ThreadUtils {
 /**
  * Predicate constructor
  *
- * @param name thread or threadgroup name
+ * @param name thread or thread group name
  * @throws IllegalArgumentException if the name is {@code null}
  */
 public NamePredicate(final String name) {
@@ -87,15 +87,15 @@ public class ThreadUtils {
 }
 
 /**
- * A predicate for selecting threadgroups.
+ * A predicate for selecting thread groups.
  */
 // When breaking BC, replace this with Predicate
 @FunctionalInterface
 public interface ThreadGroupPredicate {
 
 /**
- * Evaluates this predicate on the given threadgroup.
- * @param threadGroup the threadgroup
+ * Evaluates this predicate on the given thread group.
+ * @param threadGroup the thread group
  * @return {@code true} if the threadGroup matches the predicate, 
otherwise {@code false}
  */
 boolean test(ThreadGroup threadGroup);
@@ -211,12 +211,12 @@ public class ThreadUtils {
 }
 
 /**
- * Select all active threadgroups which match the given predicate and 
which is a subgroup of the given thread group (or one of its subgroups).
+ * Select all active thread groups which match the given predicate and 
which is a subgroup of the given thread group (or one of its subgroups).
  *
  * @param group the thread group
- * @param recurse if {@code true} then evaluate the predicate recursively 
on all threadgroups in all subgroups of the given group
+ * @param recurse if {@code true} then evaluate the predicate recursively 
on all thread groups in all subgroups of the given group
  * @param predicate the predicate
- * @return An unmodifiable {@code Collection} of active threadgroups which 
match the given predicate and which is a subgroup of the given thread group
+ * @return An unmodifiable {@code Collection} of active thread groups 
which match the given predicate and which is a subgroup of the given thread 
group
  * @throws IllegalArgumentException if the given group or predicate is null
  * @throws  SecurityException  if the current thread cannot modify
  *  thread groups from this thread's thread group up to the system 
thread group
@@ -243,10 +243,10 @@ public class ThreadUtils {
 }
 
 /**
- * Select all active threadgroups which match the given predicate.
+ * Select all active thread groups which match the given predicate.
  *
  * @param predicate the predicate
- * @return An unmodifiable {@code Collection} of active threadgroups 
matching the given predicate
+ * @return An unmodifiable {@code Collection} of active thread groups 
matching the given predicate
  * @throws IllegalArgumentException if the predicate is null
  * @throws  SecurityException
  *  if the current thread cannot access the system thread group


[commons-lang] 03/03: Fix NullPointerException in ThreadUtils.getSystemThreadGroup() when the current thread is stopped.

2021-12-04 Thread ggregory
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 45d454b3e7aeccfadf855dda8bdfca93d90fef0c
Author: Gary Gregory 
AuthorDate: Sat Dec 4 10:07:30 2021 -0500

Fix NullPointerException in ThreadUtils.getSystemThreadGroup() when the
current thread is stopped.
---
 src/changes/changes.xml | 1 +
 src/main/java/org/apache/commons/lang3/ThreadUtils.java | 9 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index de2be06..5a50f59 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,7 @@ The  type attribute can be add,update,fix,remove.
 Use final and Remove redundant String. #813, #816.
 Use Set instead of List for checking the contains() 
method #734.
 Javadoc for StringUtils.substringBefore(String str, int separator) 
doesn't mention that the separator is an int.
+Fix NullPointerException in ThreadUtils.getSystemThreadGroup() when 
the current thread is stopped.
 
 Add EnumUtils.getEnumSystemProperty(...).
 Add TriConsumer.
diff --git a/src/main/java/org/apache/commons/lang3/ThreadUtils.java 
b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
index db9c6c6..f8b8587 100644
--- a/src/main/java/org/apache/commons/lang3/ThreadUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ThreadUtils.java
@@ -417,14 +417,17 @@ public class ThreadUtils {
 
 /**
  * Gets the system thread group (sometimes also referred as "root thread 
group").
+ * 
+ * This method returns null if this thread has died (been stopped).
+ * 
  *
  * @return the system thread group
- * @throws  SecurityException  if the current thread cannot modify
- *  thread groups from this thread's thread group up to the system 
thread group
+ * @throws SecurityException if the current thread cannot modify thread 
groups from this thread's thread group up to the
+ * system thread group
  */
 public static ThreadGroup getSystemThreadGroup() {
 ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
-while (threadGroup.getParent() != null) {
+while (threadGroup != null && threadGroup.getParent() != null) {
 threadGroup = threadGroup.getParent();
 }
 return threadGroup;


[commons-lang] branch master updated (69941d9 -> 45d454b)

2021-12-04 Thread ggregory
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 69941d9  Fix PMD: Avoid using a branching statement as the last in a 
loop.
 new bf48d8a  Javadoc typos.
 new 49cfcc2  Better param names.
 new 45d454b  Fix NullPointerException in 
ThreadUtils.getSystemThreadGroup() when the current thread is stopped.

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:
 src/changes/changes.xml|  1 +
 .../java/org/apache/commons/lang3/ThreadUtils.java | 49 --
 2 files changed, 27 insertions(+), 23 deletions(-)


[commons-lang] 02/02: Fix PMD: Avoid using a branching statement as the last in a loop.

2021-12-04 Thread ggregory
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 69941d96c49f5ac552aea8630dd4f18c6821ebc8
Author: Gary Gregory 
AuthorDate: Sat Dec 4 09:51:55 2021 -0500

Fix PMD: Avoid using a branching statement as the last in a loop.
---
 .../java/org/apache/commons/lang3/reflect/TypeUtils.java   | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java 
b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
index bb35fa2..aa854c3 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java
@@ -1799,24 +1799,22 @@ public class TypeUtils {
 }
 
 /**
- * Look up {@code var} in {@code typeVarAssigns} transitively,
- * i.e. keep looking until the value found is not a type variable.
+ * Looks up {@code typeVariable} in {@code typeVarAssigns} 
transitively, i.e. keep looking until the value
+ * found is not a type variable.
  *
  * @param typeVariable the type variable to look up
  * @param typeVarAssigns the map used for the look up
  * @return Type or {@code null} if some variable was not in the map
  * @since 3.2
  */
-private static Type unrollVariableAssignments(TypeVariable typeVariable,
-final Map, Type> typeVarAssigns) {
+private static Type unrollVariableAssignments(TypeVariable 
typeVariable, final Map, Type> typeVarAssigns) {
 Type result;
 do {
 result = typeVarAssigns.get(typeVariable);
-if (result instanceof TypeVariable && 
!result.equals(typeVariable)) {
-typeVariable = (TypeVariable) result;
-continue;
+if (!(result instanceof TypeVariable) || 
result.equals(typeVariable)) {
+break;
 }
-break;
+typeVariable = (TypeVariable) result;
 } while (true);
 return result;
 }


[commons-lang] branch master updated (e6ae756 -> 69941d9)

2021-12-04 Thread ggregory
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 e6ae756  Add Streams.instancesOf(Class, Collection).
 new 972bf05  Refactor internals.
 new 69941d9  Fix PMD: Avoid using a branching statement as the last in a 
loop.

The 2 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:
 .../java/org/apache/commons/lang3/reflect/TypeUtils.java   | 14 ++
 src/main/java/org/apache/commons/lang3/stream/Streams.java |  8 ++--
 2 files changed, 12 insertions(+), 10 deletions(-)


[commons-lang] 01/02: Refactor internals.

2021-12-04 Thread ggregory
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 972bf05adea62b912984e1c06a990c815c0e901e
Author: Gary Gregory 
AuthorDate: Sat Dec 4 09:15:17 2021 -0500

Refactor internals.
---
 src/main/java/org/apache/commons/lang3/stream/Streams.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/stream/Streams.java 
b/src/main/java/org/apache/commons/lang3/stream/Streams.java
index f38f092..ff487b9 100644
--- a/src/main/java/org/apache/commons/lang3/stream/Streams.java
+++ b/src/main/java/org/apache/commons/lang3/stream/Streams.java
@@ -551,9 +551,13 @@ public class Streams {
  * @return A non-null stream that only provides instances we want.
  * @since 3.13.0
  */
+public static  Stream instancesOf(final Class clazz, 
final Collection collection) {
+return instancesOf(clazz, toStream(collection));
+}
+
 @SuppressWarnings("unchecked") // After the isInstance check, we still 
need to type-cast.
-public static  Stream instancesOf(Class clazz, 
Collection collection) {
-return (Stream) filter(collection, clazz::isInstance);
+private static  Stream instancesOf(final Class clazz, 
final Stream stream) {
+return (Stream) stream.filter(clazz::isInstance);
 }
 
 /**