Buggy code:
public abstract class Tree extends AbstractTree implements TreeModelListener { public static final String JUNCTION_IMAGE_NAME = "junctionImage" ; public static final String NODE_IMAGE_NAME = "nodeImage" ; private static final ResourceReference BLANK = new PackageResourceReference ( Tree . class , "blank.gif" ) ; private static final ResourceReference MINUS = new PackageResourceReference ( Tree . class , "minus.gif" ) ; private static final ResourceReference PLUS = new PackageResourceReference ( Tree . class , "plus.gif" ) ; private static final PackageResourceReference CSS = new PackageResourceReference ( Tree . class , "tree.css" ) ; private boolean optimizeItemRemoval = true ; private Tree . TreePathsModel treePathsModel ; private Tree . TreePathsListView treePathsListView ; private final class SelectedPathReplacementModel extends Model { private final DefaultMutableTreeNode node ; public SelectedPathReplacementModel ( DefaultMutableTreeNode node ) { } public Object getObject ( final Component component ) { } } private final class SpacerList extends Loop { public SpacerList ( String id , int size ) { } protected void populateItem ( final Loop . LoopItem loopItem ) { } } private final class TreePathsListView extends ListView { public TreePathsListView ( String name ) { } public boolean getOptimizeItemRemoval ( ) { } protected ListItem newItem ( final int index ) { } protected void populateItem ( ListItem listItem ) { } } private final class TreePathsModel extends AbstractReadOnlyDetachableModel { boolean dirty = true ; private List paths = new ArrayList ( ) ; void add ( int index , DefaultMutableTreeNode node ) { } void remove ( DefaultMutableTreeNode node ) { } int indexOf ( DefaultMutableTreeNode node ) { } protected void onAttach ( ) { } protected void onDetach ( ) { } protected Object onGetObject ( Component component ) { } public IModel getNestedModel ( ) { } } protected abstract class NodePanel extends Panel { public NodePanel ( final String id , final DefaultMutableTreeNode node ) { } } protected class DefaultNodePanel extends Tree . NodePanel { DefaultNodePanel ( String panelId , DefaultMutableTreeNode node ) { } } public Tree ( final String id , final TreeModel model ) { } public Tree ( String id , TreeState treeState ) { } private void addCSS ( ) { IModel hrefReplacement = new Model ( ) { public Object getObject ( Component component ) { String url = getPage ( ) . urlFor ( Tree . CSS . getPath ( ) ) ; return url ; } } ; WebMarkupContainer css = new WebMarkupContainer ( "css" ) ; css . add ( new wicket . AttributeModifier ( "href" , true , hrefReplacement ) ) ; <START_BUG> addToHeader ( css ) ; <END_BUG> } public boolean getOptimizeItemRemoval ( ) { } public void setOptimizeItemRemoval ( boolean optimizeItemRemoval ) { } public void setTreeState ( final TreeState treeState ) { } public void setTreeModel ( final TreeModel treeModel ) { } public void treeNodesChanged ( TreeModelEvent e ) { } public void treeNodesInserted ( TreeModelEvent e ) { } public void treeNodesRemoved ( TreeModelEvent e ) { } public void treeStructureChanged ( TreeModelEvent e ) { } protected void internalOnBeginRequest ( ) { } protected Tree . NodePanel newNodePanel ( String panelId , DefaultMutableTreeNode node ) { } protected final Tree . TreePathsListView createTreePathsListView ( ) { } protected boolean equals ( final TreePath path , final TreePath selectedPath ) { } protected Image getJunctionImage ( final DefaultMutableTreeNode node ) { } protected Image getNodeImage ( final DefaultMutableTreeNode node ) { } protected String getNodeLabel ( final DefaultMutableTreeNode node ) { } protected void junctionLinkClicked ( final DefaultMutableTreeNode node ) { } protected void nodeLinkClicked ( final DefaultMutableTreeNode node ) { } private final Link createJunctionLink ( final DefaultMutableTreeNode node ) { } private final Link createNodeLink ( final DefaultMutableTreeNode node ) { } private String getCssClassForRow ( ) { } private String getCssClassForSelectedRow ( ) { } }

Fix:
add ( css ) ;