This is Code:

    public static int getAutoIncrement(int ain)
    {
        int count = 0;
        for(SBufferScheme scheme : getInstance().listScheme)
            if(ain == scheme.id)
                count++;
            if(count == 0)
                return ain;
        return getAutoIncrement(ain + 1);
    }

And this is Error:

   Exception in thread "ThreadPoolExecutor-10" java.lang.StackOverflowError
        at java.util.AbstractList$Itr.next(AbstractList.java:345)
        at lft.gameserver.model.ManageBbsBuffer.getAutoIncrement(ManageBbsBuffer.java:36)
        at lft.gameserver.model.ManageBbsBuffer.getAutoIncrement(ManageBbsBuffer.java:41)

Any idea what could be causing this?
Thanks!

what could be causing this?

The method is calling itself too many times. When do you expect that it will stop calling itself?
Try debugging the code by adding some println statements to show the values of the variables used so you can see what the computer sees when the code is executed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.