Skip to content

Commit

Permalink
Fixed null pointer exception, address sonar code smells about
Browse files Browse the repository at this point in the history
logger calls
  • Loading branch information
paulbourelly999 committed Sep 8, 2023
1 parent 6cba85a commit 9c96647
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,20 +295,26 @@ public synchronized void processTimeAdvanceGrant(long time) throws InternalFeder
List<InfrastructureRegistrationMessage> newRegistrations = infrastructureRegistrationReceiver
.getReceivedMessages();
for (InfrastructureRegistrationMessage reg : newRegistrations) {
log.info("Processing new registration request for " + reg.getInfrastructureId());
log.info("Processing new registration request for {}.", reg.getInfrastructureId());
// Store new instance registration to infrastructure instance manager
infrastructureInstanceManager.onNewRegistration(reg);
// Process registration requests for RSUs and DSRCs
onRsuRegistrationRequest(reg.getInfrastructureId(), reg.getLocation().toGeo());
log.info("RSU Registration for "+ reg.getInfrastructureId() + " @ x, y, z: (" + reg.getLocation().getX() + ", " + reg.getLocation().getY() + ", " + reg.getLocation().getZ() + ")");
log.info("RSU Registration for {} @ x, y, z: ( {}, {}, {}) .",
reg.getInfrastructureId(),
reg.getLocation().getX(),
reg.getLocation().getY(),
reg.getLocation().getZ());
onDsrcRegistrationRequest(reg.getInfrastructureId());
// Check for empty list of sensors which is valid
if (reg.getSensors() != null ) {
log.debug("Sending SensorRegistration interactions for sensor : {}", reg.getSensors());
}
for (Detector sensor : reg.getSensors()) {
// Trigger Sensor registrations for all listed sensors.
this.rti.triggerInteraction(new DetectorRegistration(time,sensor));
}
else {
for (Detector sensor : reg.getSensors()) {
// Trigger Sensor registrations for all listed sensors.
this.rti.triggerInteraction(new DetectorRegistration(time,sensor));
}
}
}

Expand Down

0 comments on commit 9c96647

Please sign in to comment.