From 312f3945a5d8feec8fd4c888a4d5d9eb8f3ff6fc Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 27 Apr 2022 16:19:48 +0200 Subject: [PATCH] Fixed code which generated groups id from name --- CHANGELOG.md | 6 +++--- .../grsf_publish_ws/utils/HelperMethods.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60f55b3..6618f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [v1.13.1-SNAPSHOT] - Aligned code and wiki to the new requirements [#23167] -- Changed group assign strategy #23215 -- Tag are added also to legacy records - +- Changed group assign strategy [#23211] [#23215] +- Tag are added also to legacy records [#23216] +- Fixed code which generated groups id from name [#23215] ## [v1.13.0] diff --git a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java index 878030d..4bc7979 100644 --- a/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java +++ b/src/main/java/org/gcube/data_catalogue/grsf_publish_ws/utils/HelperMethods.java @@ -87,12 +87,13 @@ public abstract class HelperMethods { */ public static String getGroupNameOnCkan(String origName){ - if(origName == null) + if(origName == null) { throw new IllegalArgumentException("origName cannot be null"); + } String modified = origName.replaceAll("\\(", ""); - modified = origName.replaceAll("\\)", ""); - modified = origName.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-"); + modified = modified.replaceAll("\\)", ""); + modified = modified.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-"); if(modified.startsWith("-")) modified = modified.substring(1); if(modified.endsWith("-"))