/*
 *
 *  Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 *  This program and the accompanying materials are made available under the
 *  terms of the Eclipse Public License v1.0 which accompanies this distribution,
 *  and is available at http://www.eclipse.org/legal/epl-v10.html
 *
 */

package org.opendaylight.controller.cluster.datastore.node.utils;

public class PathUtils {
    public static String getParentPath(String currentElementPath){
        String parentPath = "";

        if(currentElementPath != null){
            String[] parentPaths = currentElementPath.split("/");
            if(parentPaths.length > 2){
                for(int i=0;i<parentPaths.length-1;i++){
                    if(parentPaths[i].length() > 0){
                        parentPath += "/" + parentPaths[i];
                    }
                }
            }
        }
        return parentPath;
    }
}

@@ -485,16 +485,23 @@
   String
+Builder
  parentP
@@ -510,10 +510,27 @@
 h = 
-%22%22
+new StringBuilder()
 ;%0A%0A 
@@ -822,18 +822,64 @@
 Path
- += %22/%22 + 
+.append(%22/%22);%0A                        parentPath.append(
 pare
@@ -888,16 +888,17 @@
 Paths%5Bi%5D
+)
 ;%0A      
@@ -980,16 +980,27 @@
 rentPath
+.toString()
 ;%0A    %7D%0A

Fix usage of StringBuilder when getting parent path in PathUtils Making constants final timing encode/decode in a test case