aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-12-14 19:22:21 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-12-14 19:22:38 +0530
commita7fb3924adfa577f718882a7455db34dcfb6fdbb (patch)
tree2787fa373ff5d9414cffaa2e844a19dd39e53582
parent6dd2c1b07cc306750dd9ee93cf8bb2f615f076aa (diff)
fixed sonar issue in MdsalHelper.java
fixed sonar issues Issue-ID: CCSDK-525 Change-Id: Iba12983579e9c608ffd3c615f3d3450353724602 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rwxr-xr-xsli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java21
1 files changed, 12 insertions, 9 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 bfbe9f97..48bb754e 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
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,7 +25,6 @@ package org.onap.ccsdk.sli.core.sli.provider;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
@@ -50,6 +51,8 @@ public class MdsalHelper {
private static final Logger LOG = LoggerFactory.getLogger(MdsalHelper.class);
private static Properties yangMappingProperties = new Properties();
+ private static final String IP_ADDRESS="IpAddress";
+ private static final String IP_PREFIX="IpPrefix";
@Deprecated
public static void setProperties(Properties input) {
@@ -131,7 +134,7 @@ public class MdsalHelper {
Object retValue = m.invoke(fromObj);
if (retValue != null) {
String propVal = null;
- if ("IpAddress".equals(simpleTypeName) || "IpPrefix".equals(simpleTypeName)) {
+ if (IP_ADDRESS.equals(simpleTypeName) || IP_PREFIX.equals(simpleTypeName)) {
propVal = String.valueOf((char[]) retValue);
} else if ("Ipv4Address".equals(simpleTypeName) || "Ipv6Address".equals(simpleTypeName)) {
propVal = (String) retValue;
@@ -632,7 +635,7 @@ public class MdsalHelper {
String simpleName = paramClass.getSimpleName();
if ("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpAddress".equals(simpleName)) {
+ || IP_ADDRESS.equals(simpleName)) {
if ((paramValue != null) && (paramValue.length() > 0)) {
try {
@@ -671,7 +674,7 @@ public class MdsalHelper {
+ m.getName() + "() with Properties entry", e);
}
}
- } else if ("IpPrefix".equals(simpleName)) {
+ } else if (IP_PREFIX.equals(simpleName)) {
if ((paramValue != null) && (paramValue.length() > 0)) {
try {
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(paramValue);
@@ -993,8 +996,8 @@ public class MdsalHelper {
}
private static boolean classHasSpecialHandling(String simpleName) {
- if ("IpAddress".equals(simpleName) || "Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpPrefix".equals(simpleName) || "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
+ if (IP_ADDRESS.equals(simpleName) || "Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
+ || IP_PREFIX.equals(simpleName) || "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
return true;
}
return false;
@@ -1068,7 +1071,7 @@ public class MdsalHelper {
String simpleName = returnClass.getSimpleName();
if ("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)
- || "IpAddress".equals(simpleName) || "IpPrefix".equals(simpleName)
+ || IP_ADDRESS.equals(simpleName) || IP_PREFIX.equals(simpleName)
|| "PortNumber".equals(simpleName) || "Dscp".equals(simpleName)) {
LOG.trace(m.getName() + " is an " + simpleName);
pstr.print("\n\n * " + propName);
@@ -1131,7 +1134,7 @@ public class MdsalHelper {
return (false);
}
String simpleName = c.getSimpleName();
- return ("IpPrefix".equals(simpleName));
+ return (IP_PREFIX.equals(simpleName));
}
public static boolean isIpv4Address(Class c) {
@@ -1167,7 +1170,7 @@ public class MdsalHelper {
return (false);
}
String simpleName = c.getSimpleName();
- return ("IpAddress".equals(simpleName));
+ return (IP_ADDRESS.equals(simpleName));
}
public static boolean isPortNumber(Class c) {