Java For loop broken when illiterating through List

Discussion in 'Plugin Development' started by SoS_Dylan, Sep 15, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    SoS_Dylan

    Code (line 272):
    Code:java
    1. for (String name : hidden) {

    Error:
    Code:
    15.09 02:52:15 [Server] SEVERE at java.lang.Thread.run(Unknown Source)
    15.09 02:52:15 [Server] SEVERE at net.coreprotect.consumer.Consumer.run(Consumer.java:49)
    15.09 02:52:15 [Server] SEVERE at net.coreprotect.consumer.Process.processConsumer(Process.java:101)
    15.09 02:52:15 [Server] SEVERE at net.coreprotect.consumer.Process.processPlayerSession(Process.java:324)
    15.09 02:52:15 [Server] SEVERE at net.coreprotect.database.Logger.log_session(Logger.java:81)
    15.09 02:52:15 [Server] SEVERE at net.coreprotect.database.Database.insertSession(Database.java:343)
    15.09 02:52:15 [Server] SEVERE at org.sqlite.PrepStmt.executeUpdate(PrepStmt.java:85)
    15.09 02:52:15 [Server] SEVERE at org.sqlite.DB.executeUpdate(DB.java:363)
    15.09 02:52:15 [Server] SEVERE at org.sqlite.DB.execute(DB.java:342)
    15.09 02:52:15 [Server] SEVERE at org.sqlite.DB.newSQLException(DB.java:387)
    15.09 02:52:15 [Server] SEVERE at org.sqlite.DB.newSQLException(DB.java:383)
    15.09 02:52:15 [Server] SEVERE java.sql.SQLException: [SQLITE_CORRUPT] The database disk image is malformed (database disk image is malformed)
    15.09 02:52:15 [Multicraft] Skipped 4 lines due to rate limit (30/s)
    15.09 02:52:15 [Server] INFO at java.lang.reflect.Method.invoke(Unknown Source)
    15.09 02:52:15 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    15.09 02:52:15 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    15.09 02:52:15 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    15.09 02:52:15 [Server] INFO at me.SoSDylan.Admin.Main.onPlayerJoin(Main.java:272)
    15.09 02:52:15 [Server] INFO at java.util.ArrayList$Itr.next(Unknown Source)
    15.09 02:52:15 [Server] INFO at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
    15.09 02:52:15 [Server] INFO Caused by: java.util.ConcurrentModificationException
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:413)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:481)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:239)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:592)
    15.09 02:52:15 [Server] INFO at org.spigotmc.netty.NettyServerConnection.b(NettyServerConnection.java:139)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.PendingConnection.d(PendingConnection.java:48)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.PendingConnection.e(PendingConnection.java:139)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.PlayerList.a(PlayerList.java:103)
    15.09 02:52:15 [Server] INFO at net.minecraft.server.v1_6_R2.PlayerList.c(PlayerList.java:207)
    15.09 02:52:15 [Server] INFO at us.Myles.PWP.FakePluginManager.callEvent(FakePluginManager.java:124)
    15.09 02:52:15 [Server] INFO at us.Myles.PWP.FakePluginManager.fireEvent(FakePluginManager.java:138)
    15.09 02:52:15 [Server] INFO at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30)
    15.09 02:52:15 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    15.09 02:52:15 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
    15.09 02:52:15 [Server] INFO org.bukkit.event.EventException
    15.09 02:52:15 [Server] SEVERE Could not pass event PlayerJoinEvent to Admin v1.0
     
  2. Offline

    Benatat12

    Caused by ConcurrentModificationException; one thread is mutating/accessing the same time as another. Fix by creating symchronizrd statements with locks.

    Or you could try a CopyOnWriteArraylist as your collection.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  3. Offline

    SoS_Dylan

    Benatat12
    Thanks. I was editing the array in the loop, but its not anymore. Really helped. :)
     
Thread Status:
Not open for further replies.

Share This Page