Fixed code which generated groups id from name

This commit is contained in:
Luca Frosini 2022-04-27 16:21:19 +02:00
parent 312f3945a5
commit f08534b53f
1 changed files with 4 additions and 7 deletions

View File

@ -86,21 +86,18 @@ public abstract class HelperMethods {
* @return
*/
public static String getGroupNameOnCkan(String origName){
if(origName == null) {
throw new IllegalArgumentException("origName cannot be null");
}
String modified = origName.replaceAll("\\(", "");
modified = modified.replaceAll("\\)", "");
modified = modified.trim().toLowerCase().replaceAll("[^A-Za-z0-9-]", "-");
if(modified.startsWith("-"))
if(modified.startsWith("-")) {
modified = modified.substring(1);
if(modified.endsWith("-"))
}
if(modified.endsWith("-")) {
modified = modified.substring(0, modified.length() -1);
logger.info("Group name generated is " + modified);
}
return modified;
}