Collection syntax change because of Sonar
[aaf/authz.git] / auth / auth-core / src / main / java / org / onap / aaf / auth / rserv / CachingFileAccess.java
index 7bb276a..bc563f3 100644 (file)
@@ -109,11 +109,11 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
        public CachingFileAccess(EnvJAXB env, String ... args) throws IOException {
                super(null,"Caching File Access");
                setEnv(env,args);
-               content = new ConcurrentSkipListMap<String,Content>(); // multi-thread changes possible
+               content = new ConcurrentSkipListMap<>(); // multi-thread changes possible
 
-               attachOnly = new HashSet<String>();     // short, unchanged
+               attachOnly = new HashSet<>();     // short, unchanged
 
-               typeMap = new TreeMap<String,String>(); // Structure unchanged after Construction
+               typeMap = new TreeMap<>(); // Structure unchanged after Construction
                typeMap.put("ico","image/icon");
                typeMap.put("html","text/html");
                typeMap.put("css","text/css");
@@ -161,7 +161,6 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
        public void handle(TRANS trans, HttpServletRequest req, HttpServletResponse resp) throws IOException {
                String key = pathParam(req, ":key");
                String cmd = pathParam(req,":cmd");
-               System.out.print(key + clear_command);
                if(key.equals(clear_command)) {
                        resp.setHeader("Content-Type",typeMap.get("txt"));
                        if("clear".equals(cmd)) {
@@ -486,7 +485,7 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
                }
                
                public String toString() {
-                       return data.toString();
+                       return Arrays.toString(data);
                }
                
                public void write(Writer writer) throws IOException {
@@ -541,22 +540,22 @@ public class CachingFileAccess<TRANS extends Trans> extends HttpCode<TRANS, Void
                public void run() {
                        int size = content.size();
                        if(size>maxSize) {
-                               ArrayList<Comp> scont = new ArrayList<Comp>(size);
+                               ArrayList<Comp> scont = new ArrayList<>(size);
                                Object[] entries = content.entrySet().toArray();
                                for(int i=0;i<size;++i) {
                                        scont.add(i, new Comp((Map.Entry<String,Content>)entries[i]));
                                }
                                Collections.sort(scont);
                                int end = size - ((maxSize/4)*3); // reduce to 3/4 of max size
-                               System.out.println("------ Cleanup Cycle ------ " + new Date().toString() + " -------");
+                               //System.out.println("------ Cleanup Cycle ------ " + new Date().toString() + " -------");
                                for(int i=0;i<end;++i) {
                                        Entry<String, Content> entry = scont.get(i).entry;
                                        content.remove(entry.getKey());
-                                       System.out.println("removed Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
+                                       //System.out.println("removed Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
                                }
                                for(int i=end;i<size;++i) {
                                        Entry<String, Content> entry = scont.get(i).entry;
-                                       System.out.println("remaining Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
+                                       //System.out.println("remaining Cache Item " + entry.getKey() + "/" + new Date(entry.getValue().access).toString());
                                }
                        }
                }