Buggy code:
public class ResourceFactoryImpl implements ResourceFactory { private static class ExternalStaticResourceFactory { private ResourceKey resourceKey ; private String resourceLocation ; private boolean skinDependent ; public ExternalStaticResourceFactory ( ResourceKey resourceKey , String resourceLocation , boolean skinDependent ) { } public Resource createResource ( ) { } } private static class MappedResourceData { private ResourceKey resourceKey ; private Map < String , String > params ; public MappedResourceData ( ResourceKey resourceKey , Map < String , String > params ) { } public ResourceKey getResourceKey ( ) { } public Map < String , String > getParams ( ) { } } private static final Logger LOGGER = RESOURCE . getLogger ( ) ; private static final Function < Map . Entry < String , String > , ResourceFactoryImpl . ExternalStaticResourceFactory > EXTERNAL_MAPPINGS_FACTORY_PRODUCER = new Function < Map . Entry < String , String > , ResourceFactoryImpl . ExternalStaticResourceFactory > ( ) { public ResourceFactoryImpl . ExternalStaticResourceFactory apply ( Map . Entry < String , String > entry ) { } } ; private static final Function < Map . Entry < String , String > , ResourceFactoryImpl . MappedResourceData > DYNAMIC_MAPPINGS_DATA_PRODUCER = new Function < Map . Entry < String , String > , ResourceFactoryImpl . MappedResourceData > ( ) { public ResourceFactoryImpl . MappedResourceData apply ( Map . Entry < String , String > from ) { } } ; private ResourceHandler defaultHandler ; private Map < ResourceKey , ResourceFactoryImpl . ExternalStaticResourceFactory > externalStaticResourceFactories ; private Map < ResourceKey , ResourceFactoryImpl . MappedResourceData > mappedResourceDataMap ; public ResourceFactoryImpl ( ResourceHandler defaultHandler ) { } private static String extractParametersFromResourceName ( String resourceName ) { } private void logResourceProblem ( FacesContext context , Throwable throwable , String messagePattern , Object ... arguments ) { } private void logMissingResource ( FacesContext context , String resourceData ) { } private < V > Map < ResourceKey , V > readMappings ( Function < Map . Entry < String , String > , V > producer , String mappingFileName ) { } private Resource createCompiledCSSResource ( ResourceKey resourceKey ) { } protected void injectProperties ( Object resource , Map < String , String > parameters ) { } private boolean isCacheableSet ( Class < ? > c ) { } private boolean isVersionedSet ( Class < ? > c ) { } private Resource createDynamicUserResourceInstance ( Class < ? > loadedClass ) throws Exception , LinkageError { } private Resource createDynamicResourceInstance ( Class < ? > loadedClass ) throws Exception , LinkageError { } protected Resource createHandlerDependentResource ( ResourceKey resourceKey , Map < String , String > parameters ) { } private boolean checkResourceMarker ( String resourceName ) { } public Resource createResource ( FacesContext context , ResourceRequestData resourceData ) { } public Resource createResource ( String resourceName , String libraryName , String contentType ) { } private void addResourcesToContextMap ( ResourceFactoryImpl . ExternalStaticResourceFactory externalStaticResourceFactory ) { } protected Resource createDynamicResource ( ResourceKey resourceKey , boolean useDependencyInjection ) { Resource result = null ; Map < String , String > params = null ; ResourceFactoryImpl . MappedResourceData mappedResourceData = mappedResourceDataMap . get ( resourceKey ) ; ResourceKey actualKey ; if ( mappedResourceData != null ) { actualKey = mappedResourceData . getResourceKey ( ) ; if ( useDependencyInjection ) { params = mappedResourceData . getParams ( ) ; } } else { actualKey = resourceKey ; if ( useDependencyInjection ) { params = Collections . < String , String > emptyMap ( ) ; } } if ( Strings . isNullOrEmpty ( resourceKey . getResourceName ( ) ) ) { return null ; } if ( actualKey . getResourceName ( ) . endsWith ( ".ecss" ) ) { result = createCompiledCSSResource ( actualKey ) ; } else { result = createHandlerDependentResource ( actualKey , params ) ; } if ( result != null ) { result . setLibraryName ( resourceKey . getLibraryName ( ) ) ; result . setResourceName ( resourceKey . getResourceName ( ) ) ; } else <START_BUG> if ( mappedResourceData == null ) { <END_BUG> result = defaultHandler . createResource ( actualKey . getResourceName ( ) , actualKey . getLibraryName ( ) ) ; } return result ; } public Collection < ResourceKey > getMappedDynamicResourceKeys ( ) { } protected Resource createResource ( Java2DUserResource resource ) { } protected Resource createResource ( UserResource resource ) { } private class ExternalStaticResourceFactories extends LazyLoadingObject < Map < ResourceKey , ResourceFactoryImpl . ExternalStaticResourceFactory > > { public ExternalStaticResourceFactories ( ) { } @ Override protected Map < ResourceKey , ResourceFactoryImpl . ExternalStaticResourceFactory > loadData ( ) { } } }

Fix:
if ( mappedResourceData != null ) {