Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

java.lang.ArrayIndexOutOfBoundsException

Thread view: 
johnson - 05 Jan 2004 14:01 GMT
Hi, Goodmorning,

I run into an ArrayIndexOutOfBoundsException.
From the stack trace we can see that it does not really have anything
to do with our code other than one line and that runs our event
dispathing on our event queue.

My questions is:
1. Is this caused by a Swing internal bug?
2. It seems odd since from the code in (class: BlockView, method:
layoutMinorAxis), that it only assigns value to arrays offsets[] and
spans[] and there is no code trying to retrive data from the arrays.
Then even if the array is an empty one, it should still be valid to
assign a value to its first element. What could cause the
java.lang.ArrayIndexOutOfBoundsException: 0 ??

I am confused. Anybody gets any idea??
Thanks.

java.lang.ArrayIndexOutOfBoundsException: 0
    at javax.swing.text.html.BlockView.layoutMinorAxis(Unknown Source)
    at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
    at javax.swing.text.BoxView.layout(Unknown Source)
    at javax.swing.text.BoxView.setSize(Unknown Source)
    at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown
Source)
    at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(Unknown
Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at javax.swing.JEditorPane.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.CardLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.CardLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.CardLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.CardLayout.preferredLayoutSize(Unknown Source)
    at java.awt.Container.preferredSize(Unknown Source)
    at java.awt.Container.getPreferredSize(Unknown Source)
    at javax.swing.JComponent.getPreferredSize(Unknown Source)
    at java.awt.GridBagLayout.GetLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.getLayoutInfo(Unknown Source)
    at java.awt.GridBagLayout.ArrangeGrid(Unknown Source)
    at java.awt.GridBagLayout.arrangeGrid(Unknown Source)
    at java.awt.GridBagLayout.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.validate(Unknown Source)
    at javax.swing.RepaintManager.validateInvalidComponents(Unknown
Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown
Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at com.my_company.my_project.gui.comp.My_EventQueue.dispatchEvent(My_EventQueue.java:51)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)
Bryan E. Boone - 05 Jan 2004 14:27 GMT
Can you post any source that can be used to reproduce this exception?
-Bryan
> Hi, Goodmorning,
>
[quoted text clipped - 84 lines]
> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> at
com.my_company.my_project.gui.comp.My_EventQueue.dispatchEvent(My_EventQueue
.java:51)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
> Source)
[quoted text clipped - 3 lines]
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)
jT - 05 Jan 2004 15:11 GMT
Hi johnson,

without knowing the details of this problem I thought I'd point out a
mistake you made by saying:

> Then even if the array is an empty one, it should still be valid to
> assign a value to its first element. What could cause the
> java.lang.ArrayIndexOutOfBoundsException: 0 ??

This is not true. Doing what you here explain will cause exactly the
exception mentioned to be thrown. If you create an empty array with the
length of 0, you can not then add any elements to it. Element in the
position 0 of an array would be the last element of an array with length of
1.

so doing this:
int[] n = new int[0];
n[0] = 1;
will always fail.

I don't know if this will solve your problem, but hope it will guide you to
the right direction.

best regards,
-jT


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.