From 44e8c9ea649d9017621238dab033892b94494ba5 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 24 Dec 2014 11:58:35 +1300 Subject: Fix concurrent list modification --- src/org/traccar/protocol/GalileoProtocolDecoder.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index dc22c33cd..0fa881949 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -17,14 +17,7 @@ package org.traccar.protocol; import java.nio.ByteOrder; import java.nio.charset.Charset; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; +import java.util.*; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; @@ -178,8 +171,10 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } sendReply(channel, buf.readUnsignedShort()); - - for (Position p : positions) { + + for (Iterator i = positions.iterator(); i.hasNext(); ) { + Position p = i.next(); + p.setDeviceId(deviceId); if (p.getAltitude() == null) { @@ -187,10 +182,10 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { } if (p.getValid() == null || p.getTime() == null || p.getSpeed() == null) { - positions.remove(p); + i.remove(); } } - + if (positions.isEmpty()) { return null; } -- cgit v1.2.3