From eccadb44f18bb01cc7350859d0688dec2105bba6 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 20 Apr 2009 16:26:02 +0000 Subject: [PATCH] bugfix: must lock active connections before copying --- .../se/sics/cooja/radiomediums/AbstractRadioMedium.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/radiomediums/AbstractRadioMedium.java b/tools/cooja/java/se/sics/cooja/radiomediums/AbstractRadioMedium.java index 3d0fdd2d6..cf4b070c6 100644 --- a/tools/cooja/java/se/sics/cooja/radiomediums/AbstractRadioMedium.java +++ b/tools/cooja/java/se/sics/cooja/radiomediums/AbstractRadioMedium.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: AbstractRadioMedium.java,v 1.8 2009/03/26 16:24:31 fros4943 Exp $ + * $Id: AbstractRadioMedium.java,v 1.9 2009/04/20 16:26:02 fros4943 Exp $ */ package se.sics.cooja.radiomediums; @@ -98,9 +98,8 @@ public abstract class AbstractRadioMedium extends RadioMedium { * @return All active connections */ public RadioConnection[] getActiveConnections() { - RadioConnection[] active = new RadioConnection[activeConnections.size()]; - activeConnections.toArray(active); - return active; + /* NOTE: toArray([0]) creates array and handles synchronization */ + return activeConnections.toArray(new RadioConnection[0]); } /**