Buggy code:
public final class LocalizedImageResource implements IClusterable { private static final long serialVersionUID = 1L ; private Boolean resourceKind ; private final Component component ; private IResource resource ; private ResourceReference resourceReference ; private PageParameters resourceParameters ; private Locale locale ; private String style ; private String variation ; private static final class ImageValueParser extends MetaPatternParser { private static final Group factoryName = new Group ( MetaPattern . VARIABLE_NAME ) ; private static final Group imageReferenceName = new Group ( MetaPattern . VARIABLE_NAME ) ; private static final Group specification = new Group ( MetaPattern . ANYTHING_NON_EMPTY ) ; private static final MetaPattern pattern = new MetaPattern ( new MetaPattern [ ] { LocalizedImageResource . ImageValueParser . factoryName , MetaPattern . COLON , new org . apache . wicket . util . parse . metapattern . OptionalMetaPattern ( new MetaPattern [ ] { LocalizedImageResource . ImageValueParser . imageReferenceName } ) , MetaPattern . COLON , LocalizedImageResource . ImageValueParser . specification } ) ; private ImageValueParser ( final CharSequence input ) { } private String getFactoryName ( ) { } private String getImageReferenceName ( ) { } private String getSpecification ( ) { } } public LocalizedImageResource ( final Component component ) { } public final void bind ( ) { } public final void onResourceRequested ( PageParameters parameters ) { } public final void setResource ( final IResource resource ) { } public final void setResourceReference ( final ResourceReference resourceReference ) { } public final boolean isStateless ( ) { } public final void setResourceReference ( final ResourceReference resourceReference , final PageParameters resourceParameters ) { } public final void setSrcAttribute ( final ComponentTag tag ) { Locale l = component . getLocale ( ) ; String s = component . getStyle ( ) ; String v = component . getVariation ( ) ; if ( ( ( resourceKind ) == null ) && ( ( ( ! ( Objects . equal ( locale , l ) ) ) || ( ! ( Objects . equal ( style , s ) ) ) ) || ( ! ( Objects . equal ( variation , v ) ) ) ) ) { locale = l ; style = s ; variation = v ; resourceReference = null ; resource = null ; } else { } Object modelObject = component . getDefaultModelObject ( ) ; if ( modelObject instanceof ResourceReference ) { resourceReference = ( ( ResourceReference ) ( modelObject ) ) ; } else if ( modelObject instanceof IResource ) { resource = ( ( IResource ) ( modelObject ) ) ; } if ( ( ( resource ) == null ) && ( ( resourceReference ) == null ) ) { final CharSequence src = tag . getString ( "src" ) ; if ( src != null ) { loadStaticImage ( src . toString ( ) ) ; } else { final CharSequence value = tag . getString ( "value" ) ; if ( value != null ) { newImage ( value ) ; } else { loadStaticImage ( component . getDefaultModelObjectAsString ( ) ) ; } } } final CharSequence url ; if ( ( resourceReference ) != null ) { IRequestHandler handler = new org . apache . wicket . request . handler . resource . ResourceReferenceRequestHandler ( resourceReference , resourceParameters ) ; <START_BUG> url = RequestCycle . get ( ) . renderUrlFor ( handler ) ; <END_BUG> } else { url = component . urlFor ( INTERFACE ) ; } tag . put ( "src" , RequestCycle . get ( ) . getOriginalResponse ( ) . encodeURL ( Strings . replaceAll ( url , "&" , "&amp;" ) ) ) ; } private IResourceFactory getResourceFactory ( final Application application , final String factoryName ) { } static class SimpleStaticResourceReference extends ResourceReference { final IResource resource ; public SimpleStaticResourceReference ( Class < ? > scope , String name , Locale locale , String style , String variation , IResource resource ) { } private static final long serialVersionUID = 1L ; @ Override public IResource getResource ( ) { } } @ SuppressWarnings ( "unchecked" ) private void loadStaticImage ( final String path ) { } private void newImage ( final CharSequence value ) { } public final IResource getResource ( ) { } public final ResourceReference getResourceReference ( ) { } }

Fix:
url = RequestCycle . get ( ) . urlFor ( handler ) ;