package cloud.swiftnode.kspam.abstraction.checker;

import cloud.swiftnode.kspam.abstraction.SpamChecker;
import cloud.swiftnode.kspam.abstraction.deniable.DeniableInfoAdapter;
import cloud.swiftnode.kspam.util.StaticStorage;
import cloud.swiftnode.kspam.util.Tracer;

/**
 * Created by EntryPoint on 2016-12-30.
 */
public class CacheChecker extends SpamChecker {
    public CacheChecker(DeniableInfoAdapter adapter) {
        super(adapter);
    }

    @Override
    public Tracer.Result check() throws Exception {
        String[] infoArr = new String[]{
                adapter.getIp(), adapter.getName(), adapter.getUniqueId()
        };
        for (String info : infoArr) {
            if (StaticStorage.cachedSet.contains(info)) {
                return Tracer.Result.DENY;
            }
        }
        return Tracer.Result.PASS;
    }

    @Override
    public String name() {
        return "CacheChecker";
    }
}

@@ -262,16 +262,93 @@
 racer;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0A
 /**%0A * C
@@ -599,57 +599,62 @@
     
+List%3C
 String
-%5B%5D
+%3E
  info
-Arr
+List
  = new 
-String%5B%5D%7B%0A                
+ArrayList%3C%3E(Arrays.asList(
 adap
@@ -683,18 +683,59 @@
 etName()
-, 
+));%0A        try %7B%0A            infoList.add(
 adapter.
@@ -747,16 +747,18 @@
 iqueId()
+);
 %0A       
@@ -759,17 +759,83 @@
        %7D
-;
+ catch (IllegalStateException ex) %7B%0A            // Ignore%0A        %7D
 %0A       
@@ -858,19 +858,20 @@
 o : info
-Arr
+List
 ) %7B%0A    

Fix CacheChecker code