Buggy code:
public class Tree extends AbstractTree implements TreeModelListener { public static class DefaultNodePanel extends Panel { private static final long serialVersionUID = 1L ; public DefaultNodePanel ( String panelId , Tree tree , DefaultMutableTreeNode node ) { } } private static final class SpacerList extends Loop { private static final long serialVersionUID = 1L ; public SpacerList ( String id , int size ) { } protected void populateItem ( final Loop . LoopItem loopItem ) { } } private final class TreePathsListView extends ListView { private static final long serialVersionUID = 1L ; public TreePathsListView ( String name ) { } public boolean getReuseItems ( ) { } protected ListItem newItem ( final int index ) { } protected void populateItem ( ListItem listItem ) { } } private final class TreePathsModel implements IModel { private static final long serialVersionUID = 1L ; boolean dirty = true ; private List paths = new ArrayList ( ) ; private transient boolean attached = false ; void add ( int index , DefaultMutableTreeNode node ) { } int indexOf ( DefaultMutableTreeNode node ) { } void remove ( DefaultMutableTreeNode node ) { } public Object getObject ( ) { } public void setObject ( Object object ) { } public void detach ( ) { } } public static final String JUNCTION_IMAGE_NAME = "junctionImage" ; public static final String NODE_IMAGE_NAME = "nodeImage" ; private static final ResourceReference BLANK = new ResourceReference ( Tree . class , "blank.gif" ) ; private static final ResourceReference CSS = new CompressedResourceReference ( Tree . class , "tree.css" ) ; private static final ResourceReference MINUS = new ResourceReference ( Tree . class , "minus.gif" ) ; private static final ResourceReference PLUS = new ResourceReference ( Tree . class , "plus.gif" ) ; private static final long serialVersionUID = 1L ; private boolean reuseItems = true ; private Tree . TreePathsListView treePathsListView ; private Tree . TreePathsModel treePathsModel ; public Tree ( final String id , final TreeModel model ) { } public Tree ( String id , TreeState treeState ) { } public boolean getOptimizeItemRemoval ( ) { } public boolean getReuseItems ( ) { } public void setOptimizeItemRemoval ( boolean optimizeItemRemoval ) { } public Tree setReuseItems ( boolean reuseItems ) { } public void setTreeModel ( final TreeModel treeModel ) { } public void setTreeState ( final TreeState treeState ) { } public void treeNodesChanged ( TreeModelEvent e ) { } public void treeNodesInserted ( TreeModelEvent e ) { } public void treeNodesRemoved ( TreeModelEvent e ) { } public void treeStructureChanged ( TreeModelEvent e ) { } protected Link createJunctionLink ( final DefaultMutableTreeNode node ) { } protected Link createNodeLink ( final DefaultMutableTreeNode node ) { } protected final Tree . TreePathsListView createTreePathsListView ( ) { } protected boolean equals ( final TreePath path , final TreePath selectedPath ) { } protected ResourceReference getCss ( ) { } protected Image getJunctionImage ( final DefaultMutableTreeNode node ) { } protected Image getNodeImage ( final DefaultMutableTreeNode node ) { } protected String getNodeLabel ( final DefaultMutableTreeNode node ) { } protected void onAttach ( ) { <START_BUG> super . onBeforeRender ( ) ; <END_BUG> if ( ! ( getOptimizeItemRemoval ( ) ) ) { treePathsModel . dirty = true ; } } protected void junctionLinkClicked ( final DefaultMutableTreeNode node ) { } protected Component newNodePanel ( String panelId , DefaultMutableTreeNode node ) { } protected void nodeLinkClicked ( final DefaultMutableTreeNode node ) { } }

Fix:
super . onAttach ( ) ;