diff options
Diffstat (limited to 'cadi')
42 files changed, 88 insertions, 75 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java index e586d991..3b783949 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/AAFPermission.java @@ -39,7 +39,7 @@ public class AAFPermission implements Permission { private List<String> roles; static { - NO_ROLES = new ArrayList<String>(); + NO_ROLES = new ArrayList<>(); } protected AAFPermission() {roles=NO_ROLES;} diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java index cd08cd4d..d873205c 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/TestConnectivity.java @@ -133,7 +133,7 @@ public class TestConnectivity { print(true,"Load Security Setters from Configuration Information"); String user = access.getProperty(Config.AAF_APPID); - ArrayList<SecuritySetter<HttpURLConnection>> lss = new ArrayList<SecuritySetter<HttpURLConnection>>(); + ArrayList<SecuritySetter<HttpURLConnection>> lss = new ArrayList<>(); try { diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java index bc1f94d9..abd1c40f 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/cert/AAFListedCertIdentity.java @@ -118,9 +118,9 @@ public class AAFListedCertIdentity implements CertIdentity { @Override public void run() { try { - TreeMap<ByteArrayHolder, String> newCertsMap = new TreeMap<ByteArrayHolder,String>(); - Map<String,Set<String>> newTrustMap = new TreeMap<String,Set<String>>(); - Set<String> userLookup = new HashSet<String>(); + TreeMap<ByteArrayHolder, String> newCertsMap = new TreeMap<>(); + Map<String,Set<String>> newTrustMap = new TreeMap<>(); + Set<String> userLookup = new HashSet<>(); for(String s : certIDs) { userLookup.add(s); } @@ -132,7 +132,7 @@ public class AAFListedCertIdentity implements CertIdentity { aafcon.access.log(Level.WARN, "AAF Lookup-No IDs in Role com.att.aaf.trustForID <> "+authMech); } else { aafcon.access.log(Level.INFO,"Loading Trust Authentication Info for",authMech); - Set<String> hsUser = new HashSet<String>(); + Set<String> hsUser = new HashSet<>(); for(User u : users) { userLookup.add(u.getId()); hsUser.add(u.getId()); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java index 286104eb..b076379c 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFCon.java @@ -62,7 +62,7 @@ public abstract class AAFCon<CLIENT> implements Connector { // Package access final public int timeout, cleanInterval, connTimeout; final public int highCount, userExpires, usageRefreshTriggerCount; - private Map<String,Rcli<CLIENT>> clients = new ConcurrentHashMap<String,Rcli<CLIENT>>(); + private Map<String,Rcli<CLIENT>> clients = new ConcurrentHashMap<>(); final public RosettaDF<Perms> permsDF; final public RosettaDF<Certs> certsDF; final public RosettaDF<Users> usersDF; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java index ee649549..4ae1a051 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AAFLocator.java @@ -109,7 +109,7 @@ public class AAFLocator extends AbsAAFLocator<BasicTrans> { client.send(); Future<Endpoints> fr = client.futureRead(epsDF, TYPE.JSON); if(fr.get(client.timeout())) { - List<EP> epl = new LinkedList<EP>(); + List<EP> epl = new LinkedList<>(); for(Endpoint endpoint : fr.value.getEndpoint()) { epl.add(new EP(endpoint,latitude,longitude)); } diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java index 312c58e9..f0909062 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLocator.java @@ -75,7 +75,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI> } } - epList = new LinkedList<EP>(); + epList = new LinkedList<>(); refreshWait = refreshMin; this.access = access; @@ -261,7 +261,7 @@ public abstract class AbsAAFLocator<TRANS extends Trans> implements Locator<URI> if(!hasItems()) { throw new LocatorException("No Entries found" + (pathInfo==null?"":(" for " + pathInfo))); } - List<EP> lep = new ArrayList<EP>(); + List<EP> lep = new ArrayList<>(); EP first = null; // Note: Deque is sorted on the way by closest distance Iterator<EP> iter = getIterator(); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java index 083537a8..9feeee36 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/aaf/v2_0/AbsAAFLur.java @@ -132,7 +132,7 @@ public abstract class AbsAAFLur<PERM extends Permission> extends AbsUserCache<PE } else { sb.append("\n\tUser does not contain "); sb.append(pond.getKey()); - List<Permission> perms = new ArrayList<Permission>(); + List<Permission> perms = new ArrayList<>(); user.copyPermsTo(perms); for(Permission p : perms) { sb.append("\n\t\t"); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java index 3c8719b4..b19be6cd 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java @@ -174,7 +174,7 @@ public class Agent { permDF = env.newDataFactory(Perms.class); errMsg = new ErrMessage(env); - placeArtifact = new HashMap<String,PlaceArtifact>(); + placeArtifact = new HashMap<>(); placeArtifact.put(JKS, new PlaceArtifactInKeystore(JKS)); placeArtifact.put(PKCS12, new PlaceArtifactInKeystore(PKCS12)); placeArtifact.put(FILE, new PlaceArtifactInFiles()); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java index 74cf4e4b..266ace81 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/ArtifactDir.java @@ -48,11 +48,11 @@ public abstract class ArtifactDir implements PlaceArtifact { protected static final String C_R = "\n"; protected File dir; - private List<String> encodeds = new ArrayList<String>(); + private List<String> encodeds = new ArrayList<>(); private Symm symm; // This checks for multiple passes of Dir on the same objects. Run clear after done. - protected static Map<String,Object> processed = new HashMap<String,Object>(); + protected static Map<String,Object> processed = new HashMap<>(); /** diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java index 2a522bc1..cb282605 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java @@ -64,8 +64,8 @@ public class PlaceArtifactInKeystore extends ArtifactDir { // find where the trusts end in 1.0 API X509Certificate x509; - List<X509Certificate> chainList = new ArrayList<X509Certificate>(); - Set<X509Certificate> caSet = new HashSet<X509Certificate>(); + List<X509Certificate> chainList = new ArrayList<>(); + Set<X509Certificate> caSet = new HashSet<>(); for(Certificate c : certColl) { x509 = (X509Certificate)c; // Is a Root (self-signed, anyway) @@ -98,7 +98,7 @@ public class PlaceArtifactInKeystore extends ArtifactDir { PrivateKey pk = Factory.toPrivateKey(trans, certInfo.getPrivatekey()); addEncProperty(Config.CADI_KEY_PASSWORD, keyPass); addProperty(Config.CADI_ALIAS, arti.getMechid()); -// Set<Attribute> attribs = new HashSet<Attribute>(); +// Set<Attribute> attribs = new HashSet<>(); // if(kst.equals("pkcs12")) { // // Friendly Name // attribs.add(new PKCS12Attribute("1.2.840.113549.1.9.20", arti.getNs())); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java index dec0b4e9..2ebd7dc1 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClient.java @@ -274,7 +274,7 @@ public class TokenClient { Result<TimedToken> rtt = factory.get(key,hash,new Loader<TimedToken>() { @Override public Result<TimedToken> load(final String key) throws APIException, CadiException, LocatorException { - final List<String> params = new ArrayList<String>(); + final List<String> params = new ArrayList<>(); params.add(scope); addSecurity(params,authn_method); @@ -331,7 +331,7 @@ public class TokenClient { if(ss==null) { throw new APIException("client_creds(...) must be set before obtaining Access Tokens"); } - final List<String> params = new ArrayList<String>(); + final List<String> params = new ArrayList<>(); params.add("refresh_token="+token.getRefreshToken()); addSecurity(params,AUTHN_METHOD.refresh_token); final String scope="scope="+token.getScope().replace(' ', '+'); @@ -373,7 +373,7 @@ public class TokenClient { return tkCon.best(new Retryable<Result<Introspect>>() { @Override public Result<Introspect> code(Rcli<?> client) throws CadiException, ConnectException, APIException { - final List<String> params = new ArrayList<String>(); + final List<String> params = new ArrayList<>(); params.add("token="+token); addSecurity(params,AUTHN_METHOD.client_credentials); final String paramsa[] = new String[params.size()]; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java index 2b895761..c2848980 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenClientFactory.java @@ -54,7 +54,7 @@ import aafoauth.v2_0.Token; public class TokenClientFactory extends Persist<Token,TimedToken> { private static TokenClientFactory instance; - private Map<String,AAFConHttp> aafcons = new ConcurrentHashMap<String, AAFConHttp>(); + private Map<String,AAFConHttp> aafcons = new ConcurrentHashMap<>(); private SecurityInfoC<HttpURLConnection> hsi; // Package on purpose final Symm symm; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java index d8fd88f6..4e781bfa 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenMgr.java @@ -44,9 +44,9 @@ import aaf.v2_0.Perms; import aafoauth.v2_0.Introspect; public class TokenMgr extends Persist<Introspect, TokenPerm> { - protected static Map<String,TokenPerm> tpmap = new ConcurrentHashMap<String, TokenPerm>(); - protected static Map<String,TokenMgr> tmmap = new HashMap<String, TokenMgr>(); // synchronized in getInstance - protected static Map<String,String> currentToken = new HashMap<String,String>(); // synchronized in getTP + protected static Map<String,TokenPerm> tpmap = new ConcurrentHashMap<>(); + protected static Map<String,TokenMgr> tmmap = new HashMap<>(); // synchronized in getInstance + protected static Map<String,String> currentToken = new HashMap<>(); // synchronized in getTP public static RosettaDF<Perms> permsDF; public static RosettaDF<Introspect> introspectDF; diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java index 4a0259a4..5c77fda7 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/oauth/TokenPerm.java @@ -42,7 +42,7 @@ import aaf.v2_0.Perms; import aafoauth.v2_0.Introspect; public class TokenPerm extends Persisting<Introspect>{ - private static final List<AAFPermission> NULL_PERMS = new ArrayList<AAFPermission>(); + private static final List<AAFPermission> NULL_PERMS = new ArrayList<>(); private Introspect introspect; private List<AAFPermission> perms; private String scopes; @@ -99,7 +99,7 @@ public class TokenPerm extends Persisting<Introspect>{ while((pd = ij.parse(r,pd.reuse())).valid()) { switch(pd.event) { case Parse.START_DOC: - perms = new ArrayList<AAFPermission>(); + perms = new ArrayList<>(); break; case Parse.START_ARRAY: inPerms = "perm".equals(pd.name); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java index 9754b1e6..11acbe91 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/persist/Persist.java @@ -65,7 +65,7 @@ public abstract class Persist<T,CT extends Persistable<T>> extends PersistFile { super(access, sub_dir); this.env = env; df = env.newDataFactory(cls); - tmap = new ConcurrentHashMap<String, CT>(); + tmap = new ConcurrentHashMap<>(); synchronized(Persist.class) { if(clean==null) { clean = new Timer(true); diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java index f2fb7057..28103b5d 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/sso/AAFSSO.java @@ -454,7 +454,7 @@ public class AAFSSO { private List<String> parseArgs(String[] args) { - List<String> larg = new ArrayList<String>(args.length); + List<String> larg = new ArrayList<>(args.length); // Cover for bash's need to escape *.. (\\*) // also, remove SSO if required diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_AAFPermission.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_AAFPermission.java index 10958a23..4836e4ed 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_AAFPermission.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/test/JU_AAFPermission.java @@ -44,7 +44,7 @@ public class JU_AAFPermission { @Before public void setup() { - roles = new ArrayList<String>(); + roles = new ArrayList<>(); roles.add(role); } diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java index 3b2ce7b1..eeb9c623 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/aaf/v2_0/test/JU_AAFLocator.java @@ -97,7 +97,7 @@ public class JU_AAFLocator { public static void tearDownAfterClass() throws Exception { Field field = SecurityInfoC.class.getDeclaredField("sicMap"); field.setAccessible(true); - field.set(null, new HashMap<Class<?>,SecurityInfoC<?>>()); + field.set(null, new HashMap<>()); } @Test diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_Factory.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_Factory.java index b47abe2c..5827e8c0 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_Factory.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/JU_Factory.java @@ -238,7 +238,7 @@ public class JU_Factory { output = Factory.toString(transMock, certs.toArray(new Certificate[0])[0]); assertThat(output, is(certString)); - List<String> certStrings = new ArrayList<String>(); + List<String> certStrings = new ArrayList<>(); certStrings.add(certString); certStrings.add(certString); certs = Factory.toX509Certificate(certStrings); @@ -318,7 +318,7 @@ public class JU_Factory { private String cleanupString(String str) { String[] lines = str.split("\n", 0); - List<String> rawLines = new ArrayList<String>(); + List<String> rawLines = new ArrayList<>(); for (int i = 0; i < lines.length - 2; i++) { rawLines.add(lines[i + 1]); } diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java index a30f274f..555eda41 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/oauth/test/JU_OAuthTest.java @@ -79,7 +79,7 @@ public class JU_OAuthTest { public static void tearDownAfterClass() throws Exception { Field field = SecurityInfoC.class.getDeclaredField("sicMap"); field.setAccessible(true); - field.set(null, new HashMap<Class<?>,SecurityInfoC<?>>()); + field.set(null, new HashMap<>()); } @Before diff --git a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java index ff170772..45a7d341 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/client/sample/Sample.java @@ -105,7 +105,7 @@ public class Sample { } public List<Permission> allAuthorization(Principal fqi) { - List<Permission> pond = new ArrayList<Permission>(); + List<Permission> pond = new ArrayList<>(); aafLur.fishAll(fqi, pond); return pond; } diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java index df8cacf4..a3dac7da 100644 --- a/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java +++ b/cadi/client/src/main/java/org/onap/aaf/cadi/http/HClient.java @@ -93,7 +93,7 @@ public class HClient implements EClient<HttpURLConnection> { @Override public void addHeader(String tag, String value) { if (headers == null) - headers = new ArrayList<Header>(); + headers = new ArrayList<>(); headers.add(new Header(tag, value)); } diff --git a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java index 4591122c..b75e8bc2 100644 --- a/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java +++ b/cadi/client/src/main/java/org/onap/aaf/cadi/locator/PropertyLocator.java @@ -65,7 +65,7 @@ public class PropertyLocator implements Locator<URI> { throw new LocatorException("No Location List given for PropertyLocator"); } String[] locarray = Split.split(',',locList); - List<URI> uriList = new ArrayList<URI>(); + List<URI> uriList = new ArrayList<>(); random = new SecureRandom(); @@ -177,7 +177,7 @@ public class PropertyLocator implements Locator<URI> { public synchronized boolean refresh() { if(System.currentTimeMillis()>lastRefreshed) { // Build up list - List<URI> resolve = new ArrayList<URI>(); + List<URI> resolve = new ArrayList<>(); String realname; for(int i = 0; i < orig.length ; ++i) { try { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java index c65a9b22..1d01a3e8 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/AbsUserCache.java @@ -55,7 +55,7 @@ public abstract class AbsUserCache<PERM extends Permission> { private static Timer timer; // Map of userName to User private final Map<String, User<PERM>> userMap; - private static final Map<String, Miss> missMap = new TreeMap<String,Miss>(); + private static final Map<String, Miss> missMap = new TreeMap<>(); private final Symm missEncrypt; private Clean clean; @@ -73,7 +73,7 @@ public abstract class AbsUserCache<PERM extends Permission> { } missEncrypt = s; - userMap = new ConcurrentHashMap<String, User<PERM>>(); + userMap = new ConcurrentHashMap<>(); if(cleanInterval>0) { @@ -236,7 +236,7 @@ public abstract class AbsUserCache<PERM extends Permission> { } public final List<DumpInfo> dumpInfo() { - List<DumpInfo> rv = new ArrayList<DumpInfo>(); + List<DumpInfo> rv = new ArrayList<>(); for(User<PERM> user : userMap.values()) { rv.add(new DumpInfo(user)); } @@ -265,7 +265,7 @@ public abstract class AbsUserCache<PERM extends Permission> { // Simple map of Group name to a set of User Names - // private Map<String, Set<String>> groupMap = new HashMap<String, Set<String>>(); + // private Map<String, Set<String>> groupMap = new HashMap<>(); /** * Class to hold a small subset of the data, because we don't want to expose actual Permission or User Objects @@ -276,7 +276,7 @@ public abstract class AbsUserCache<PERM extends Permission> { public DumpInfo(User<PERM> user) { this.user = user.principal.getName(); - perms = new ArrayList<String>(user.perms.keySet()); + perms = new ArrayList<>(user.perms.keySet()); } } @@ -315,7 +315,7 @@ public abstract class AbsUserCache<PERM extends Permission> { int total = 0; try { // look at now. If we need to expire more by increasing "now" by "advance" - ArrayList<User<PERM>> al = new ArrayList<User<PERM>>(userMap.values().size()); + ArrayList<User<PERM>> al = new ArrayList<>(userMap.values().size()); al.addAll(0, userMap.values()); long now = System.currentTimeMillis() + advance; for(User<PERM> user : al) { @@ -367,7 +367,7 @@ public abstract class AbsUserCache<PERM extends Permission> { int missTotal = missMap.keySet().size(); int miss = 0; if(missTotal>0) { - ArrayList<String> keys = new ArrayList<String>(missTotal); + ArrayList<String> keys = new ArrayList<>(missTotal); keys.addAll(missMap.keySet()); for(String key : keys) { Miss m = missMap.get(key); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java index 49572f4c..a2dfba37 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/CadiWrap.java @@ -140,7 +140,7 @@ public class CadiWrap extends HttpServletRequestWrapper implements HttpServletRe * To utilize, the Request must be a "CadiWrap" object, then call. */ public List<Permission> getPermissions(Principal p) { - List<Permission> perms = new ArrayList<Permission>(); + List<Permission> perms = new ArrayList<>(); lur.fishAll(p, perms); return perms; } diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java index 00383851..935e4f14 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Capacitor.java @@ -36,7 +36,7 @@ import java.util.ArrayList; */ public class Capacitor { private static final int DEFAULT_CHUNK = 256; - private ArrayList<ByteBuffer> bbs = new ArrayList<ByteBuffer>(); + private ArrayList<ByteBuffer> bbs = new ArrayList<>(); private ByteBuffer curr = null; private int idx; diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java index c827477f..5e001561 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java @@ -184,7 +184,7 @@ public class PropAccess implements Access { String chainProp = props.getProperty(Config.CADI_PROP_FILES); if(chainProp!=null) { if(recursionProtection==null) { - recursionProtection = new ArrayList<String>(); + recursionProtection = new ArrayList<>(); recursionProtection.add(cadi_prop_files); } if(!recursionProtection.contains(chainProp)) { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java index 5a3fe825..4067f160 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/Symm.java @@ -138,7 +138,7 @@ public class Symm { // There can be time efficiencies gained when the underlying keyset consists mainly of ordered // data (i.e. abcde...). Therefore, we'll quickly analyze the keyset. If it proves to have // too much entropy, the "Unordered" algorithm, which is faster in such cases is used. - ArrayList<int[]> la = new ArrayList<int[]>(); + ArrayList<int[]> la = new ArrayList<>(); for(int i=0;i<codeset.length;++i) { curr = codeset[i]; if(prev+1==curr) { // is next character in set diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java index 5e9f8a58..34aaf170 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java @@ -36,7 +36,7 @@ import org.onap.aaf.cadi.lur.LocalPermission; * */ public final class User<PERM extends Permission> { - private static final Map<String,Permission> NULL_MAP = new HashMap<String,Permission>(); + private static final Map<String,Permission> NULL_MAP = new HashMap<>(); public String name; private byte[] cred; public Principal principal; @@ -121,7 +121,7 @@ public final class User<PERM extends Permission> { } public Map<String,Permission> newMap() { - return new ConcurrentHashMap<String,Permission>(); + return new ConcurrentHashMap<>(); } public void add(LocalPermission permission) { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java index b74ccb36..dfcf7e3d 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java @@ -259,7 +259,7 @@ public class Config { access.log(Level.INIT, "Hostname set to",hostname); // Get appropriate TAFs - ArrayList<HttpTaf> htlist = new ArrayList<HttpTaf>(); + ArrayList<HttpTaf> htlist = new ArrayList<>(); ///////////////////////////////////////////////////// // Add a Denial of Service TAF @@ -507,7 +507,7 @@ public class Config { public static Lur configLur(SecurityInfoC<HttpURLConnection> si, Connector con, Object ... additionalTafLurs) throws CadiException { Access access = si.access; - List<Lur> lurs = new ArrayList<Lur>(); + List<Lur> lurs = new ArrayList<>(); ///////////////////////////////////////////////////// // Configure a Local Property Based RBAC/LUR @@ -671,7 +671,7 @@ public class Config { aafConClass = loadClass(access, AAF_V2_0_AAF_CON_HTTP); if (aafConClass != null) { for (Constructor<?> c : aafConClass.getConstructors()) { - List<Object> lo = new ArrayList<Object>(); + List<Object> lo = new ArrayList<>(); for (Class<?> pc : c.getParameterTypes()) { if (pc.equals(Access.class)) { lo.add(access); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java index cc366c27..a5fb4a0c 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfoC.java @@ -31,7 +31,7 @@ import org.onap.aaf.cadi.SecuritySetter; public class SecurityInfoC<CLIENT> extends SecurityInfo { public static final String DEF_ID = "ID not Set"; - private static Map<Class<?>,SecurityInfoC<?>> sicMap = new HashMap<Class<?>,SecurityInfoC<?>>(); + private static Map<Class<?>,SecurityInfoC<?>> sicMap = new HashMap<>(); public SecuritySetter<CLIENT> defSS; public SecurityInfoC(Access access) throws CadiException { diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java index a3e267cd..974e5810 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/UsersDump.java @@ -58,7 +58,7 @@ public class UsersDump { StringBuilder sb = new StringBuilder(); // Obtain all unique role names - HashSet<String> groups = new HashSet<String>(); + HashSet<String> groups = new HashSet<>(); for(AbsUserCache<?>.DumpInfo di : lur.dumpInfo()) { sb.append("\n <user username=\""); sb.append(di.user); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java index 1f302c64..237aa28d 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/filter/CadiFilter.java @@ -218,7 +218,7 @@ public class CadiFilter implements Filter { if(map.length>0) { MapPermConverter mpc=null; int idx; - mapPairs = new ArrayList<Pair>(); + mapPairs = new ArrayList<>(); for(String entry : map) { if((idx=entry.indexOf('='))<0) { // it's a Path, so create a new converter access.log(Level.INIT,"Loading Perm Conversions for:",entry); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java index 5cd6323d..5b51c111 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/HttpEpiTaf.java @@ -93,7 +93,12 @@ public class HttpEpiTaf implements HttpTaf { TafResp tresp = null; TafResp firstTry = null; List<Redirectable> redirectables = null; - List<TafResp> log = (access.willLog(Level.DEBUG)) ? new ArrayList<TafResp>() : null; + List<TafResp> log; + if(access.willLog(Level.DEBUG)) { + log = new ArrayList<>(); + } else { + log = null; + } try { for (HttpTaf taf : tafs) { tresp = taf.validate(reading, req, resp); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java index dc07bb90..7b7f2db0 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/cert/X509Taf.java @@ -86,7 +86,7 @@ public class X509Taf implements HttpTaf { throw new CadiException("X509Taf requires Environment ("+Config.AAF_ENV+") to be set."); } // this.lur = lur; - this.cadiIssuers = new ArrayList<String>(); + this.cadiIssuers = new ArrayList<>(); for(String ci : access.getProperty(Config.CADI_X509_ISSUERS, "").split(":")) { access.printf(Level.INIT, "Trusting Identity for Certificates signed by \"%s\"",ci); cadiIssuers.add(ci); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java index 44a3a4a3..a0d56f67 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/taf/dos/DenialOfServiceTaf.java @@ -126,7 +126,7 @@ public class DenialOfServiceTaf implements HttpTaf { public static synchronized boolean denyIP(String ip) { boolean rv = false; if(deniedIP==null) { - deniedIP = new HashMap<String,Counter>(); + deniedIP = new HashMap<>(); deniedIP.put(ip, new Counter(ip)); // Noted duplicated for minimum time spent rv= true; } else if(deniedIP.get(ip)==null) { @@ -170,7 +170,7 @@ public class DenialOfServiceTaf implements HttpTaf { br = new BufferedReader(new FileReader(dosIP)); try { if(deniedIP==null) { - deniedIP=new HashMap<String,Counter>(); + deniedIP=new HashMap<>(); } String line; @@ -215,7 +215,7 @@ public class DenialOfServiceTaf implements HttpTaf { public static synchronized boolean denyID(String id) { boolean rv = false; if(deniedID==null) { - deniedID = new HashMap<String,Counter>(); + deniedID = new HashMap<>(); deniedID.put(id, new Counter(id)); // Noted duplicated for minimum time spent rv = true; } else if(deniedID.get(id)==null) { @@ -260,7 +260,7 @@ public class DenialOfServiceTaf implements HttpTaf { br = new BufferedReader(new FileReader(dosID)); try { if(deniedID==null) { - deniedID=new HashMap<String,Counter>(); + deniedID=new HashMap<>(); } String line; @@ -299,7 +299,7 @@ public class DenialOfServiceTaf implements HttpTaf { int initSize = 0; if(deniedIP!=null)initSize+=deniedIP.size(); if(deniedID!=null)initSize+=deniedID.size(); - ArrayList<String> al = new ArrayList<String>(initSize); + ArrayList<String> al = new ArrayList<>(initSize); if(deniedID!=null) { for(Counter c : deniedID.values()) { al.add(c.toString()); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java index 4312c3ca..7cd7a633 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/util/Pool.java @@ -107,7 +107,7 @@ public class Pool<T> { public Pool(Creator<T> creator) { count = spares = 0; this.creator = creator; - list = new LinkedList<Pooled<T>>(); + list = new LinkedList<>(); logger = Log.NULL; } diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java index 7af475ad..78265e4b 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/wsse/XReader.java @@ -354,14 +354,22 @@ public class XReader { for(Tag tag : t.attribs) { if("xmlns".equals(tag.prefix)) { if(newnss==null) { - newnss = new HashMap<String,String>(); + newnss = new HashMap<>(); if(nss!=null)newnss.putAll(nss); } newnss.put(tag.name, tag.value); } } } - return newnss==null?(nss==null?new HashMap<String,String>():nss):newnss; + //return newnss==null?(nss==null?new HashMap<String,String>():nss):newnss; + if(newnss==null) { + if(nss==null) { + newnss = new HashMap<>(); + } else { + newnss = nss; + } + } + return newnss; } /** @@ -392,7 +400,7 @@ public class XReader { */ public void add(Tag attrib) { if(attribs == null) { - attribs = new ArrayList<Tag>(); + attribs = new ArrayList<>(); } attribs.add(attrib); } diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AbsUserCache.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AbsUserCache.java index b2739b9d..11877dea 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AbsUserCache.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_AbsUserCache.java @@ -284,10 +284,10 @@ public class JU_AbsUserCache { assertThat(dumpInfo.size(), is(2)); // Utility lists - List<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<>(); names.add(name1); names.add(name2); - List<String> permissions = new ArrayList<String>(); + List<String> permissions = new ArrayList<>(); permissions.add("NewKey1"); permissions.add("NewKey2"); diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java index 25683249..2d5ba8d2 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_User.java @@ -158,7 +158,7 @@ public class JU_User { @Test public void addValuesToNewMapTest() { User<Permission> user = new User<Permission>(principal); - Map<String, Permission> newMap = new HashMap<String,Permission>(); + Map<String, Permission> newMap = new HashMap<>(); assertFalse(user.contains(permission)); @@ -167,7 +167,7 @@ public class JU_User { assertTrue(user.contains(permission)); - List<Permission> sink = new ArrayList<Permission>(); + List<Permission> sink = new ArrayList<>(); user.copyPermsTo(sink); assertThat(sink.size(), is(1)); diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java index 79209322..b9f0e997 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Pool.java @@ -71,7 +71,7 @@ public class JU_Pool { public void getTest() throws CadiException { Pool<Integer> intPool = new Pool<Integer>(new IntegerCreator()); - List<Pooled<Integer>> gotten = new ArrayList<Pooled<Integer>>(); + List<Pooled<Integer>> gotten = new ArrayList<>(); for (int i = 0; i < 10; i++) { gotten.add(intPool.get()); assertThat(gotten.get(i).content, is(i)); diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java index b2600aa5..551f725d 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/util/test/JU_Vars.java @@ -39,21 +39,21 @@ public class JU_Vars { @Test public void convert() { String test = "test"; - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.add("method"); assertEquals(Vars.convert(test, list), test); } @Test public void convertTest1() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.add("method"); assertEquals(Vars.convert("test", list), "test"); } @Test public void convertTest2() { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.add("method"); assertEquals(Vars.convert("test", list), "test"); } |