jsedding commented on code in PR #53:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/53#discussion_r1611596184


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/NodePropertiesVisitor.java:
##########
@@ -118,42 +116,25 @@ public NodePropertiesVisitor(Session s) {
      * is the same as the autocreated default value
      *
      * @param n the node to check
-     * @param pRelPath the property relative path to check
+     * @param propertyPath the property relative path to check
      * @return true or false
      */
-    protected static boolean isUnchangedAutocreatedProperty(Node n, final 
String pRelPath)
+    protected static boolean isUnchangedAutocreatedProperty(Node n, final 
String propertyPath)
             throws RepositoryException {
-        boolean sameAsDefault = false;
-
-        // deal with the pRelPath nesting
-        Path path = Paths.get(pRelPath);
-        Path parentPath = path.getParent();
-        String name = path.getFileName().toString();
-        if (parentPath != null) {
-            String relPath = parentPath.toString();
-            if (n.hasNode(relPath)) {
-                n = n.getNode(relPath);
-            } else {
-                n = null;
-            }
-        }
-
-        //  if the property has been set by being autocreated and the value is 
still
-        //  the same as the default values then also allow changing the value
-        if (n != null && n.hasProperty(name)) {
-            @Nullable
-            PropertyDefinition pd = resolvePropertyDefinition(name, n);
+        if (n.hasProperty(propertyPath)) {

Review Comment:
   exactly. it also handles trailing slashes. so most of the code in this 
method was re-implementing functionality that is already present in JCR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to