Fixed code which generated groups id from name
This commit is contained in:
parent
312f3945a5
commit
f08534b53f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue