Buggy code:
public abstract class BaseTree extends AbstractTree { public BaseTree ( String id ) { } public BaseTree ( String id , IModel < ? extends TreeModel > model ) { } private static final ResourceReference CSS = new CompressedResourceReference ( BaseTree . class , "res//base-tree.css" ) ; protected ResourceReference getCSS ( ) { } private static final long serialVersionUID = 1L ; private static final String JUNCTION_LINK_ID = "junctionLink" ; private static final String NODE_COMPONENT_ID = "nodeComponent" ; @ SuppressWarnings ( "unchecked" ) @ Override protected void populateTreeItem ( WebMarkupContainer item , int level ) { Object node = item . getDefaultModelObject ( ) ; Component junctionLink = newJunctionLink ( item , BaseTree . JUNCTION_LINK_ID , node ) ; junctionLink . add ( new BaseTree . JunctionBorder ( node , level ) ) ; item . add ( junctionLink ) ; Component nodeComponent = newNodeComponent ( BaseTree . NODE_COMPONENT_ID , ( ( IModel < Object > ) ( item . getDefaultModel ( ) ) ) ) ; item . add ( nodeComponent ) ; item . add ( new Behavior ( ) { private static final long serialVersionUID = 1L ; @ Override public void onComponentTag ( Component component , ComponentTag tag ) { Object node = component . getDefaultModelObject ( ) ; String klass = getItemClass ( node ) ; if ( ! ( Strings . isEmpty ( klass ) ) ) { <START_BUG> CharSequence oldClass = tag . getString ( "class" ) ; <END_BUG> if ( Strings . isEmpty ( oldClass ) ) { tag . put ( "class" , klass ) ; } else { tag . put ( "class" , ( ( oldClass + "<seq2seq4repair_space>" ) + klass ) ) ; } } } } ) ; } protected String getItemClass ( Object node ) { } protected String getSelectedClass ( ) { } protected abstract Component newNodeComponent ( String id , IModel < Object > model ) { } private boolean isNodeLast ( Object node ) { } private class JunctionBorder extends Behavior { private static final long serialVersionUID = 1L ; private final Object node ; private final int level ; public JunctionBorder ( Object node , int level ) { } @ Override public void afterRender ( final Component component ) { } @ Override public void beforeRender ( final Component component ) { } } protected Component newJunctionLink ( MarkupContainer parent , final String id , final Object node ) { } protected void onJunctionLinkClicked ( AjaxRequestTarget target , Object node ) { } public static final class LinkType extends EnumeratedType { public static final BaseTree . LinkType AJAX = new BaseTree . LinkType ( "AJAX" ) ; public static final BaseTree . LinkType AJAX_FALLBACK = new BaseTree . LinkType ( "AJAX_FALLBACK" ) ; public static final BaseTree . LinkType REGULAR = new BaseTree . LinkType ( "REGULAR" ) ; private static final long serialVersionUID = 1L ; public LinkType ( String name ) { } } public interface ILinkCallback extends IClusterable { void onClick ( AjaxRequestTarget target ) { } } public MarkupContainer newLink ( String id , final BaseTree . ILinkCallback callback ) { } public BaseTree . LinkType getLinkType ( ) { } public void setLinkType ( BaseTree . LinkType linkType ) { } @ Override protected boolean isForceRebuildOnSelectionChange ( ) { } @ Override public void renderHead ( IHeaderResponse response ) { } private BaseTree . LinkType linkType = BaseTree . LinkType . AJAX ; }

Fix:
CharSequence oldClass = tag . getAttribute ( "class" ) ;