SLING-2703 : [SlingPostServlet] PathNotFoundException logged when uploading file using slingpostservlet

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/resource@1477722 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
index 370f719..75f78b4 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
@@ -275,7 +275,10 @@
 
                 // continue our stuff with the jcr:content node
                 // which might be nt:resource, which we support below
-                node = node.getNode(JCR_CONTENT);
+                // if the node is new, the content node might not exist yet
+                if ( !node.isNew() || node.hasNode(JCR_CONTENT) ) {
+                    node = node.getNode(JCR_CONTENT);
+                }
             }
 
             // check stuff for nt:resource (or similar) nodes