Buggy code:
public class Localizer { private static final Logger logger = LoggerFactory . getLogger ( Localizer . class ) ; private static final String NULL_VALUE = "<null-value>" ; private Map < String , String > cache = newCache ( ) ; public Localizer ( ) { } public final void clearCache ( ) { } public String getString ( final String key , final Component < ? > component ) throws MissingResourceException { } public String getString ( final String key , final Component < ? > component , final IModel < ? > model ) throws MissingResourceException { } public String getString ( final String key , final Component < ? > component , final String defaultValue ) throws MissingResourceException { } public String getString ( final String key , final Component < ? > component , final IModel < ? > model , final Locale locale , final String style , final String defaultValue ) throws MissingResourceException { } public String getString ( final String key , final Component < ? > component , final IModel < ? > model , final String defaultValue ) throws MissingResourceException { final IResourceSettings resourceSettings = Application . get ( ) . getResourceSettings ( ) ; boolean addedToPage = false ; if ( component != null ) { if ( ( component instanceof Page ) || ( null != ( component . findParent ( Page . class ) ) ) ) { addedToPage = true ; } if ( ! addedToPage ) { Localizer . logger . warn ( ( "Tried<seq2seq4repair_space>to<seq2seq4repair_space>retrieve<seq2seq4repair_space>a<seq2seq4repair_space>localized<seq2seq4repair_space>string<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>component<seq2seq4repair_space>that<seq2seq4repair_space>has<seq2seq4repair_space>not<seq2seq4repair_space>yet<seq2seq4repair_space>been<seq2seq4repair_space>added<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>page.<seq2seq4repair_space>" + ( ( "This<seq2seq4repair_space>can<seq2seq4repair_space>sometimes<seq2seq4repair_space>lead<seq2seq4repair_space>to<seq2seq4repair_space>an<seq2seq4repair_space>invalid<seq2seq4repair_space>or<seq2seq4repair_space>no<seq2seq4repair_space>localized<seq2seq4repair_space>resource<seq2seq4repair_space>returned.<seq2seq4repair_space>" + "Make<seq2seq4repair_space>sure<seq2seq4repair_space>you<seq2seq4repair_space>are<seq2seq4repair_space>not<seq2seq4repair_space>calling<seq2seq4repair_space>Component#getString()<seq2seq4repair_space>inside<seq2seq4repair_space>your<seq2seq4repair_space>Component's<seq2seq4repair_space>constructor.<seq2seq4repair_space>" ) + "Offending<seq2seq4repair_space>component:<seq2seq4repair_space>{}" ) ) , component ) ; } } String cacheKey = null ; String string = null ; if ( ( ( cache ) != null ) && addedToPage ) { cacheKey = getCacheKey ( key , component ) ; } <START_BUG> if ( cacheKey != null ) { <END_BUG> string = getFromCache ( cacheKey ) ; } else { Iterator < IStringResourceLoader > iter = resourceSettings . getStringResourceLoaders ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { IStringResourceLoader loader = iter . next ( ) ; string = loader . loadStringResource ( component , key ) ; if ( string != null ) { break ; } } if ( cacheKey != null ) { putIntoCache ( cacheKey , string ) ; } } if ( ( string == null ) && ( defaultValue != null ) ) { if ( resourceSettings . getUseDefaultOnMissingResource ( ) ) { string = defaultValue ; } } if ( string != null ) { return substitutePropertyExpressions ( component , string , model ) ; } if ( resourceSettings . getThrowExceptionOnMissingResource ( ) ) { AppendingStringBuffer message = new AppendingStringBuffer ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>resource:<seq2seq4repair_space>" + key ) ) ; if ( component != null ) { message . append ( "<seq2seq4repair_space>for<seq2seq4repair_space>component:<seq2seq4repair_space>" ) ; message . append ( component . getPageRelativePath ( ) ) ; message . append ( "<seq2seq4repair_space>[class=" ) . append ( component . getClass ( ) . getName ( ) ) . append ( "]" ) ; } throw new MissingResourceException ( message . toString ( ) , ( component != null ? component . getClass ( ) . getName ( ) : "" ) , key ) ; } return ( "[Warning:<seq2seq4repair_space>String<seq2seq4repair_space>resource<seq2seq4repair_space>for<seq2seq4repair_space>'" + key ) + "'<seq2seq4repair_space>not<seq2seq4repair_space>found]" ; } protected void putIntoCache ( final String cacheKey , final String string ) { } protected String getFromCache ( final String cacheKey ) { } protected String getCacheKey ( final String key , final Component < ? > component ) { } public String substitutePropertyExpressions ( final Component < ? > component , final String string , final IModel < ? > model ) { } public final void setEnableCache ( boolean value ) { } protected Map < String , String > newCache ( ) { } }

Fix:
if ( ( cacheKey != null ) && ( cache . containsKey ( cacheKey ) ) ) {