SLING-8761 review changes to squash
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java
index 2bd4282..376d7b5 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResource.java
@@ -28,16 +28,12 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.ValueFormatException;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.sling.api.resource.AbstractResource;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.jcr.resource.api.JcrResourceConstants;
-import org.jetbrains.annotations.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -139,21 +135,6 @@
         return result;
     }
 
-    /**
-     * @return Parent node or null if not existing or root
-     */
-    public @Nullable Node getParentNode() {
-        String parentPath = ResourceUtil.getParent(getPath());
-        if (StringUtils.isNotBlank(parentPath)) {
-            try {
-                return (Node)((JackrabbitSession)item.getSession()).getItemOrNull(parentPath);
-            } catch (RepositoryException e) {
-                LOGGER.error("Unable to fetch {}", parentPath);
-            }
-        }
-        return null;
-    }
-
     public static long getContentLength(final Property property) throws RepositoryException {
         if (property.isMultiple()) {
             return -1;
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
index 64425da..ae4ccaf 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
@@ -30,10 +30,8 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.commons.lang3.StringUtils;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.NotNull;
-import javax.jcr.AccessDeniedException;
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -358,12 +356,17 @@
                     version = child.getResourceMetadata().getParameterMap().get("v");
                 }
                 if (version == null) {
-                    Node parentNode = ((JcrItemResource)child).getParentNode();
-                    if (parentNode == null) {
-                        return null;
+                    String parentPath = ResourceUtil.getParent(child.getPath());
+                    if (parentPath != null) {
+                        Node parentNode = (Node) ctx.getProviderState().getResourceFactory()
+                            .getItemOrNull(parentPath);
+                        if (parentNode != null) {
+                            return new JcrNodeResource(ctx.getResourceResolver(),
+                                parentNode.getPath(), null, parentNode,
+                                ctx.getProviderState().getHelperData());
+                        }
                     }
-                    return new JcrNodeResource(ctx.getResourceResolver(), parentNode.getPath(), null, parentNode,
-                            ctx.getProviderState().getHelperData());
+                    return null;
                 }
             } catch (RepositoryException e) {
                 logger.warn("Can't get parent for {}", child, e);