private Resource getResourceInternal()

in src/main/java/org/apache/sling/testing/resourceresolver/MockResourceResolver.java [175:206]


    private Resource getResourceInternal(final String path) {
        if (path == null) {
            return null;
        }

        String normalizedPath = ResourceUtil.normalize(path);
        if (normalizedPath == null) {
            return null;
        } else if ( normalizedPath.startsWith("/") ) {
            if ( this.deletedResources.contains(normalizedPath) ) {
                return null;
            }
            final Map<String, Object> tempProps = this.temporaryResources.get(normalizedPath);
            if ( tempProps != null ) {
                return newMockResource(normalizedPath, tempProps, this);
            }
            synchronized ( this.resources ) {
                final Map<String, Object> props = this.resources.get(normalizedPath);
                if ( props != null ) {
                    return newMockResource(normalizedPath, props, this);
                }
            }
        } else {
            for(final String s : this.getSearchPath() ) {
                final Resource rsrc = this.getResource(s + '/' + normalizedPath);
                if ( rsrc != null ) {
                    return rsrc;
                }
            }
        }
        return null;
    }