From 30cb1d15796d57964b801e9e160c1bd97dad8352 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 May 2019 15:41:13 +0200 Subject: [PATCH] a fix in editCache --- .../labsw/bugageocaching/util/CacheConstructionUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java b/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java index 959c2f5..7dc78ac 100644 --- a/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java +++ b/src/main/java/hhn/labsw/bugageocaching/util/CacheConstructionUtil.java @@ -171,8 +171,10 @@ public class CacheConstructionUtil { for (Cache cache1 : cacheRepository.findAll()) { if (cache1.getName().equals(cache.getName())) { - deleteNewCreatedStationsUtil(newCreatedStationList); - return ResponseEntity.status(400).body("name is already taken"); + if (cache1 != oldCache) { + deleteNewCreatedStationsUtil(newCreatedStationList); + return ResponseEntity.status(400).body("name is already taken"); + } } }