Buggy code:
public class DatePicker extends AbstractBehavior implements IHeaderContributor { 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 ) { response . renderJavascriptReference ( new JavascriptResourceReference ( YuiLib . class , "yahoo.js" ) ) ; response . renderJavascriptReference ( new JavascriptResourceReference ( YuiLib . class , "event.js" ) ) ; response . renderJavascriptReference ( new JavascriptResourceReference ( YuiLib . class , "dom.js" ) ) ; response . renderJavascriptReference ( new JavascriptResourceReference ( DatePicker . class , "calendar.js" ) ) ; response . renderCSSReference ( new CompressedResourceReference ( DatePicker . class , "assets//calendar.css" ) ) ; String markupId = getCalendarMarkupId ( ) ; String javascriptId = getCalendarJavascriptId ( ) ; String javascriptWidgetId = "YAHOO.wicket." + ( getCalendarJavascriptId ( ) ) ; StringBuffer buffer = new StringBuffer ( ) ; <START_BUG> buffer . append ( "YAHOO.namespace(\"org.apache.wicket\");\nfunction<seq2seq4repair_space>init" ) ; <END_BUG> buffer . append ( javascriptId ) ; buffer . append ( "()<seq2seq4repair_space>{\n" ) ; buffer . append ( "<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( "<seq2seq4repair_space>=<seq2seq4repair_space>new<seq2seq4repair_space>YAHOO.widget.Calendar(\"" ) ; buffer . append ( javascriptId ) ; buffer . append ( "\",\"" ) ; buffer . append ( markupId ) ; Properties p = new Properties ( ) ; configureWidgetProperties ( p ) ; buffer . append ( "\",<seq2seq4repair_space>{<seq2seq4repair_space>" ) ; for ( Iterator i = p . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( i . next ( ) ) ) ; buffer . append ( entry . getKey ( ) ) ; Object value = entry . getValue ( ) ; if ( value instanceof CharSequence ) { buffer . append ( ":\"" ) ; buffer . append ( value ) ; buffer . append ( "\"" ) ; } else if ( value instanceof CharSequence [ ] ) { buffer . append ( ":[" ) ; CharSequence [ ] valueArray = ( ( CharSequence [ ] ) ( value ) ) ; for ( int j = 0 ; j < ( valueArray . length ) ; j ++ ) { CharSequence tmpValue = valueArray [ j ] ; buffer . append ( "\"" ) ; buffer . append ( tmpValue ) ; buffer . append ( "\"" ) ; if ( j < ( ( valueArray . length ) - 1 ) ) { buffer . append ( "," ) ; } } buffer . append ( "]" ) ; } else { buffer . append ( ":" ) ; buffer . append ( value ) ; } if ( i . hasNext ( ) ) { buffer . append ( "," ) ; } } buffer . append ( "<seq2seq4repair_space>});\n" ) ; buffer . append ( "<seq2seq4repair_space>function<seq2seq4repair_space>showCalendar()<seq2seq4repair_space>{\n" ) ; buffer . append ( "var<seq2seq4repair_space>dateValue<seq2seq4repair_space>=<seq2seq4repair_space>YAHOO.util.Dom.get(\"" ) ; buffer . append ( component . getMarkupId ( ) ) ; buffer . append ( "\").value;\n" ) ; buffer . append ( "if<seq2seq4repair_space>(dateValue)<seq2seq4repair_space>{\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>dateArray<seq2seq4repair_space>=<seq2seq4repair_space>dateValue.split(\'//\');\n" ) ; buffer . append ( "<seq2seq4repair_space>if<seq2seq4repair_space>(dateArray[2]<seq2seq4repair_space>!=<seq2seq4repair_space>undefined)<seq2seq4repair_space>{" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>year<seq2seq4repair_space>=<seq2seq4repair_space>dateArray[2];" ) ; buffer . append ( "<seq2seq4repair_space>if<seq2seq4repair_space>(year<seq2seq4repair_space><<seq2seq4repair_space>100)<seq2seq4repair_space>{" ) ; buffer . append ( "<seq2seq4repair_space>if<seq2seq4repair_space>(year<seq2seq4repair_space><<seq2seq4repair_space>50)<seq2seq4repair_space>{" ) ; buffer . append ( "<seq2seq4repair_space>year<seq2seq4repair_space>=<seq2seq4repair_space>year<seq2seq4repair_space>*<seq2seq4repair_space>1<seq2seq4repair_space>+<seq2seq4repair_space>2000;" ) ; buffer . append ( "<seq2seq4repair_space>}<seq2seq4repair_space>else<seq2seq4repair_space>{" ) ; buffer . append ( "<seq2seq4repair_space>year<seq2seq4repair_space>=<seq2seq4repair_space>year<seq2seq4repair_space>*<seq2seq4repair_space>1<seq2seq4repair_space>+<seq2seq4repair_space>1900;" ) ; buffer . append ( "<seq2seq4repair_space>}" ) ; buffer . append ( "<seq2seq4repair_space>dateValue<seq2seq4repair_space>=<seq2seq4repair_space>dateArray[0]<seq2seq4repair_space>+<seq2seq4repair_space>'//'<seq2seq4repair_space>+<seq2seq4repair_space>dateArray[1]<seq2seq4repair_space>+<seq2seq4repair_space>'//'<seq2seq4repair_space>+<seq2seq4repair_space>year;" ) ; buffer . append ( "<seq2seq4repair_space>}" ) ; buffer . append ( "<seq2seq4repair_space>}" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".select(dateValue);\n" ) ; buffer . append ( "var<seq2seq4repair_space>firstDate<seq2seq4repair_space>=<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".getSelectedDates()[0];" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".cfg.setProperty(\"pagedate\",<seq2seq4repair_space>(firstDate.getMonth()+1)<seq2seq4repair_space>+<seq2seq4repair_space>\"//\"<seq2seq4repair_space>+<seq2seq4repair_space>firstDate.getFullYear());" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".render();\n" ) ; buffer . append ( "}\n" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".show();\n" ) ; buffer . append ( "<seq2seq4repair_space>}\n" ) ; buffer . append ( "<seq2seq4repair_space>YAHOO.util.Event.addListener(\"" ) ; String iconId = getIconId ( ) ; buffer . append ( iconId ) ; buffer . append ( "\",<seq2seq4repair_space>\"click\",<seq2seq4repair_space>" ) ; buffer . append ( "showCalendar,<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ",<seq2seq4repair_space>true);\n" ) ; buffer . append ( "<seq2seq4repair_space>function<seq2seq4repair_space>selectHandler(type,<seq2seq4repair_space>args,<seq2seq4repair_space>cal)<seq2seq4repair_space>{\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>selDateArray<seq2seq4repair_space>=<seq2seq4repair_space>args[0][0];\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>yr<seq2seq4repair_space>=<seq2seq4repair_space>selDateArray[0];\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>month<seq2seq4repair_space>=<seq2seq4repair_space>selDateArray[1];\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>dt<seq2seq4repair_space>=<seq2seq4repair_space>selDateArray[2];\n" ) ; buffer . append ( "<seq2seq4repair_space>var<seq2seq4repair_space>val<seq2seq4repair_space>=<seq2seq4repair_space>'" ) ; String datePattern = getDatePattern ( ) ; buffer . append ( datePattern ) ; buffer . append ( "'.replace(//d+//,<seq2seq4repair_space>dt).replace(//M+//,<seq2seq4repair_space>month)" ) ; buffer . append ( ".replace(//y+//,<seq2seq4repair_space>yr);\n<seq2seq4repair_space>YAHOO.util.Dom.get(\"" ) ; buffer . append ( component . getMarkupId ( ) ) ; buffer . append ( "\").value<seq2seq4repair_space>=<seq2seq4repair_space>val;\n" ) ; buffer . append ( "<seq2seq4repair_space>cal.hide();\n<seq2seq4repair_space>}\n" ) ; buffer . append ( "<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".selectEvent.subscribe(selectHandler,<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ");\n" ) ; appendToInit ( markupId , javascriptId , javascriptWidgetId , buffer ) ; buffer . append ( "<seq2seq4repair_space>" ) ; buffer . append ( javascriptWidgetId ) ; buffer . append ( ".render();\n" ) ; buffer . append ( "}\n" ) ; buffer . insert ( 0 , SCRIPT_OPEN_TAG ) ; buffer . append ( SCRIPT_CLOSE_TAG ) ; response . renderString ( buffer ) ; StringBuffer initBuffer = new StringBuffer ( ) ; initBuffer . append ( "init" ) ; initBuffer . append ( javascriptId ) ; initBuffer . append ( "();" ) ; response . renderOnLoadJavascript ( initBuffer . toString ( ) ) ; }

Fix:
buffer . append ( "YAHOO.namespace(\"wicket\");\nfunction<seq2seq4repair_space>init" ) ;