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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new c48ad2012c Make LookupContext#closeables thread safe (#12411)
c48ad2012c is described below

commit c48ad2012cdfcef53894a41c409c6c8cf4298496
Author: Stefan Oehme <[email protected]>
AuthorDate: Fri Jul 3 10:33:58 2026 +0200

    Make LookupContext#closeables thread safe (#12411)
    
    This collection is modified by multiple threads, e.g. the FastTerminal
    setup thread calling context.closeables.add(out::flush). This can result
    in closeables being lost and can make subsequent builds with the embedded
    runner fail.
    
    Signed-off-by: Stefan Oehme <[email protected]>
---
 .../src/main/java/org/apache/maven/cling/invoker/LookupContext.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupContext.java
 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupContext.java
index c3bbb98158..bf156b6949 100644
--- 
a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupContext.java
+++ 
b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/LookupContext.java
@@ -105,7 +105,7 @@ public LookupContext(InvokerRequest invokerRequest, boolean 
containerCapsuleMana
     public Settings effectiveSettings;
     public PersistedToolchains effectiveToolchains;
 
-    public final List<AutoCloseable> closeables = new ArrayList<>();
+    public final List<AutoCloseable> closeables = 
Collections.synchronizedList(new ArrayList<>());
 
     @Override
     public void close() throws InvokerException {

Reply via email to