2

我已经在这里发布了一个类似的问题:Batik IllegalStateException when resizing the JComponent contains the JSVGCanvas。但是,我可以将问题简化为最少的代码集。也许这可以帮助某人找到我的问题。

我从一个线程重复调用以下代码:

//currentComponent is a custom JComponent that contains the JSVGCanvas
if(currentComponent != null && currentComponent.getSvgCanvas().getUpdateManager() != null)
{
    try
    {
        currentComponent.getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                resetDocument();
            }

            private void resetDocument()
            {
                currentComponent.getSvgCanvas().setDocument(currentComponent.getSvgCanvas().getSVGDocument());
            }
        });
    }
    catch(Exception e)
    {
        System.out.println("Error");
        e.printStackTrace();
    }
}

有时我会收到以下异常:

java.lang.IllegalStateException: RunnableQueue not started or has exited
    at org.apache.batik.util.RunnableQueue.invokeLater(RunnableQueue.java:277)
    at java.lang.Thread.run(Unknown Source)

这是蜡染中的错误还是我做错了什么?

4

2 回答 2

2

我有类似的问题。相同的 IllegalStateException 仅在特殊用例中发生。

我的问题是我的代码是在

documentLoadingCompleted(SVGDocumentLoaderEvent P_event)

since I'm executing my code during

gvtRenderingCompleted(GVTTreeRendererEvent P_e)

everything works.

于 2013-03-15T06:11:02.303 回答
0

http://xmlgraphics.apache.org/batik/javadoc/org/apache/batik/util/RunnableQueue.html#invokeLater%28java.lang.Runnable%29

  public void invokeLater(Runnable r)

  Schedules the given Runnable object for a later invocation, and returns. An exception is thrown if the RunnableQueue was not started. 
  Throws:
    IllegalStateException - if getThread() is null.

看起来好像您的 RunnableQueue 尚未启动...

于 2013-02-12T10:34:07.797 回答