0

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!

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by NormR1
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.