From: Arundathi Patil Date: Wed, 18 Sep 2019 09:28:47 +0000 (+0530) Subject: Sonar Fix: Cached.java X-Git-Tag: 2.1.17~119^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=commitdiff_plain;h=fcacceb5bccef54903b50b510d0463f684a1707d Sonar Fix: Cached.java Fixed multiple sonar issues in this file Issue-ID: AAF-968 Change-Id: Iebd3fc8dedc6e22ba4bfcd2c9943aa4c4c00a6a0 Signed-off-by: Arundathi Patil --- diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java index a31e7b5b..5605d653 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modification Copyright (c) 2019 IBM * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +39,6 @@ import org.onap.aaf.misc.env.Trans; public class Cached extends Cache { // Java does not allow creation of Arrays with Generics in them... - // private Map cache[]; protected final CIDAO info; private static Timer infoTimer; @@ -47,19 +48,8 @@ public class Cached extends Cache info, String name, int segSize, long expireIn) { this.name =name; this.segSize = segSize; @@ -71,6 +61,18 @@ public class Cached extends Cache data) { @SuppressWarnings("unchecked") @@ -83,14 +85,14 @@ public class Cached extends Cache map = ((Map)cache[cacheIdx]); -// if (map.remove(key)!=null) // Not seeming to remove all the time if (map!=null)map.clear(); -// System.err.println("Remove " + name + " " + key); return cacheIdx; } public Result invalidate(int segment) { - if (segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment)); + if (segment<0 || segment>=cache.length) { + return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment)); + } @SuppressWarnings("unchecked") Map map = ((Map)cache[segment]); if (map!=null) { @@ -99,6 +101,7 @@ public class Cached extends Cache { public abstract Result> get(); }; @@ -125,8 +128,6 @@ public class Cached extends Cache extends Cache cidao; private int minRefresh; @@ -173,7 +174,7 @@ public class Cached extends Cache extends Cache rv = cidao.check(trans);