Index: oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (date 1392734129000) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (date 1392734631000) @@ -250,8 +250,10 @@ * Add a child with the given {@code name}. Does nothing if such a child * already exists. * - * @param name name of the child + * @param name name of the child. A valid name does not start with a colon, + * is not empty and does not contain a forward slash. * @return the {@code Tree} instance of the child with the given {@code name}. + * @throws IllegalArgumentException if {@code name} is not valid. */ @Nonnull Tree addChild(@Nonnull String name); @@ -301,26 +303,32 @@ * Set a property state * * @param property The property state to set + * @throws IllegalArgumentException if {@code property} has a non valid name. A valid name + * does not start with a colon, is not empty and does not contain a forward slash. */ void setProperty(@Nonnull PropertyState property); /** * Set a property state * - * @param name The name of this property + * @param name The name of this property. A valid name does not start with a colon, + * is not empty and does not contain a forward slash. * @param value The value of this property * @param The type of this property. Must be one of {@code String, Blob, byte[], Long, Integer, Double, Boolean, BigDecimal} - * @throws IllegalArgumentException if {@code T} is not one of the above types. + * @throws IllegalArgumentException if {@code T} is not one of the above types or + * if {@code name} is not valid. */ void setProperty(@Nonnull String name, @Nonnull T value); /** * Set a property state * - * @param name The name of this property + * @param name The name of this property. A valid name does not start with a colon, + * is not empty and does not contain a forward slash. * @param value The value of this property * @param type The type of this property. * @param The type of this property. + * @throws IllegalArgumentException if {@code name} is not valid. */ void setProperty(@Nonnull String name, @Nonnull T value, Type type); Index: oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java (date 1392734129000) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java (date 1392734631000) @@ -26,6 +26,7 @@ import static org.apache.jackrabbit.oak.api.Type.NAME; import static org.apache.jackrabbit.oak.commons.PathUtils.elements; import static org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute; +import static org.apache.jackrabbit.oak.spi.state.NodeStateUtils.isHidden; import java.util.Collections; import java.util.Set; @@ -41,10 +42,10 @@ import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.core.AbstractRoot.Move; import org.apache.jackrabbit.oak.plugins.memory.MultiGenericPropertyState; +import org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder; import org.apache.jackrabbit.oak.plugins.tree.AbstractTree; import org.apache.jackrabbit.oak.plugins.tree.TreeConstants; import org.apache.jackrabbit.oak.spi.state.NodeBuilder; -import org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder; class MutableTree extends AbstractTree { @@ -189,6 +190,7 @@ @Override public Tree addChild(String name) { + checkArgument(!isHidden(name)); beforeWrite(); if (!super.hasChild(name)) { nodeBuilder.setChildNode(name); @@ -264,6 +266,7 @@ @Override public void setProperty(PropertyState property) { + checkArgument(!isHidden(property.getName())); beforeWrite(); nodeBuilder.setProperty(property); root.updated(); @@ -271,6 +274,7 @@ @Override public void setProperty(String name, T value) { + checkArgument(!isHidden(name)); beforeWrite(); nodeBuilder.setProperty(name, value); root.updated(); @@ -278,6 +282,7 @@ @Override public void setProperty(String name, T value, Type type) { + checkArgument(!isHidden(name)); beforeWrite(); nodeBuilder.setProperty(name, value, type); root.updated(); Index: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenPropertyTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenPropertyTest.java (date 1392734129000) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenPropertyTest.java (date 1392734631000) @@ -30,12 +30,9 @@ import org.apache.jackrabbit.JcrConstants; import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.api.Tree; -import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.plugins.memory.PropertyBuilder; -import org.apache.jackrabbit.oak.plugins.version.VersionConstants; -import org.apache.jackrabbit.oak.spi.state.MoveDetector; +import org.apache.jackrabbit.oak.plugins.tree.TreeConstants; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -43,16 +40,14 @@ */ public class HiddenPropertyTest extends AbstractOakCoreTest { - private String[] hiddenProps = new String[] {":hiddenProp", MoveDetector.SOURCE_PATH, VersionConstants.HIDDEN_COPY_SOURCE}; + private final String[] hiddenProps = new String[] {TreeConstants.OAK_CHILD_ORDER}; @Override @Before public void before() throws Exception { super.before(); - Tree a = root.getTree("/a"); - a.setProperty(":hiddenProp", "val", STRING); - a.setProperty(MoveDetector.SOURCE_PATH, "/some/path", Type.PATH); - a.setProperty(VersionConstants.HIDDEN_COPY_SOURCE, "abc", STRING); + Tree b = root.getTree("/a/b"); + b.orderBefore("bb"); root.commit(); } @@ -97,7 +92,6 @@ } } - @Ignore("OAK-1424") // FIXME : OAK-1424 @Test public void testCreateHiddenProperty() { Tree a = root.getTree("/a"); @@ -110,7 +104,6 @@ } } - @Ignore("OAK-1424") // FIXME : OAK-1424 @Test public void testCreateHiddenProperty2() { Tree a = root.getTree("/a"); @@ -123,7 +116,6 @@ } } - @Ignore("OAK-1424") // FIXME : OAK-1424 @Test public void testCreateHiddenProperty3() { Tree a = root.getTree("/a"); \ No newline at end of file Index: oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java (date 1392734129000) +++ oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java (date 1392734631000) @@ -16,17 +16,16 @@ */ package org.apache.jackrabbit.oak.security.authorization.evaluation; -import org.apache.jackrabbit.oak.api.Tree; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import org.apache.jackrabbit.oak.api.Tree; +import org.junit.Before; +import org.junit.Test; + /** * Test to make sure hidden trees are never exposed. */ @@ -99,7 +98,6 @@ assertEquals(0, parent.getChildrenCount(1)); } - @Ignore("OAK-1424") // FIXME : OAK-1424 @Test public void testCreateHiddenChild() { try { \ No newline at end of file