commit | 4da70e483b8f177b9dad4ea59a80757e82b575c6 | [log] [tgz] |
---|---|---|
author | Enbo Wang <wangenbo@huawei.com> | Wed Jan 15 23:58:22 2020 +0800 |
committer | Enbo Wang <wangenbo@huawei.com> | Thu Jan 16 00:02:07 2020 +0800 |
tree | a8d63ff28320c8997191cf4ce0532cdd1a96ae0b | |
parent | 2fa35ec7af06c9f1d1982dc500726de703f7dede [diff] |
Fix issue of converting camel case to lower hyphen format Fix issue of converting camel case to lower hyphen format when there are continuous capital letters. Issue-ID: CCSDK-2026 Signed-off-by: Enbo Wang <wangenbo@huawei.com> Change-Id: Ifd10b1e82c1f10476bbc6e15689e6025de57bbf4
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java index 5bd4bd9..89e4ee7 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -1149,8 +1149,8 @@ str = str + inStr.substring(1); } - String regex = "(([a-z0-9])([A-Z]))"; - String replacement = "$2-$3"; + String regex = "([a-z0-9A-Z])(?=[A-Z])"; + String replacement = "$1-"; String retval = str.replaceAll(regex, replacement).toLowerCase();
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java index a7f383f..992ed64 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java
@@ -1259,8 +1259,8 @@ str = str + inStr.substring(1); } - String regex = "(([a-z0-9])([A-Z]))"; - String replacement = "$2-$3"; + String regex = "([a-z0-9A-Z])(?=[A-Z])"; + String replacement = "$1-"; String retval = str.replaceAll(regex, replacement).toLowerCase();