Buggy code:
public class DatePicker extends AbstractBehavior { private static Method GETINSTANCEMETHOD = null ; private static final class UnableToDetermineFormatException extends WicketRuntimeException { private static final long serialVersionUID = 1L ; public UnableToDetermineFormatException ( ) { } } public static String FORMAT_DATE = "MM//dd//yyyy" ; public static String FORMAT_PAGEDATE = "MM//yyyy" ; private static final ResourceReference YUI = new JavascriptResourceReference ( YuiLib . class , "" ) ; private static final ResourceReference WICKET_DATE = new JavascriptResourceReference ( DatePicker . class , "wicket-date.js" ) ; private static final long serialVersionUID = 1L ; private Component component ; private boolean showOnFieldClick = false ; public DatePicker ( ) { } @ Override public void bind ( Component component ) { } @ Override public void onRendered ( Component component ) { } protected boolean includeYUILibraries ( ) { } @ Override public void renderHead ( IHeaderResponse response ) { if ( includeYUILibraries ( ) ) { YuiLib . load ( response ) ; } Map < String , Object > variables = new HashMap < String , Object > ( ) ; String widgetId = getEscapedComponentMarkupId ( ) ; variables . put ( "componentId" , getComponentMarkupId ( ) ) ; variables . put ( "widgetId" , widgetId ) ; variables . put ( "datePattern" , getDatePattern ( ) ) ; variables . put ( "fireChangeEvent" , notifyComponentOnDateSelected ( ) ) ; variables . put ( "alignWithIcon" , alignWithIcon ( ) ) ; variables . put ( "hideOnSelect" , hideOnSelect ( ) ) ; variables . put ( "showOnFieldClick" , showOnFieldClick ( ) ) ; <START_BUG> variables . put ( "basePath" , Strings . stripJSessionId ( ( ( RequestCycle . get ( ) . urlFor ( DatePicker . YUI , null ) . toString ( ) ) + "//" ) ) ) ; <END_BUG> variables . put ( "wicketDatePath" , RequestCycle . get ( ) . urlFor ( DatePicker . WICKET_DATE , null ) ) ; if ( DEVELOPMENT . equals ( Application . get ( ) . getConfigurationType ( ) ) ) { variables . put ( "filter" , "filter:<seq2seq4repair_space>\"RAW\"," ) ; variables . put ( "allowRollup" , false ) ; } else { variables . put ( "filter" , "" ) ; variables . put ( "allowRollup" , true ) ; } String script = getAdditionalJavascript ( ) ; if ( script != null ) { variables . put ( "additionalJavascript" , Strings . replaceAll ( script , "${calendar}" , ( ( "YAHOO.wicket." + widgetId ) + "DpJs" ) ) ) ; } Map < String , Object > p = new HashMap < String , Object > ( ) ; configure ( p ) ; if ( ( ! ( p . containsKey ( "navigator" ) ) ) && ( enableMonthYearSelection ( ) ) ) { p . put ( "navigator" , Boolean . TRUE ) ; } 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 < Map . Entry < String , Object > > i = p . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry < String , Object > 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 if ( value instanceof Map ) { calendarInit . append ( ":" ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Object > map = ( ( Map < String , Object > ) ( value ) ) ; appendMapping ( map , calendarInit ) ; } 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 ( ) ) ; if ( ( AjaxRequestTarget . get ( ) ) != null ) { final String escapedComponentMarkupId = getEscapedComponentMarkupId ( ) ; final String javascript = ( ( ( ( ( ( ( ( ( "var<seq2seq4repair_space>e<seq2seq4repair_space>=<seq2seq4repair_space>Wicket.$('" + escapedComponentMarkupId ) + "Dp" ) + "');<seq2seq4repair_space>if<seq2seq4repair_space>(e<seq2seq4repair_space>!=<seq2seq4repair_space>null<seq2seq4repair_space>&&<seq2seq4repair_space>typeof(e.parentNode)<seq2seq4repair_space>!=<seq2seq4repair_space>'undefined'<seq2seq4repair_space>&&<seq2seq4repair_space>" ) + "typeof(e.parentNode.parentNode<seq2seq4repair_space>!=<seq2seq4repair_space>'undefined'))<seq2seq4repair_space>" ) + "e.parentNode.parentNode.removeChild(e.parentNode);" ) + "YAHOO.wicket." ) + escapedComponentMarkupId ) + "DpJs.destroy();<seq2seq4repair_space>delete<seq2seq4repair_space>YAHOO.wicket." ) + escapedComponentMarkupId ) + "DpJs;" ; response . renderJavascript ( javascript , null ) ; } } private final void checkComponentProvidesDateFormat ( Component component ) { }

Fix:
variables . put ( "basePath" , ( ( Strings . stripJSessionId ( RequestCycle . get ( ) . urlFor ( DatePicker . YUI , null ) . toString ( ) ) ) + "//" ) ) ;