相关疑难解决方法(0)

如果线程启动执行程序,则无法从Future <?>和SwingWorker获取ArrayIndexOutOfBoundsException

我通过使用Executor玩SwingWorker的多线程,我在那里错误地从Vector中识别出错误的元素,看起来像这个代码相当忽略了Vector中的元素不存在

我的问题 - >如何/有可能以某种方式捕获此异常

简单的输出

run:
Thread Status with Name :StartShedule, SwingWorker Status is STARTED
Thread Status with Name :StartShedule, SwingWorker Status is DONE
Thread Status with Name :StartShedule, SwingWorker Status is STARTED
Thread Status with Name :StartShedule, SwingWorker Status is DONE
Thread Status with Name :StartShedule, SwingWorker Status is STARTED
Thread Status with Name :StartShedule, SwingWorker Status is DONE
BUILD SUCCESSFUL (total time: 11 seconds)
Run Code Online (Sandbox Code Playgroud)

通过取消注释

//changeTableValues1(); // un-comment for get ArrayIndexOutOfBoundsException
Run Code Online (Sandbox Code Playgroud)

一切都正确,我得到ArrayIndexOutOfBoundsException并输出

run:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: …
Run Code Online (Sandbox Code Playgroud)

java swing exception-handling vector swingworker

20
推荐指数
2
解决办法
8356
查看次数

标签 统计

exception-handling ×1

java ×1

swing ×1

swingworker ×1

vector ×1