diff --git a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java index 820be4a9345..6deab6e2ad5 100755 --- a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java +++ b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java @@ -384,19 +384,19 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl } else { effectiveRegatta = regatta; } - // removeRace may detach the domain regatta from the domain factory if that - // removed the last race; therefore, it's important to getOrCreate the - // domain regatta *after* calling removeRace - final RaceDefinition raceDefinition = domainFactory.removeRace(tractracRace.getEvent(), tractracRace, effectiveRegatta, trackedRegattaRegistry); - if (raceDefinition != null) { - trackedRegattaRegistry.removeRace(effectiveRegatta, raceDefinition); - } // if regatta is still null, no previous assignment of any of the races in this TracTrac event to a Regatta was // found; // in this case, create a default regatta based on the TracTrac event data this.regatta = effectiveRegatta == null ? domainFactory.getOrCreateDefaultRegatta( raceLogStore, regattaLogStore, tractracRace, trackedRegattaRegistry) : effectiveRegatta; trackedRegatta = trackedRegattaRegistry.getOrCreateTrackedRegatta(this.regatta); + // removeRace may detach the domain regatta from the domain factory if that + // removed the last race; therefore, it's important to getOrCreate the + // domain regatta *after* calling removeRace + final RaceDefinition raceDefinition = domainFactory.removeRace(tractracRace.getEvent(), tractracRace, this.regatta, trackedRegattaRegistry); + if (raceDefinition != null) { + trackedRegattaRegistry.removeRace(this.regatta, raceDefinition); + } receivers = new HashSet(); for (Receiver receiver : domainFactory.getUpdateReceivers(getTrackedRegatta(), delayToLiveInMillis, simulator, windStore, this, trackedRegattaRegistry, raceLogResolver, tractracRace, diff --git a/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/RaceTrackerTest.java b/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/RaceTrackerTest.java index 938fb1548d1..b94b3655167 100755 --- a/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/RaceTrackerTest.java +++ b/java/com.sap.sailing.server.test/src/com/sap/sailing/server/test/RaceTrackerTest.java @@ -80,7 +80,6 @@ public class RaceTrackerTest { RaceDefinition race = raceHandle.getRace(); // wait for RaceDefinition to be completely wired in Regatta logger.info("Obtained race: "+race); assertNotNull(race); - // TODO the following assertion fails; this suggests that the race obtained above hasn't properly been entered into the regatta. Why??? assertTrue(!Util.isEmpty(raceHandle.getRegatta().getAllRaces())); }