Buggy code:
public class DatePicker extends AbstractBehavior implements IHeaderContributor { private static final class UnableToDetermineFormatException extends WicketRuntimeException { private static final long serialVersionUID = 1L ; public UnableToDetermineFormatException ( ) { } } public static final DateFormat FORMAT_DATE = new SimpleDateFormat ( "MM//dd//yyyy" ) ; public static final DateFormat FORMAT_PAGEDATE = new SimpleDateFormat ( "MM//yyyy" ) ; private static final long serialVersionUID = 1L ; private Component component ; public DatePicker ( ) { } public void bind ( Component component ) { } public void onRendered ( Component component ) { } public void renderHead ( IHeaderResponse response ) { YuiLib . load ( response ) ; if ( enableMonthYearSelection ( ) ) { response . renderCSSReference ( new ResourceReference ( YuiLib . class , "calendar//assets//wicket-calendar.css" ) ) ; String idSelector = ( "#" + ( getEscapedComponentMarkupId ( ) ) ) + "DpJs" ; new StringHeaderContributor ( ( ( ( ( "<style>" + idSelector ) + ".yui-calendar<seq2seq4repair_space>.calnavleft,<seq2seq4repair_space>" ) + idSelector ) + ".yui-calendar<seq2seq4repair_space>.calnavright<seq2seq4repair_space>{display:<seq2seq4repair_space>none;}<//style>" ) ) . renderHead ( response ) ; } Map variables = new HashMap ( ) ; String widgetId = getEscapedComponentMarkupId ( ) ; variables . put ( "componentId" , getComponentMarkupId ( ) ) ; variables . put ( "widgetId" , widgetId ) ; variables . put ( "datePattern" , getDatePattern ( ) ) ; variables . put ( "fireChangeEvent" , Boolean . valueOf ( notifyComponentOnDateSelected ( ) ) ) ; variables . put ( "alignWithIcon" , Boolean . valueOf ( alignWithIcon ( ) ) ) ; variables . put ( "pathToWicketDate" , RequestCycle . get ( ) . urlFor ( new JavascriptResourceReference ( DatePicker . class , "wicket-date.js" ) ) ) ; variables . put ( "basePath" , RequestCycle . get ( ) . urlFor ( new JavascriptResourceReference ( YuiLib . class , "" ) ) ) ; variables . put ( "enableMonthYearSelection" , Boolean . valueOf ( enableMonthYearSelection ( ) ) ) ; variables . put ( "hideOnSelect" , Boolean . valueOf ( hideOnSelect ( ) ) ) ; String script = getAdditionalJavascript ( ) ; if ( script != null ) { <START_BUG> variables . put ( "additionalJavascript" , script . replaceAll ( "\\$\\{calendar\\}" , ( ( "YAHOO.wicket." + widgetId ) + "DpJs" ) ) ) ; <END_BUG> } Properties p = new Properties ( ) ; configure ( p ) ; if ( ( ( enableMonthYearSelection ( ) ) && ( p . containsKey ( "pages" ) ) ) && ( ( Objects . longValue ( p . get ( "pages" ) ) ) > 1 ) ) { throw new IllegalStateException ( "You<seq2seq4repair_space>cannot<seq2seq4repair_space>use<seq2seq4repair_space>a<seq2seq4repair_space>CalendarGroup<seq2seq4repair_space>with<seq2seq4repair_space>month//year<seq2seq4repair_space>selection!" ) ; } StringBuffer calendarInit = new StringBuffer ( ) ; for ( Iterator i = p . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( i . next ( ) ) ) ; calendarInit . append ( entry . getKey ( ) ) ; Object value = entry . getValue ( ) ; if ( value instanceof CharSequence ) { calendarInit . append ( ":\"" ) ; calendarInit . append ( Strings . toEscapedUnicode ( value . toString ( ) ) ) ; calendarInit . append ( "\"" ) ; } else if ( value instanceof CharSequence [ ] ) { calendarInit . append ( ":[" ) ; CharSequence [ ] valueArray = ( ( CharSequence [ ] ) ( value ) ) ; for ( int j = 0 ; j < ( valueArray . length ) ; j ++ ) { CharSequence tmpValue = valueArray [ j ] ; if ( j > 0 ) { calendarInit . append ( "," ) ; } if ( tmpValue != null ) { calendarInit . append ( "\"" ) ; calendarInit . append ( Strings . toEscapedUnicode ( tmpValue . toString ( ) ) ) ; calendarInit . append ( "\"" ) ; } } calendarInit . append ( "]" ) ; } else { calendarInit . append ( ":" ) ; calendarInit . append ( Strings . toEscapedUnicode ( String . valueOf ( value ) ) ) ; } if ( i . hasNext ( ) ) { calendarInit . append ( "," ) ; } } variables . put ( "calendarInit" , calendarInit . toString ( ) ) ; TextTemplate datePickerJs = new PackagedTextTemplate ( DatePicker . class , "DatePicker.js" ) ; datePickerJs . interpolate ( variables ) ; response . renderOnDomReadyJavascript ( datePickerJs . asString ( ) ) ; } private final void checkComponentProvidesDateFormat ( Component component ) { } private void setWidgetProperty ( Map widgetProperties , String key , String [ ] array ) { } protected boolean alignWithIcon ( ) { } protected void appendToInit ( String markupId , String javascriptId , String javascriptWidgetId , StringBuffer b ) { } protected void configure ( Map widgetProperties ) { } protected final void configureWidgetProperties ( Map widgetProperties ) { } protected final String [ ] filterEmpty ( String [ ] array ) { } protected final String getComponentMarkupId ( ) { } protected boolean getConfigureYUIBasePath ( ) { } protected String getDatePattern ( ) { } protected final String getEscapedComponentMarkupId ( ) { } protected final String getIconId ( ) { } protected String getIconStyle ( ) { } protected CharSequence getIconUrl ( ) { } protected Locale getLocale ( ) { } protected void localize ( Map widgetProperties ) { } protected boolean notifyComponentOnDateSelected ( ) { } protected final String [ ] substring ( String [ ] array , int len ) { } protected boolean enableMonthYearSelection ( ) { } protected boolean hideOnSelect ( ) { } protected boolean renderOnLoad ( ) { } protected String getAdditionalJavascript ( ) { } }

Fix:
variables . put ( "additionalJavascript" , Strings . replaceAll ( script , "${calendar}" , ( ( "YAHOO.wicket." + widgetId ) + "DpJs" ) ) ) ;