jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <mreut...@adobe.com>
Subject RE: svn commit: r1458234 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/ oak-core/src/main/java/o
Date Tue, 19 Mar 2013 14:00:42 GMT
Hi,

I'd rather avoid casting to an implementation specific class, even if it is
conditional. This may introduce implementation dependent behavior,
which makes debugging more difficult.

If it is for performance reasons, we should look into finding another solution
because the SegmentMK doesn't have KernelNodeStates!

Regards
 Marcel

> --- jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
> (original)
> +++ jackrabbit/oak/trunk/oak-
> core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
> Tue Mar 19 11:48:36 2013
> @@ -26,6 +26,7 @@ import org.apache.jackrabbit.oak.api.Pro
>  import org.apache.jackrabbit.oak.api.Root;
>  import org.apache.jackrabbit.oak.api.Tree;
>  import org.apache.jackrabbit.oak.commons.PathUtils;
> +import org.apache.jackrabbit.oak.kernel.KernelNodeState;
>  import org.apache.jackrabbit.oak.plugins.version.VersionConstants;
>  import org.apache.jackrabbit.oak.spi.security.Context;
>  import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
> @@ -91,9 +92,14 @@ public final class ImmutableTree extends
>              return "/";
>          }
> 
> -        StringBuilder sb = new StringBuilder();
> -        buildPath(sb);
> -        return sb.toString();
> +        NodeState nodeState = getNodeState();
> +        if (nodeState instanceof KernelNodeState) {
> +            return ((KernelNodeState) nodeState).getPath();
> +        } else {
> +            StringBuilder sb = new StringBuilder();
> +            buildPath(sb);
> +            return sb.toString();
> +        }
>      }
> 
>      private void buildPath(StringBuilder sb) {
> 
Mime
View raw message