如果线程启动Executor,则无法从未来的<?>和SwingWorker获得ArrayIndexOutOfLimsException和SwingWorker。我使用Executor来玩SwingWorker的多步操作,我在那里错误地识别了向量中的错误元素,看起来就像这段代码忽略了Vector中的元素一样我的问题->如何/是否有可能以某种方式捕捉到这个异常?简单输出run:Thread Status with Name :StartShedule, SwingWorker Status is STARTEDThread Status with Name :StartShedule, SwingWorker Status is
DONEThread Status with Name :StartShedule, SwingWorker Status is STARTEDThread Status with Name :StartShedule, SwingWorker Status is DONE
Thread Status with Name :StartShedule, SwingWorker Status is STARTEDThread Status with Name :StartShedule, SwingWorker Status is DONE
BUILD SUCCESSFUL (total time: 11 seconds)不屑一顾//changeTableValues1(); // un-comment for get ArrayIndexOutOfBoundsException一切都是正确的,我得到了ArrayIndexOutOf1244-异常,输出是run:Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2
at java.util.Vector.get(Vector.java:694)
at KondorExport.Util.Help.Table.TableWithExecutor.changeTableValues1(TableWithExecutor.java:70)
at KondorExport.Util.Help.Table.TableWithExecutor.access$100(TableWithExecutor.java:18)
at KondorExport.Util.Help.Table.TableWithExecutor$2.actionPerformed(TableWithExecutor.java:61)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
2 回答
哔哔one
TA贡献1854条经验 获得超8个赞
get()
done()
@Overrideprotected void done() { if (str.equals("StartShedule")) { try { get(); } catch (Exception ex) { // This exception was thrown during processing ex.printStackTrace(); } }}
done()
添加回答
举报
0/150
提交
取消