Java error java.util.concurrent.ConcurrentHashMap.keySet

Reptic picture Reptic · Jun 27, 2014 · Viewed 12.2k times · Source

Hey guy's am getting this error: Can you guy's possibly try to fix this? or see whats wrong post a fix or something

Thanks alot guy's :)

Exception in thread "ExtensionHandler-1" java.lang.NoSuchMethodE
rror: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/Concu
rrentHashMap$KeySetView;
        at aerivial.requests.aqw.GetAction.process(GetAction.java:196)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.processEve
nt(ExtensionHandler.java:535)
        at it.gotoandplay.smartfoxserver.controllers.ExtensionHandler.run(Extens
ionHandler.java:344)
        at java.lang.Thread.run(Thread.java:619)

The error Code:

        ConcurrentHashMap tgtBuffDebuffs = (ConcurrentHashMap)userTgt.properties.get(Users.BUFFS_DEBUFFS);

        for (Iterator i = tgtBuffDebuffs.keySet().iterator(); i.hasNext(); ) { int auraId = ((Integer)i.next());
          Aura aura = (Aura)World.instance.auras.get(Integer.valueOf(auraId));
          if ((aura.getDamage() >= 0.0D) && (!aura.getCategory().equals("d"))) {
            damage = (int)(damage * aura.getDamage());
          }
        }

Answer

Jens picture Jens · Jun 27, 2014

Looks like you have a library which need java8 and you run under a version lower than 8.

In java 8 the api has changed:

In java 8 the keySet method returned an object

ConcurrentHashMap.KeySetView<K,V>

In java 7

Set<K>