aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnbo Wang <wangenbo@huawei.com>2020-01-15 23:58:22 +0800
committerEnbo Wang <wangenbo@huawei.com>2020-01-16 00:02:07 +0800
commit4da70e483b8f177b9dad4ea59a80757e82b575c6 (patch)
treea8d63ff28320c8997191cf4ce0532cdd1a96ae0b
parent2fa35ec7af06c9f1d1982dc500726de703f7dede (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
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java4
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java4
2 files changed, 4 insertions, 4 deletions
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 5bd4bd93..89e4ee73 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 @@ public class MdsalHelper {
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 a7f383f2..992ed64d 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 @@ public class PrintYangToProp {
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();