Buggy code:
public class Palette < T > extends Panel { private static final String SELECTED_HEADER_ID = "selectedHeader" ; private static final String AVAILABLE_HEADER_ID = "availableHeader" ; private static final long serialVersionUID = 1L ; private final IModel < ? extends Collection < ? extends T > > choicesModel ; private final IChoiceRenderer < T > choiceRenderer ; private final int rows ; private final boolean allowOrder ; private Recorder < T > recorderComponent ; private Component choicesComponent ; private Component selectionComponent ; private static final ResourceReference JAVASCRIPT = new JavascriptResourceReference ( Palette . class , "palette.js" ) ; private static final ResourceReference CSS = new CompressedResourceReference ( Palette . class , "palette.css" ) ; public Palette ( String id , IModel < ? extends Collection < ? extends T > > choicesModel , IChoiceRenderer < T > choiceRenderer , int rows , boolean allowOrder ) { } public Palette ( String id , IModel < List < T > > model , IModel < ? extends Collection < ? extends T > > choicesModel , IChoiceRenderer < T > choiceRenderer , int rows , boolean allowOrder ) { } @ Override protected void onBeforeRender ( ) { } private void initFactories ( ) { } protected ResourceReference getCSS ( ) { } public final boolean isPaletteEnabled ( ) { } public Iterator < T > getSelectedChoices ( ) { } public Iterator < T > getUnselectedChoices ( ) { } protected Recorder < T > newRecorderComponent ( ) { } protected Component newAvailableHeader ( String componentId ) { } protected Component newSelectedHeader ( String componentId ) { } protected Component newDownComponent ( ) { } protected Component newUpComponent ( ) { } protected Component newRemoveComponent ( ) { } protected Component newAddComponent ( ) { } protected Component newSelectionComponent ( ) { } protected Map < String , String > getAdditionalAttributesForSelection ( Object choice ) { } protected Component newChoicesComponent ( ) { } protected Map < String , String > getAdditionalAttributesForChoices ( Object choice ) { } protected Component getChoicesComponent ( ) { } protected Component getSelectionComponent ( ) { } public final Recorder < T > getRecorderComponent ( ) { } public Collection < ? extends T > getChoices ( ) { } @ SuppressWarnings ( "unchecked" ) public Collection < T > getModelCollection ( ) { } public IChoiceRenderer < T > getChoiceRenderer ( ) { } public int getRows ( ) { } protected final void updateModel ( ) { } protected String buildJSCall ( String funcName ) { <START_BUG> return new StringBuffer ( funcName ) . append ( "('" ) . append ( getChoicesComponent ( ) . getMarkupId ( ) ) . append ( "','" ) . append ( getSelectionComponent ( ) . getMarkupId ( ) ) . append ( "','" ) . append ( getRecorderComponent ( ) . getMarkupId ( ) ) . append ( "');" ) . toString ( ) ; <END_BUG> } public String getChoicesOnFocusJS ( ) { } public String getSelectionOnFocusJS ( ) { } public String getAddOnClickJS ( ) { } public String getRemoveOnClickJS ( ) { } public String getUpOnClickJS ( ) { } public String getDownOnClickJS ( ) { } @ Override protected void onDetach ( ) { } private class PaletteButton extends WebMarkupContainer { private static final long serialVersionUID = 1L ; public PaletteButton ( String id ) { } @ Override protected void onComponentTag ( ComponentTag tag ) { } } @ Override public void renderHead ( IHeaderResponse response ) { } }

Fix:
return new StringBuilder ( funcName ) . append ( "('" ) . append ( getChoicesComponent ( ) . getMarkupId ( ) ) . append ( "','" ) . append ( getSelectionComponent ( ) . getMarkupId ( ) ) . append ( "','" ) . append ( getRecorderComponent ( ) . getMarkupId ( ) ) . append ( "');" ) . toString ( ) ;