Fixed broken pipe error.

Was caused by boat ids being over 1000 and when turned into xml having a comma placed between the hundreds and the thousands? So to fix, I just mad the max id number 999 so there should not be any issues regarding that if another broken pipe error occurs. Also switched to use the correct yacht constructor.

#story[1047]
This commit is contained in:
Kusal Ekanayake
2017-07-23 17:10:18 +12:00
parent 2e4382bff6
commit ffc61942a9
5 changed files with 16 additions and 18 deletions
@@ -273,7 +273,7 @@ public class ClientPacketParser {
long messageLength = bytesToLong(Arrays.copyOfRange(payload, 12, 14));
String xmlMessage = new String(
(Arrays.copyOfRange(payload, 14, (int) (14 + messageLength)))).trim();
System.out.println(xmlMessage);
//Create XML document Object
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
@@ -375,8 +375,6 @@ public class ClientPacketParser {
double lon = ((180d * (double) rawLon) / Math.pow(2, 31));
long heading = bytesToLong(Arrays.copyOfRange(payload, 28, 30));
double groundSpeed = bytesToLong(Arrays.copyOfRange(payload, 38, 40)) / 1000.0;
System.out.println("boats = " + boats.values());
System.out.println("boats = " + boats.keySet());
//type 1 is a racing yacht and type 3 is a mark, needed for updating positions of the mark and boat
if (deviceType == 1){
Yacht boat = boats.get((int) boatId);