Re: [PR] OAK-10462: o.a.j.o.plugins.version.VersionEditor#propertyAdded() may … [jackrabbit-oak]
mbaedke merged PR #1141: URL: https://github.com/apache/jackrabbit-oak/pull/1141 -- 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...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] OAK-10462: o.a.j.o.plugins.version.VersionEditor#propertyAdded() may … [jackrabbit-oak]
mbaedke commented on code in PR #1141: URL: https://github.com/apache/jackrabbit-oak/pull/1141#discussion_r1351745688 ## oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java: ## @@ -108,9 +112,15 @@ public void propertyAdded(PropertyState after) && this.after.hasProperty(JcrConstants.JCR_VERSIONHISTORY) && !this.after.hasProperty(JCR_ISCHECKEDOUT) && !this.before.exists()) { -// sentinel node for restore -vMgr.restore(node, after.getValue(Type.REFERENCE), null); -return; +Tree tree = new TreeProviderService().createReadOnlyTree(this.node.getNodeState()); +if (vMgr.getNodeTypeManager().isNodeType( +TreeUtil.getPrimaryTypeName(tree), TreeUtil.getMixinTypeNames(tree), MIX_VERSIONABLE)) { Review Comment: @rishabhdaim No, that doesn't work, because isVersionable() also checks for the presence of the jcr:isCheckedOut property (indirectly, it uses another version of the NodeTypeManager.isNodeType() method, which uses this shortcut when checking for the presence of mix:versionable. That's ok for "real" nodes, because the property is autocreated and mandatory, but does not work for the sentinel node of the restore operation, which is just used internally and breaks this contract). So if you use isVersionable() here, you will break restore(). -- 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...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] OAK-10462: o.a.j.o.plugins.version.VersionEditor#propertyAdded() may … [jackrabbit-oak]
mbaedke commented on code in PR #1141: URL: https://github.com/apache/jackrabbit-oak/pull/1141#discussion_r1351745688 ## oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java: ## @@ -108,9 +112,15 @@ public void propertyAdded(PropertyState after) && this.after.hasProperty(JcrConstants.JCR_VERSIONHISTORY) && !this.after.hasProperty(JCR_ISCHECKEDOUT) && !this.before.exists()) { -// sentinel node for restore -vMgr.restore(node, after.getValue(Type.REFERENCE), null); -return; +Tree tree = new TreeProviderService().createReadOnlyTree(this.node.getNodeState()); +if (vMgr.getNodeTypeManager().isNodeType( +TreeUtil.getPrimaryTypeName(tree), TreeUtil.getMixinTypeNames(tree), MIX_VERSIONABLE)) { Review Comment: @rishabhdaim No, that doesn't work, because isVersionable() also checks for the presence of the jcr:isCheckedOut property (indirectly, it uses another version of the NodeTypeManager.isNodeType() method, which uses this shortcut when checking for the presence of mix:versionable. That's ok for "real" nodes, because the property is autocreated and mandatory, but does not work for the sentinel node of the restore operation, which is just used internally and breaks this contract). -- 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...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] OAK-10462: o.a.j.o.plugins.version.VersionEditor#propertyAdded() may … [jackrabbit-oak]
mbaedke commented on code in PR #1141: URL: https://github.com/apache/jackrabbit-oak/pull/1141#discussion_r1351745688 ## oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java: ## @@ -108,9 +112,15 @@ public void propertyAdded(PropertyState after) && this.after.hasProperty(JcrConstants.JCR_VERSIONHISTORY) && !this.after.hasProperty(JCR_ISCHECKEDOUT) && !this.before.exists()) { -// sentinel node for restore -vMgr.restore(node, after.getValue(Type.REFERENCE), null); -return; +Tree tree = new TreeProviderService().createReadOnlyTree(this.node.getNodeState()); +if (vMgr.getNodeTypeManager().isNodeType( +TreeUtil.getPrimaryTypeName(tree), TreeUtil.getMixinTypeNames(tree), MIX_VERSIONABLE)) { Review Comment: @rishabhdaim No, that doesn't work, because isVersionable() also checks for the presence of the jcr:isCheckedOut property. -- 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...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] OAK-10462: o.a.j.o.plugins.version.VersionEditor#propertyAdded() may … [jackrabbit-oak]
rishabhdaim commented on code in PR #1141: URL: https://github.com/apache/jackrabbit-oak/pull/1141#discussion_r1351719204 ## oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionEditor.java: ## @@ -108,9 +112,15 @@ public void propertyAdded(PropertyState after) && this.after.hasProperty(JcrConstants.JCR_VERSIONHISTORY) && !this.after.hasProperty(JCR_ISCHECKEDOUT) && !this.before.exists()) { -// sentinel node for restore -vMgr.restore(node, after.getValue(Type.REFERENCE), null); -return; +Tree tree = new TreeProviderService().createReadOnlyTree(this.node.getNodeState()); +if (vMgr.getNodeTypeManager().isNodeType( +TreeUtil.getPrimaryTypeName(tree), TreeUtil.getMixinTypeNames(tree), MIX_VERSIONABLE)) { Review Comment: Shouldn't this be replaced by `isVersionable()`. Both are using the same underlying apis and `isVersionable()` caches the results in `Boolean` as well. -- 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...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org