Basically an exception is being thrown and I can't find the reason. Here is what I get on the console:
基本上是一个例外被抛出,我找不到原因。这是我在控制台上得到的:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.batik.gvt.renderer.StrokingTextPainter.computeTextRuns(Unknown Source)
at org.apache.batik.gvt.renderer.StrokingTextPainter.getTextRuns(Unknown Source)
at org.apache.batik.gvt.renderer.StrokingTextPainter.getOutline(Unknown Source)
at org.apache.batik.gvt.renderer.BasicTextPainter.getGeometryBounds(Unknown Source)
at org.apache.batik.gvt.TextNode.getGeometryBounds(Unknown Source)
at org.apache.batik.gvt.TextNode.getSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.getSensitiveBounds(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.nodeHitAt(Unknown Source)
at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchMouseEvent(Unknown Source)
at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchEvent(Unknown Source)
at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown Source)
at org.apache.batik.gvt.event.AbstractAWTEventDispatcher.mouseEntered(Unknown Source)
at org.apache.batik.swing.gvt.AbstractJGVTComponent$Listener.dispatchMouseEntered(Unknown Source)
at org.apache.batik.swing.svg.AbstractJSVGComponent$SVGListener.dispatchMouseEntered(Unknown Source)
at org.apache.batik.swing.gvt.AbstractJGVTComponent$Listener.mouseEntered(Unknown Source)
at java.awt.AWTEventMulticaster.mouseEntered(Unknown Source)
at java.awt.AWTEventMulticaster.mouseEntered(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.trackMouseEnterExit(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(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)
It is obviously from a batik lib that I use to paint SVG files, but I made sure that nothing is painted until the document is loaded, ready and showing on screen. When thrown nothing is painted.
很明显,我用蜡笔来绘制SVG文件,但我确保在文档加载,准备好并在屏幕上显示之前不会绘制任何内容。抛出时什么也没画。
Another interesting thing is the timing of the throwing. I am unable to find any logical patern, as sometimes it is thrown as soon as I initiate the class and sometimes it needs more then five minutes. In addition to this, as far as I tested there is no single action that calls repaint() that triggers it or rather all do.
另一个有趣的事情是投掷的时间。我无法找到任何逻辑模式,因为有时它会在我开始上课时抛出,有时它需要超过五分钟。除此之外,据我测试,没有一个单独的动作可以调用repaint()来触发它,或者更确切地说是所有动作。
I am new to Java and all the other exceptions had the class and row number of where they were thrown so I don't know what to do here.
我是Java新手,所有其他异常都有它们被抛出的类和行号,所以我不知道该怎么做。
Any suggestions would be greatly appreciated.
任何建议将不胜感激。
The code is enormous so I'll put just the paint method and if anything additional is needed please say so.
代码是巨大的,所以我将只使用paint方法,如果需要额外的东西,请说出来。
@Override
public void paint(Graphics g) {
if(documentLoaded && showingOnScreen){
try{
rad = (int)(radInit+zoom*faktorRad); //max rad = 20
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
paintElements(g2d);
}
catch(NullPointerException nulle){
}
}
}
edit: There is no array in my class so i can't check any index. I think that this exception is thrown from a library I use, but it's a .jar file and I don't know how to open it or if I can.
编辑:我的班级中没有数组,所以我无法检查任何索引。我认为这个异常是从我使用的库中引发的,但它是一个.jar文件,我不知道如何打开它或者我是否可以。
2 个解决方案
#1
0
java.lang.ArrayIndexOutOfBoundsException
This exception is only thrown then an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array. ArrayIndexOutOfBoundsException.
So that means in your program some where you are using array in wrong way.
只有在使用非法索引访问数组时才抛出此异常。索引为负数或大于或等于数组的大小。 ArrayIndexOutOfBoundsException异常。这意味着在你的程序中某些地方以错误的方式使用数组。
#2
0
It appears that the exception is thrown after a "mouse entered" event while the library is attempting to calculate something about the geometry. None of the classes in the stack trace appear to be listeners you have defined. I'm afraid I don't know anything about this library, but I suggest you go through the UI you have defined for things that aren't quite right, or even just things that you can remove and attempt to reproduce the problem. It looks like either something is wrong with the rendered geometry or the listener is getting called before it is supposed to, and depends on rendering that has not happened yet.
当库试图计算关于几何的某些东西时,似乎在“鼠标输入”事件之后抛出异常。堆栈跟踪中的所有类都不是您定义的侦听器。我担心我对这个库一无所知,但是我建议你浏览一下你为不太正确的东西定义的用户界面,或者甚至只是那些你可以删除并尝试重现问题的东西。看起来渲染的几何体有问题,或者在它应该被调用之前调用它,并且依赖于尚未发生的渲染。
#1
0
java.lang.ArrayIndexOutOfBoundsException
This exception is only thrown then an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array. ArrayIndexOutOfBoundsException.
So that means in your program some where you are using array in wrong way.
只有在使用非法索引访问数组时才抛出此异常。索引为负数或大于或等于数组的大小。 ArrayIndexOutOfBoundsException异常。这意味着在你的程序中某些地方以错误的方式使用数组。
#2
0
It appears that the exception is thrown after a "mouse entered" event while the library is attempting to calculate something about the geometry. None of the classes in the stack trace appear to be listeners you have defined. I'm afraid I don't know anything about this library, but I suggest you go through the UI you have defined for things that aren't quite right, or even just things that you can remove and attempt to reproduce the problem. It looks like either something is wrong with the rendered geometry or the listener is getting called before it is supposed to, and depends on rendering that has not happened yet.
当库试图计算关于几何的某些东西时,似乎在“鼠标输入”事件之后抛出异常。堆栈跟踪中的所有类都不是您定义的侦听器。我担心我对这个库一无所知,但是我建议你浏览一下你为不太正确的东西定义的用户界面,或者甚至只是那些你可以删除并尝试重现问题的东西。看起来渲染的几何体有问题,或者在它应该被调用之前调用它,并且依赖于尚未发生的渲染。