Avoid potential thread safety issues in LogCapturer

This commit is contained in:
Jaikiran Pai 2018-05-14 11:13:26 +05:30
parent e22525b321
commit 2014f42d7e
1 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ package org.apache.ant.antunit;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Collections;
import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.BuildListener;
@ -40,7 +41,7 @@ import org.apache.tools.ant.util.StringUtils;
public class LogCapturer implements BuildListener { public class LogCapturer implements BuildListener {
public static final String REFERENCE_ID = "ant.antunit.log"; public static final String REFERENCE_ID = "ant.antunit.log";
private List/*<BuildEvent>*/ events = new LinkedList(); private List/*<BuildEvent>*/ events = Collections.synchronizedList(new LinkedList());
private Project p; private Project p;
public LogCapturer(Project p) { public LogCapturer(Project p) {