diff options
author | Gabriel <adam.krysiak@nokia.com> | 2018-07-03 10:30:01 +0200 |
---|---|---|
committer | Gabriel <adam.krysiak@nokia.com> | 2018-07-03 10:51:53 +0200 |
commit | 0cfec3c5d53ed995e66f135ccd584d7ab0950258 (patch) | |
tree | a34114ae5e43a4c520e775c68851d241974bec64 /src/main/java/org | |
parent | 628985aac4fbe481e20acb1a5578fe41749ea5ae (diff) |
Fix weakness causing NPE
Change-Id: I1f6bfa75990082dc411d813528702cc3cc140f5c
Issue-ID: CLAMP-193
Signed-off-by: Gabriel <adam.krysiak@nokia.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java index 9c9402100..240094e61 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java +++ b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java @@ -17,6 +17,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
+ * Modifications copyright (c) 2018 Nokia
* ===================================================================
*
*/
@@ -227,13 +228,12 @@ public class SdcCatalogServices { */
public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(
List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
- List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;
+ List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = new ArrayList<>();
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {
// sort list
Collections.sort(rawCldsSdcResourceListBasicList);
// and then take only the resources with the max version (last in
// the list with the same name)
- cldsSdcResourceBasicInfoList = new ArrayList<>();
for (int i = 1; i < rawCldsSdcResourceListBasicList.size(); i++) {
// compare name with previous - if not equal, then keep the
// previous (it's the last with that name)
|