You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2014/02/19 15:43:20 UTC

svn commit: r1569767 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java

Author: jukka
Date: Wed Feb 19 14:43:19 2014
New Revision: 1569767

URL: http://svn.apache.org/r1569767
Log:
OAK-1431: Handling of empty or invalid names

Documen the IllegalArgumentExceptions thrown by Tree methods
as a result of the lower-level NodeState/Builder behaviour

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java?rev=1569767&r1=1569766&r2=1569767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Tree.java Wed Feb 19 14:43:19 2014
@@ -200,8 +200,7 @@ public interface Tree {
      * Get a possibly non existing child of this {@code Tree}.
      * @param name The name of the child to retrieve.
      * @return The child with the given {@code name}.
-     * @throws IllegalArgumentException if the given name string is empty
-     *                                  or contains the forward slash character
+     * @throws IllegalArgumentException if the given name is invalid
      */
     @Nonnull
     Tree getChild(@Nonnull String name) throws IllegalArgumentException;
@@ -254,9 +253,10 @@ public interface Tree {
      *
      * @param name name of the child
      * @return the {@code Tree} instance of the child with the given {@code name}.
+     * @throws IllegalArgumentException if the given name is invalid
      */
     @Nonnull
-    Tree addChild(@Nonnull String name);
+    Tree addChild(@Nonnull String name) throws IllegalArgumentException;
 
     /**
      * Changes the nature of this tree such that the order of the children
@@ -296,6 +296,7 @@ public interface Tree {
      * @return {@code false} if there is no sibling with the given
      *         {@code name} or no reordering was performed;
      *         {@code true} otherwise.
+     * @throws IllegalArgumentException if the given name is invalid
      */
     boolean orderBefore(@Nullable String name);
 
@@ -303,6 +304,7 @@ public interface Tree {
      * Set a property state
      *
      * @param property The property state to set
+     * @throws IllegalArgumentException if the property name is invalid
      */
     void setProperty(@Nonnull PropertyState property);
 
@@ -312,9 +314,11 @@ public interface Tree {
      * @param name  The name of this property
      * @param value The value of this property
      * @param <T>   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 the given name is invalid
      */
-    <T> void setProperty(@Nonnull String name, @Nonnull T value);
+    <T> void setProperty(@Nonnull String name, @Nonnull T value)
+            throws IllegalArgumentException;
 
     /**
      * Set a property state
@@ -323,8 +327,10 @@ public interface Tree {
      * @param value The value of this property
      * @param type  The type of this property.
      * @param <T>   The type of this property.
+     * @throws IllegalArgumentException if the given name is invalid
      */
-    <T> void setProperty(@Nonnull String name, @Nonnull T value, Type<T> type);
+    <T> void setProperty(@Nonnull String name, @Nonnull T value, Type<T> type)
+            throws IllegalArgumentException;
 
     /**
      * Remove the property with the given name. This method has no effect if a