Jump to content
  • Advertisement
Sign in to follow this  
Kaze

[java] java internal java.lang.ArrayIndexOutOfBoundsException

This topic is 2557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I find the cause of a exception that was created and caught entirely within the java libraries.


Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at javax.swing.text.BoxView.getOffset(Unknown Source)
at javax.swing.text.BoxView.childAllocation(Unknown Source)
at javax.swing.text.CompositeView.getChildAllocation(Unknown Source)
at javax.swing.text.BoxView.getChildAllocation(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.calculateViewPosition(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.layoutContainer(Unknown Source)
at java.awt.Container.layout(Unknown Source)
at java.awt.Container.doLayout(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validate(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Share this post


Link to post
Share on other sites
Advertisement
Most likely it's because you're manipulating some text, while an other thread is trying to reach it. Is your program multithreaded?

The stack says "EventDispatchThread" so it's most likely caused by some event being thrown.


Otherwise try with a few System.out.println this is generally considered ugly code, but it can be quite useful, if you got the tiniest idea of where the bug is located.


But generally it's difficult to say any more, with this few informations.

Share this post


Link to post
Share on other sites

Most likely it's because you're manipulating some text, while an other thread is trying to reach it. Is your program multithreaded?

I'm not using any multithreading unless swing is doing it in the background.


The stack says "EventDispatchThread" so it's most likely caused by some event being thrown.
Otherwise try with a few System.out.println this is generally considered ugly code, but it can be quite useful, if you got the tiniest idea of where the bug is located.

I already have a logger and put try catches on events I suspected might be the problem but haven't got anything yet.


But generally it's difficult to say any more, with this few informations.

I don't have much more information, this bug seems to happen randomly.

Share this post


Link to post
Share on other sites
Yes swing does it behind your back.. does it happen at random, when you click some thing, or does it just happen at random?


Do your program use any kind of text verification?
Do you have a game loop, that repeats some code?
Do you do any thing in the thread that opens the window (calls setVisible) after you've opened the window?

Edit: if yes, please post the code :)

Share this post


Link to post
Share on other sites
I don't think my project has any of that though I think you are right about it being a multithreading issue due to how randomly it happens.

Share this post


Link to post
Share on other sites

What does your program do?


At the moment very little, I'm just working on a user interface for editing some files that will eventually be a game maker like program.

Share this post


Link to post
Share on other sites
Ok, the error should be where you are entering some text.

I think I need to see the code for every where the user can give any input, and the code where you create the window..

Also what swing components are you using?

Share this post


Link to post
Share on other sites
Since this is a commercial project I can't post large sections of the code. Entering text doesn't seem to correlate with the error occurring since it often happens at start up. I am using most of the basic swing components.

Share this post


Link to post
Share on other sites
In absence of code, maybe an approach could be to remove one or a group of the swing controls at a time. You could delete them then undo the change after a test run assuming your ide has undo (and hopefully for a commercial venture you have some source control going on to further protect from any crazily bad outcomes).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!