Infinite loop on dtree.forceUpdate() in tests
Summary
When running a test with AbstractUITest, sometimes (randomly), when the function mainGUI.checkModelingSynthax() is called, the dtree.forceUpdate() method blocks indefinitely the execution.
Steps to reproduce
Run ui.AvatarSecurityTests with mainGUI.checkModelingSyntax(true, true);
instead of mainGUI.checkModelingSyntax(true, false);
at line 91.
Relevant logs and/or screenshots
Sometimes, this error is thrown:
java.lang.NullPointerException
at java.desktop/javax.swing.JLabel.setIcon(JLabel.java:398)
at java.desktop/javax.swing.tree.DefaultTreeCellRenderer.getTreeCellRendererComponent(DefaultTreeCellRenderer.java:543)
at ui.tree.DiagramTreeRenderer.getTreeCellRendererComponent(DiagramTreeRenderer.java:110)
at java.desktop/javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:3155)
at java.desktop/javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:493)
at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1344)
at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1465)
at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(VariableHeightLayoutCache.java:1272)
at java.desktop/javax.swing.tree.VariableHeightLayoutCache.rebuild(VariableHeightLayoutCache.java:728)
at java.desktop/javax.swing.tree.VariableHeightLayoutCache.setModel(VariableHeightLayoutCache.java:111)
at java.desktop/javax.swing.plaf.basic.BasicTreeUI.setModel(BasicTreeUI.java:495)
at java.desktop/javax.swing.plaf.basic.BasicTreeUI$Handler.propertyChange(BasicTreeUI.java:3820)
at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
at java.desktop/java.awt.Component.firePropertyChange(Component.java:8731)
at java.desktop/javax.swing.JTree.setModel(JTree.java:893)
at ui.tree.JDiagramTree.forceUpdate(JDiagramTree.java:158)
at ui.MainGUI.checkModelingSyntax(MainGUI.java:4505)
at ui.MainGUI.checkModelingSyntax(MainGUI.java:3858)
at ui.AvatarSecurityTests.runTest(AvatarSecurityTests.java:91)
at ui.AvatarSecurityTests.testAvatarSecurityModel(AvatarSecurityTests.java:78)
Possible fixes
We tried to add some delay after loading the model.
The current fix is to remove the forceUpdate() call.