diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java index 05570538c..23c78be38 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/accessors/map/ProcessedMapRepositoryImpl.java @@ -104,9 +104,10 @@ public List getIntersectionIDs() { MongoCursor results = docs.iterator(); List referenceDataList = new ArrayList<>(); while (results.hasNext()) { + Integer intersectionId = results.next(); - if (intersectionId != null){ - + if (intersectionId != null){ + Bson projectionFields = Projections.fields( Projections.include("properties.intersectionId", "properties.originIp", "properties.refPoint.latitude", "properties.refPoint.longitude", "properties.intersectionName"), @@ -125,10 +126,10 @@ public List getIntersectionIDs() { data.setRoadRegulatorID("-1"); data.setRsuIP(properties.getString("originIp")); - if(properties.getString("intersectionName").isEmpty()){ - + if(properties.getString("intersectionName") != null && properties.getString("intersectionName").isEmpty()){ + data.setIntersectionName(properties.getString("intersectionName")); } - data.setIntersectionName(properties.getString("intersectionName")); + if (refPoint != null) { data.setLatitude(refPoint.getDouble("latitude")); data.setLongitude(refPoint.getDouble("longitude")); @@ -139,7 +140,7 @@ public List getIntersectionIDs() { } catch (MongoException e){ logger.error("MongoDB Intersection Query Did not finish in allowed time window"); } catch (Exception e) { - logger.error(""); + logger.error(e.getMessage()); } } diff --git a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java index cb20628ec..18a5c2845 100644 --- a/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java +++ b/jpo-conflictvisualizer-api/src/main/java/us/dot/its/jpo/ode/api/controllers/StompController.java @@ -41,7 +41,7 @@ public void broadcastSpat(ProcessedSpat spat) { } if (intersectionID != -1) { - broadcastMessage(buildTopicName(roadRegulatorID, intersectionID, "spat"), spat.toString()); + broadcastMessage(buildTopicName(-1, intersectionID, "spat"), spat.toString()); } } @@ -57,7 +57,7 @@ public void broadcastMap(ProcessedMap map) { } if (intersectionID != -1) { - broadcastMessage(buildTopicName(roadRegulatorID, intersectionID, "map"), map.toString()); + broadcastMessage(buildTopicName(-1, intersectionID, "map"), map.toString()); } }