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-exec.git
commit a3ce9400df261985398f70c08a4e3501cdd94076 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat May 24 10:03:48 2025 -0400 Migrate internal type declaration from class Vector to interface List - Actual type is still Vector for now --- src/main/java/org/apache/commons/exec/CommandLine.java | 4 ++-- .../java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java | 7 ++++--- src/main/java/org/apache/commons/exec/Watchdog.java | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/exec/CommandLine.java b/src/main/java/org/apache/commons/exec/CommandLine.java index 528f03df..9c20e946 100644 --- a/src/main/java/org/apache/commons/exec/CommandLine.java +++ b/src/main/java/org/apache/commons/exec/CommandLine.java @@ -23,6 +23,7 @@ import java.io.File; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; import java.util.StringTokenizer; @@ -175,7 +176,7 @@ public class CommandLine { /** * The arguments of the command. */ - private final Vector<Argument> arguments = new Vector<>(); + private final List<Argument> arguments = new Vector<>(); /** * The program to execute. @@ -201,7 +202,6 @@ public class CommandLine { this.executable = other.getExecutable(); this.isFile = other.isFile(); this.arguments.addAll(other.arguments); - if (other.getSubstitutionMap() != null) { this.substitutionMap = new HashMap<>(other.getSubstitutionMap()); } diff --git a/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java b/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java index cc22ed73..ec823e5e 100644 --- a/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java +++ b/src/main/java/org/apache/commons/exec/ShutdownHookProcessDestroyer.java @@ -19,6 +19,7 @@ package org.apache.commons.exec; +import java.util.List; import java.util.Vector; import java.util.concurrent.atomic.AtomicBoolean; @@ -48,7 +49,7 @@ public class ShutdownHookProcessDestroyer implements ProcessDestroyer, Runnable } /** The list of currently running processes. */ - private final Vector<Process> processes = new Vector<>(); + private final List<Process> processes = new Vector<>(); /** The thread registered at the JVM to execute the shutdown handler. */ private ProcessDestroyerThread destroyProcessThread; @@ -83,7 +84,7 @@ public class ShutdownHookProcessDestroyer implements ProcessDestroyer, Runnable if (processes.isEmpty()) { addShutdownHook(); } - processes.addElement(process); + processes.add(process); return processes.contains(process); } } @@ -127,7 +128,7 @@ public class ShutdownHookProcessDestroyer implements ProcessDestroyer, Runnable @Override public boolean remove(final Process process) { synchronized (processes) { - final boolean processRemoved = processes.removeElement(process); + final boolean processRemoved = processes.remove(process); if (processRemoved && processes.isEmpty()) { removeShutdownHook(); } diff --git a/src/main/java/org/apache/commons/exec/Watchdog.java b/src/main/java/org/apache/commons/exec/Watchdog.java index af650d41..ac245677 100644 --- a/src/main/java/org/apache/commons/exec/Watchdog.java +++ b/src/main/java/org/apache/commons/exec/Watchdog.java @@ -20,6 +20,7 @@ package org.apache.commons.exec; import java.time.Duration; +import java.util.List; import java.util.Vector; import java.util.concurrent.ThreadFactory; import java.util.function.Supplier; @@ -92,7 +93,7 @@ public class Watchdog implements Runnable { return new Builder(); } - private final Vector<TimeoutObserver> observers = new Vector<>(1); + private final List<TimeoutObserver> observers = new Vector<>(1); private final long timeoutMillis; @@ -134,7 +135,7 @@ public class Watchdog implements Runnable { * @param to a TimeoutObserver to add. */ public void addTimeoutObserver(final TimeoutObserver to) { - observers.addElement(to); + observers.add(to); } /** @@ -150,7 +151,7 @@ public class Watchdog implements Runnable { * @param to a TimeoutObserver to remove. */ public void removeTimeoutObserver(final TimeoutObserver to) { - observers.removeElement(to); + observers.remove(to); } @Override