Colliding actions on ProgressPanel ? NullPointerException in "AWT-EventQueue-0"

My CMD window shows exceptions like this from time to time when certain activities (e.g. opening the partner window) are being performed in the AS2 GUI:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/javax.swing.plaf.basic.BasicProgressBarUI.sizeChanged(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicProgressBarUI.setAnimationIndex(Unknown Source)

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.desktop/javax.swing.plaf.basic.BasicProgressBarUI.updateSizes(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicProgressBarUI.getBox(Unknown Source)

As far as I was able to find out, this is likely connected to Swing not being "thread safe" and multiple threads accessing Swing/AWT components in parallel.
In my further investigation, I looked up the source code for class "de.mendelson.util.ProgressPanel".

Method "displayProgressBar" makes use of "SwingUtilities.invokeAndWait" ... which is good and "as recommended", I think.
On the other hand, method "disableProgressDisplay" does not use "invokeAndWait" or "invokeLater".

Shouldn't "disableProgressDisplay" enqueue its GUI related commands to the Swing eventqueue as well ?

... since the same Swing/AWT components ("jProgressBar" and "jLabelProgressDetails") are affected as in "displayProgressBar".
... and since "disableProgressDisplay" is executed in separate threads as well. (... via "stopProgressIfExists", as initiated from class AS2Gui)



Profile picture for user service


thank you for your feedback. We reworked this panel already - hopefully this is fixed for the next version.


Hello Service,

today I started testing your new version b57.
And I found that the above mentioned exceptions still happen from time to time.

Have you looked at method "de.mendelson.util.ProgressPanel.disableProgressDisplay" ?
It hasn't changed compared to b55.

I think the problem still is that in "disableProgressDisplay" properties of "jProgressBar" and/or "jLabelProgressDetails" are changed without enqueuing the change to the Swing eventqueue.

What do you think ?