From ebce108118eaa9ee42d82a3db2a5691196f3f9f7 Mon Sep 17 00:00:00 2001 From: RIHTARSIC Joze <joze.rihtarsic@ext.ec.europa.eu> Date: Thu, 22 Jun 2023 13:28:54 +0200 Subject: [PATCH] add restriction for sml smp id --- .../europa/ec/edelivery/smp/services/ui/UIDomainService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java index 40fafe60d..1ffceef42 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java @@ -144,14 +144,14 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> { throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg); } - Optional<DBDomain> domainBySmlSmpId = domainDao.getDomainBySmlSmpId(data.getSmlSmpId()); + Optional<DBDomain> domainBySmlSmpId = domainDao.getDomainBySmlSmpId(StringUtils.trim(data.getSmlSmpId())); if (domainBySmlSmpId.isPresent() && !Objects.equals(domainBySmlSmpId.get().getId(), domain.getId())) { String msg = "SMP-SML identifier must unique. The SmlSmpId [" + data.getSmlSmpId() + "] is already used by other domains!"; throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg); } domain.setSmlSubdomain(data.getSmlSubdomain()); - domain.setSmlSmpId(data.getSmlSmpId()); + domain.setSmlSmpId(StringUtils.trim(data.getSmlSmpId())); domain.setSmlClientKeyAlias(data.getSmlClientKeyAlias()); domain.setSmlClientCertAuth(data.isSmlClientCertAuth()); } -- GitLab