aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-12-24 11:58:35 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-12-24 11:58:35 +1300
commit44e8c9ea649d9017621238dab033892b94494ba5 (patch)
tree6e51a3ad34b5cd074bfc7b9d1759b82922cc1308 /src/org/traccar
parent236cf16939a6e0b4c5268926733ced6235dec70d (diff)
downloadtraccar-server-44e8c9ea649d9017621238dab033892b94494ba5.tar.gz
traccar-server-44e8c9ea649d9017621238dab033892b94494ba5.tar.bz2
traccar-server-44e8c9ea649d9017621238dab033892b94494ba5.zip
Fix concurrent list modification
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/GalileoProtocolDecoder.java19
1 files changed, 7 insertions, 12 deletions
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<Position> 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;
}