Buggy code:
public class RequestCycle implements IEventSink , IRequestCycle { private static final Logger log = LoggerFactory . getLogger ( RequestCycle . class ) ; private boolean cleanupFeedbackMessagesOnDetach = true ; private interface IExecutor < T > { void execute ( T object ) { } } public static RequestCycle get ( ) { } private static void set ( RequestCycle requestCycle ) { } private Request request ; private final Response originalResponse ; private final IRequestMapper requestMapper ; private final IExceptionMapper exceptionMapper ; private final RequestCycleListenerCollection listeners = new RequestCycleListenerCollection ( ) ; private UrlRenderer urlRenderer ; private MetaDataEntry < ? > [ ] metaData ; private final long startTime = System . currentTimeMillis ( ) ; private RequestHandlerStack requestHandlerExecutor ; private Response activeResponse ; public RequestCycle ( RequestCycleContext context ) { } protected UrlRenderer newUrlRenderer ( ) { } public Response getOriginalResponse ( ) { } public final UrlRenderer getUrlRenderer ( ) { } protected IRequestHandler resolveRequestHandler ( ) { } protected int getExceptionRetryCount ( ) { } public boolean processRequest ( ) { } public boolean processRequestAndDetach ( ) { } private void executeExceptionRequestHandler ( final IRequestHandler handler , final int retryCount ) { } protected IRequestHandler handleException ( final Exception e ) { } public Request getRequest ( ) { } public void setRequest ( Request request ) { } public final < T > void setMetaData ( final MetaDataKey < T > key , final T object ) { } public final < T > T getMetaData ( final MetaDataKey < T > key ) { } public Url mapUrlFor ( IRequestHandler handler ) { } public Url mapUrlFor ( ResourceReference reference , PageParameters params ) { } public final < C extends Page > Url mapUrlFor ( final Class < C > pageClass , final PageParameters parameters ) { } public final CharSequence urlFor ( ResourceReference reference , PageParameters params ) { } public final < C extends Page > CharSequence urlFor ( final Class < C > pageClass , final PageParameters parameters ) { } public CharSequence urlFor ( IRequestHandler handler ) { } private String renderUrl ( Url url ) { if ( url != null ) { <START_BUG> return getResponse ( ) . encodeURL ( getUrlRenderer ( ) . renderUrl ( url ) ) ; <END_BUG> } else { return null ; } } public final void detach ( ) { } private void onInternalDetach ( ) { } public void onDetach ( ) { } public void setResponsePage ( IRequestablePage page ) { } public void setResponsePage ( Class < ? extends IRequestablePage > pageClass ) { } public void setResponsePage ( Class < ? extends IRequestablePage > pageClass , PageParameters parameters ) { } public boolean isCleanupFeedbackMessagesOnDetach ( ) { } public void setCleanupFeedbackMessagesOnDetach ( boolean cleanupFeedbackMessagesOnDetach ) { } public final long getStartTime ( ) { } public void onEvent ( IEvent < ? > event ) { } protected void onBeginRequest ( ) { } protected void onEndRequest ( ) { } public RequestCycleListenerCollection getListeners ( ) { } public Response getResponse ( ) { } public Response setResponse ( final Response response ) { } public void scheduleRequestHandlerAfterCurrent ( IRequestHandler handler ) { } public IRequestHandler getActiveRequestHandler ( ) { } public IRequestHandler getRequestHandlerScheduledAfterCurrent ( ) { } public void replaceAllRequestHandlers ( final IRequestHandler handler ) { } private class HandlerExecutor extends RequestHandlerStack { @ Override protected void respond ( IRequestHandler handler ) { } @ Override protected void detach ( IRequestHandler handler ) { } } }

Fix:
return getOriginalResponse ( ) . encodeURL ( getUrlRenderer ( ) . renderUrl ( url ) ) ;