parses and expands the children section in a single User Agent block

@param string $ua
@param array  $uaDataChild
@param bool   $lite
@param bool   $standard

@throws \OutOfBoundsException
@throws \UnexpectedValueException

@return \Generator
971698
private function parseChildren(string $ua, array $uaDataChild, bool $lite = true, bool $standard = true) : \Generator
    {
        if (isset($uaDataChild['platforms']) && is_array($uaDataChild['platforms'])) {
            foreach ($uaDataChild['platforms'] as $platform) {
                $this->patternId['platform'] = $platform;
                $properties                  = ['Parent' => $ua, 'lite' => $lite, 'standard' => $standard];
                $platformProperties          = $this->collection->getPlatform($platform);

                if (!$platformProperties->isLite()) {
                    $properties['lite'] = false;
                }

                if (!$platformProperties->isStandard()) {
                    $properties['standard'] = false;
                }

                $uaBase = str_replace('#PLATFORM#', $platformProperties->getMatch(), $uaDataChild['match']);

                if (array_key_exists('engine', $uaDataChild)) {
                    $engine           = $this->collection->getEngine($uaDataChild['engine']);
                    $engineProperties = $engine->getProperties();
                } else {
                    $engineProperties = [];
                }

                if (array_key_exists('device', $uaDataChild)) {
                    $device           = $this->collection->getDevice($uaDataChild['device']);
                    $deviceProperties = $device->getProperties();

                    if (!$device->isStandard()) {
                        $properties['standard'] = false;
                    }

                    $deviceTypeLoader = new DeviceTypeLoader();

                    try {
                        $deviceType = $deviceTypeLoader->load($device->getType());

                        $deviceProperties['isMobileDevice'] = $deviceType->isMobile();
                        $deviceProperties['isTablet']       = $deviceType->isTablet();
                        $deviceProperties['Device_Type']    = ($deviceType->getName() ?? 'unknown');
                    } catch (NotFoundException $e) {
                        $this->logger->critical($e);

                        $deviceProperties['isMobileDevice'] = false;
                        $deviceProperties['isTablet']       = false;
                        $deviceProperties['Device_Type']    = 'unknown';
                    }
                } else {
                    $deviceProperties = [];
                }

                if (array_key_exists('browser', $uaDataChild)) {
                    $browser           = $this->collection->getBrowser($uaDataChild['browser']);
                    $browserProperties = $browser->getProperties();

                    if (!$browser->isStandard()) {
                        $properties['standard'] = false;
                    }

                    if (!$browser->isLite()) {
                        $properties['lite'] = false;
                    }

                    $browserTypeLoader = new BrowserTypeLoader();

                    try {
                        $browserType = $browserTypeLoader->load($browser->getType());

                        $browserProperties['isSyndicationReader'] = $browserType->isSyndicationReader();
                        $browserProperties['Crawler']             = $browserType->isBot();
                        $browserProperties['Browser_Type']        = ($browserType->getName() ?? 'unknown');
                    } catch (NotFoundException $e) {
                        $this->logger->critical($e);

                        $browserProperties['isSyndicationReader'] = false;
                        $browserProperties['Crawler']             = false;
                        $browserProperties['Browser_Type']        = 'unknown';
                    }
                } else {
                    $browserProperties = [];
                }

                $properties = array_merge(
                    $properties,
                    $engineProperties,
                    $deviceProperties,
                    $browserProperties,
                    $platformProperties->getProperties()
                );

                if (isset($uaDataChild['properties'])
                    && is_array($uaDataChild['properties'])
                ) {
                    $childProperties = $uaDataChild['properties'];

                    $properties = array_merge($properties, $childProperties);
                }

                $properties['PatternId'] = $this->getPatternId();

                yield $uaBase => $properties;
            }
        } else {
            $properties = ['Parent' => $ua, 'lite' => $lite, 'standard' => $standard];

            if (array_key_exists('engine', $uaDataChild)) {
                $engine           = $this->collection->getEngine($uaDataChild['engine']);
                $engineProperties = $engine->getProperties();
            } else {
                $engineProperties = [];
            }

            if (array_key_exists('device', $uaDataChild)) {
                $device           = $this->collection->getDevice($uaDataChild['device']);
                $deviceProperties = $device->getProperties();

                if (!$device->isStandard()) {
                    $properties['standard'] = false;
                }

                $deviceTypeLoader = new DeviceTypeLoader();

                try {
                    $deviceType = $deviceTypeLoader->load($device->getType());

                    $deviceProperties['isMobileDevice'] = $deviceType->isMobile();
                    $deviceProperties['isTablet']       = $deviceType->isTablet();
                    $deviceProperties['Device_Type']    = ($deviceType->getName() ?? 'unknown');
                } catch (NotFoundException $e) {
                    $this->logger->critical($e);

                    $deviceProperties['isMobileDevice'] = false;
                    $deviceProperties['isTablet']       = false;
                    $deviceProperties['Device_Type']    = 'unknown';
                }
            } else {
                $deviceProperties = [];
            }

            if (array_key_exists('browser', $uaDataChild)) {
                $browser           = $this->collection->getBrowser($uaDataChild['browser']);
                $browserProperties = $browser->getProperties();

                if (!$browser->isStandard()) {
                    $properties['standard'] = false;
                }

                if (!$browser->isLite()) {
                    $properties['lite'] = false;
                }

                $browserTypeLoader = new BrowserTypeLoader();

                try {
                    $browserType = $browserTypeLoader->load($browser->getType());

                    $browserProperties['isSyndicationReader'] = $browserType->isSyndicationReader();
                    $browserProperties['Crawler']             = $browserType->isBot();
                    $browserProperties['Browser_Type']        = ($browserType->getName() ?? 'unknown');
                } catch (NotFoundException $e) {
                    $this->logger->critical($e);

                    $browserProperties['isSyndicationReader'] = false;
                    $browserProperties['Crawler']             = false;
                    $browserProperties['Browser_Type']        = 'unknown';
                }
            } else {
                $browserProperties = [];
            }

            $properties = array_merge($properties, $engineProperties, $deviceProperties, $browserProperties);

            if (isset($uaDataChild['properties'])
                && is_array($uaDataChild['properties'])
            ) {
                $properties = array_merge($properties, $uaDataChild['properties']);
            }

            $uaBase                      = str_replace('#PLATFORM#', '', $uaDataChild['match']);
            $this->patternId['platform'] = '';

            $properties['PatternId'] = $this->getPatternId();

            yield $uaBase => $properties;
        }
    }
1083759
private function addChildData(&$parentData, $childAttributes)
    {
        $authorizedChildAttributes = $parentData['children_attributes'];
        $addedChildAttributesData  = array_filter(
            $childAttributes,
            function ($attributeCode) use ($authorizedChildAttributes) {
                return in_array($attributeCode, $authorizedChildAttributes);
            },
            ARRAY_FILTER_USE_KEY
        );

        foreach ($addedChildAttributesData as $attributeCode => $value) {
            if (!isset($parentData[$attributeCode])) {
                $parentData[$attributeCode] = [];
            }

            $parentData[$attributeCode] = array_values(array_unique(array_merge($parentData[$attributeCode], $value)));
        }
    }
879301
public function setUa($ua)
    {
        $this->ua = $this->detector->setUserAgent($ua);

        // set browser & platform
        $this->setBrowser();

        return $this;
    }
1307347
@Override
	public boolean setChildAt(int index, N newChild) throws IndexOutOfBoundsException {
		final N oldChild = (index < this.children.length) ? this.children[index] : null;
		if (oldChild == newChild) {
			return false;
		}

		if (oldChild != null) {
			oldChild.setParentNodeReference(null, true);
			--this.notNullChildCount;
			firePropertyChildRemoved(index, oldChild);
		}

		if (newChild != null) {
			final N oldParent = newChild.getParentNode();
			if (oldParent != this) {
				newChild.removeFromParent();
			}
		}

		// set the element
		this.children[index] = newChild;

		if (newChild != null) {
			newChild.setParentNodeReference(toN(), true);
			++this.notNullChildCount;
			firePropertyChildAdded(index, newChild);
		}

		return true;
	}
1173091
public Pair<AccessControlList, DefaultAccessControlList> generateChildDirACL(Short umask) {
    AccessControlList acl = generateChildFileACL(umask);
    DefaultAccessControlList dAcl = new DefaultAccessControlList(acl);
    dAcl.setEmpty(false);
    dAcl.mOwningUser = mOwningUser;
    dAcl.mOwningGroup = mOwningGroup;
    dAcl.mMode = mMode;
    if (mExtendedEntries == null) {
      dAcl.mExtendedEntries = null;
    } else {
      dAcl.mExtendedEntries = new ExtendedACLEntries(mExtendedEntries);
    }
    return new Pair<>(acl, dAcl);
  }
924759
private function getAuthItemChild(){
         
        //get user name
        $user_id = Yii::app()->getModule('user')->user()->id;

        $new = Yii::app()->db->createCommand()
           ->select('itemname child')
           ->from('AuthAssignment')
           ->where('userid = :userid',array(':userid'=>$user_id))
           ->queryAll();             
         
         
         //init loop
         //$new[] = array('child' => $user_name);         
         $result = array();
         
         //load all leves uzth items
         while(!empty($new)){
             
            //create child list 
            $list = array(); 
            foreach ($new as $row){
                $list[] = $row['child'];
                
                //save result
                $result[$row['child']] = TRUE;
            }
             
            $new = Yii::app()->db->createCommand()
               ->select('child')
               ->from('AuthItemChild')
               ->where(array('in', 'parent', $list))
               ->queryAll();             
        }
        
        $this->_auth_items = $result;
         
     }
997941
protected function takeChildFromDOM($child)
    {
        $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
        switch ($absoluteNodeName) {
        case $this->lookupNamespace('atom') . ':' . 'generator':
            $generator = new Zend_Gdata_App_Extension_Generator();
            $generator->transferFromDOM($child);
            $this->_generator = $generator;
            break;
        case $this->lookupNamespace('atom') . ':' . 'icon':
            $icon = new Zend_Gdata_App_Extension_Icon();
            $icon->transferFromDOM($child);
            $this->_icon = $icon;
            break;
        case $this->lookupNamespace('atom') . ':' . 'logo':
            $logo = new Zend_Gdata_App_Extension_Logo();
            $logo->transferFromDOM($child);
            $this->_logo = $logo;
            break;
        case $this->lookupNamespace('atom') . ':' . 'subtitle':
            $subtitle = new Zend_Gdata_App_Extension_Subtitle();
            $subtitle->transferFromDOM($child);
            $this->_subtitle = $subtitle;
            break;
        default:
            parent::takeChildFromDOM($child);
            break;
        }
    }
788663
public synchronized void mergeChild(SymbolTable child)
    {
        // Let's do a basic sanity check first:
        if (child.size() <= size()) { // nothing to add
            return;
        }

        // Okie dokie, let's get the data in!
        mSymbols = child.mSymbols;
        mBuckets = child.mBuckets;
        mSize = child.mSize;
        mSizeThreshold = child.mSizeThreshold;
        mIndexMask = child.mIndexMask;
        mThisVersion++; // to prevent other children from overriding

        // Dirty flag... well, let's just clear it, to force copying just
        // in case. Shouldn't really matter, for master tables.
        mDirty = false;

        /* However, we have to mark child as dirty, so that it will not
         * be modifying arrays we "took over" (since child may have
         * returned an updated table before it stopped fully using
         * the SymbolTable: for example, it may still use it for
         * parsing PI targets in epilog)
         */
        child.mDirty = false;
    }
1298930
public function parse()
    {
        if ($this->isParsed || $this->uriPattern === null || $this->uriPattern === '') {
            return;
        }
        $this->routeParts = [];
        $currentRoutePartIsOptional = false;
        if (substr($this->uriPattern, -1) === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" ends with a slash, which is not allowed. You can put the trailing slash in brackets to make it optional.', 1234782997);
        }
        if ($this->uriPattern[0] === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" starts with a slash, which is not allowed.', 1234782983);
        }

        $matches = [];
        preg_match_all(self::PATTERN_EXTRACTROUTEPARTS, $this->uriPattern, $matches, PREG_SET_ORDER);

        /** @var $lastRoutePart RoutePartInterface */
        $lastRoutePart = null;
        foreach ($matches as $match) {
            $routePartType = empty($match['dynamic']) ? self::ROUTEPART_TYPE_STATIC : self::ROUTEPART_TYPE_DYNAMIC;
            $routePartName = $match['content'];
            if (!empty($match['optionalStart'])) {
                if ($lastRoutePart !== null && $lastRoutePart->isOptional()) {
                    throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive optional Route sections, which is not allowed.', 1234562050);
                }
                $currentRoutePartIsOptional = true;
            }
            $routePart = null;
            switch ($routePartType) {
                case self::ROUTEPART_TYPE_DYNAMIC:
                    if ($lastRoutePart instanceof DynamicRoutePartInterface) {
                        throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive Dynamic Route Parts, which is not allowed.', 1218446975);
                    }
                    if (isset($this->routePartsConfiguration[$routePartName]['handler'])) {
                        $routePart = $this->objectManager->get($this->routePartsConfiguration[$routePartName]['handler']);
                        if (!$routePart instanceof DynamicRoutePartInterface) {
                            throw new InvalidRoutePartHandlerException(sprintf('routePart handlers must implement "%s" in route "%s"', DynamicRoutePartInterface::class, $this->getName()), 1218480972);
                        }
                    } elseif (isset($this->routePartsConfiguration[$routePartName]['objectType'])) {
                        $routePart = new IdentityRoutePart();
                        $routePart->setObjectType($this->routePartsConfiguration[$routePartName]['objectType']);
                        if (isset($this->routePartsConfiguration[$routePartName]['uriPattern'])) {
                            $routePart->setUriPattern($this->routePartsConfiguration[$routePartName]['uriPattern']);
                        }
                    } else {
                        $routePart = new DynamicRoutePart();
                    }
                    $routePartDefaultValue = ObjectAccess::getPropertyPath($this->defaults, $routePartName);
                    if ($routePartDefaultValue !== null) {
                        $routePart->setDefaultValue($routePartDefaultValue);
                    }
                    break;
                case self::ROUTEPART_TYPE_STATIC:
                    $routePart = new StaticRoutePart();
                    if ($lastRoutePart !== null && $lastRoutePart instanceof DynamicRoutePartInterface) {
                        /** @var DynamicRoutePartInterface $lastRoutePart */
                        $lastRoutePart->setSplitString($routePartName);
                    }
            }
            $routePart->setName($routePartName);
            if ($currentRoutePartIsOptional) {
                $routePart->setOptional(true);
                if ($routePart instanceof DynamicRoutePartInterface && !$routePart->hasDefaultValue()) {
                    throw new InvalidRouteSetupException(sprintf('There is no default value specified for the optional route part "{%s}" of route "%s", but all dynamic optional route parts need a default.', $routePartName, $this->getName()), 1477140679);
                }
            }
            $routePart->setLowerCase($this->lowerCase);
            if (isset($this->routePartsConfiguration[$routePartName]['options'])) {
                $routePart->setOptions($this->routePartsConfiguration[$routePartName]['options']);
            }
            if (isset($this->routePartsConfiguration[$routePartName]['toLowerCase'])) {
                $routePart->setLowerCase($this->routePartsConfiguration[$routePartName]['toLowerCase']);
            }

            $this->routeParts[] = $routePart;
            if (!empty($match['optionalEnd'])) {
                if (!$currentRoutePartIsOptional) {
                    throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unopened optional section.', 1234564495);
                }
                $currentRoutePartIsOptional = false;
            }
            $lastRoutePart = $routePart;
        }
        if ($currentRoutePartIsOptional) {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unterminated optional section.', 1234563922);
        }
        $this->isParsed = true;
    }
1194400
protected UriTemplate nest(CharSequence uriTemplate, Object... parserArguments) {
        if (uriTemplate == null) {
            return this;
        }
        int len = uriTemplate.length();
        if (len == 0) {
            return this;
        }

        List<PathSegment> newSegments = buildNestedSegments(uriTemplate, len, parserArguments);
        return newUriTemplate(uriTemplate, newSegments);
    }
1113098
private static function applyAllToTree(
        RamlDoc $ramlDoc, array &$item, $itemKey = NULL
    )
    {
        if (
            RamlDoc::isValidMethod($itemKey)
            && !empty($item[RamlSpec::PROPERTY_APPLY_TRAITS])
        ) {
            $item = self::applyTraitsToNode(
                $ramlDoc, $item, $item[RamlSpec::PROPERTY_APPLY_TRAITS]
            );
        } elseif (RamlDoc::isResource($itemKey)) {
            if (!empty($item[RamlSpec::PROPERTY_APPLY_RESOURCE_TYPE])) {
                $item = self::applyResourceTypeToNode($ramlDoc, $item);
            }

            if (!empty($item[RamlSpec::PROPERTY_APPLY_TRAITS])) {
                foreach ($item as $key => &$value) {
                    if (RamlDoc::isValidMethod($key)) {
                        $value = self::applyTraitsToNode(
                            $ramlDoc,
                            $value,
                            $item[RamlSpec::PROPERTY_APPLY_TRAITS]
                        );
                    }
                }
            }
        }

        foreach ($item as $key => &$value) {
            if (
                (RamlDoc::isValidMethod($key) || RamlDoc::isResource($key))
                && !empty($value)
            ) {
                $value = call_user_func(__METHOD__, $ramlDoc, $value, $key);
            }
        }

        return $item;
    }
130527
public function addChildren($items)
    {
        $manager = self::getAuthManager();
        $success = 0;
        if ($this->_item) {
            foreach ($items as $name) {
                $child = $manager->getPermission($name);
                if ($this->type == Item::TYPE_ROLE && $child === null) {
                    $child = $manager->getRole($name);
                }
                try {
                    $manager->addChild($this->_item, $child);
                    $success++;
                } catch (\Exception $exc) {
                    Yii::error($exc->getMessage(), __METHOD__);
                }
            }
        }
        if ($success > 0) {
            UserRBACHelper::invalidate();
        }
        return $success;
    }
1059317
private void addChildrenForOUNode(CmsOrganizationalUnit item) {

        List<Object> itemsToRemove = new ArrayList<Object>();

        Collection<?> childCol = m_treeContainer.getChildren(item);
        if (childCol != null) {
            itemsToRemove.addAll(childCol);
        }

        try {
            if (m_app.isOUManagable(item.getName())) {

                List<I_CmsOuTreeType> types = m_app.getTreeTypeProvider().getTreeTypes();
                for (I_CmsOuTreeType type : types) {
                    if (!type.isValidForOu(m_cms, item.getName())) {
                        continue;
                    }
                    if (type.isOrgUnit()) {
                        continue;
                    }
                    String itemId = type.getId() + item.getName();
                    Item newItem = m_treeContainer.addItem(itemId);
                    itemsToRemove.remove(itemId);
                    if (newItem != null) {
                        newItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(itemId, type));
                        newItem.getItemProperty(PROP_TYPE).setValue(type);
                        m_treeContainer.setParent(itemId, item);
                        setChildrenAllowed(itemId, type.isExpandable());
                    }
                }
            }
            List<CmsOrganizationalUnit> ous = OpenCms.getOrgUnitManager().getOrganizationalUnits(
                m_cms,
                item.getName(),
                false);
            List<CmsOrganizationalUnit> webOus = new ArrayList<CmsOrganizationalUnit>();
            for (CmsOrganizationalUnit ou : ous) {
                if (m_app.isParentOfManagableOU(ou.getName())) {
                    itemsToRemove.remove(ou);
                    if (ou.hasFlagWebuser()) {
                        webOus.add(ou);
                    } else {
                        addOuToTree(ou, item);
                    }
                }
            }
            for (CmsOrganizationalUnit ou : webOus) {
                if (m_app.isParentOfManagableOU(ou.getName())) {
                    itemsToRemove.remove(ou);
                    addOuToTree(ou, item);
                }
            }
        } catch (CmsException e) {
            LOG.error("Can't read ou", e);
        }
        for (Object it : itemsToRemove) {
            m_treeContainer.removeItemRecursively(it);
        }
    }
640797
private function handleUseragentBlock(Lexer $lexer, int $useragentPosition) : int
    {
        $enterChildGroup = false;

        do {
            $code = $lexer->lex();

            if (self::JSON_STRING === $code && 'children' === $lexer->yytext) {
                $enterChildGroup = true;
            } elseif (self::JSON_ARRAY_START === $code && true === $enterChildGroup) {
                $code            = $this->handleChildrenGroup($lexer, $useragentPosition);
                $enterChildGroup = false;
            } elseif (self::JSON_OBJECT_START === $code) {
                $code = $this->ignoreObjectBlock($lexer);
            }
        } while (self::JSON_OBJECT_END !== $code);

        return $lexer->lex();
    }
1164821
private function loadNodeAndAncestors($uuid, $webspaceKey, $locale, $excludeGhosts, $excludeShadows, $complete)
    {
        $descendants = $this->getMapper()->loadNodeAndAncestors(
            $uuid,
            $locale,
            $webspaceKey,
            $excludeGhosts,
            $excludeShadows
        );
        $descendants = array_reverse($descendants);

        $childTiers = [];
        foreach ($descendants as $descendant) {
            foreach ($descendant->getChildren() as $child) {
                $type = $child->getType();

                if ($excludeShadows && null !== $type && 'shadow' === $type->getName()) {
                    continue;
                }

                if ($excludeGhosts && null !== $type && 'ghost' === $type->getName()) {
                    continue;
                }

                if (!isset($childTiers[$descendant->getUuid()])) {
                    $childTiers[$descendant->getUuid()] = [];
                }
                $childTiers[$descendant->getUuid()][] = $this->prepareNode(
                    $child,
                    $webspaceKey,
                    $locale,
                    1,
                    $complete,
                    $excludeGhosts
                );
            }
        }
        $result = array_shift($childTiers);

        $this->iterateTiers($childTiers, $result);

        return $result;
    }
1053325
function AddChild($name, $attrs, $parents, $cleanTagName = true)
    {    
        //If the tag is a reserved name, output an error
        if(in_array($name, array('tagChildren', 'tagAttrs', 'tagParents', 'tagData', 'tagName')))
        {
            trigger_error('You have used a reserved name as the name of an XML tag. Please consult the documentation (http://www.criticaldevelopment.net/xml/) and rename the tag named "'.$name.'" to something other than a reserved name.', E_USER_ERROR);

            return;
        }
        
        //Create the child object itself
        $child = new MultiotpXMLTag($name, $attrs, $parents);

        //If the cleanTagName feature is on, replace colons and dashes with underscores
        if($cleanTagName)
            $name = str_replace(array(':', '-'), '_', $name);
        
        //Toss up a notice if someone's trying to to use a colon or dash in a tag name
        elseif(strstr($name, ':') || strstr($name, '-'))
            trigger_error('Your tag named "'.$name.'" contains either a dash or a colon. Neither of these characters are friendly with PHP variable names, and, as such, they cannot be accessed and will cause the parser to not work. You must enable the cleanTagName feature (pass true as the second argument of the MultiotpXmlParser constructor). For more details, see http://www.criticaldevelopment.net/xml/', E_USER_ERROR);
            
        //If there is no array already set for the tag name being added, 
        //create an empty array for it
        if(!isset($this->$name))
            $this->$name = array();
        
        //Add the reference of it to the end of an array member named for the tag's name
        $this->{$name}[] =& $child;
        
        //Add the reference to the children array member
        $this->tagChildren[] =& $child;
    }
1033854
private <T extends INode> T addChild(INode[] pathComponents, int startPos, int endPos,
      T child, long childDiskspace, boolean inheritPermission,
      boolean checkQuota) throws QuotaExceededException {
    INode.DirCounts counts = new INode.DirCounts();
    child.spaceConsumedInTree(counts);
    if (childDiskspace < 0) {
      childDiskspace = counts.getDsCount();
    }
    updateCount(pathComponents, startPos, endPos, counts.getNsCount(), childDiskspace,
        checkQuota);
    T addedNode = null;
    try {
      addedNode = ((INodeDirectory) pathComponents[endPos - 1]).addChild(child,
          inheritPermission);
    } finally {
      if (addedNode == null) {
        updateCount(pathComponents, startPos, endPos, -counts.getNsCount(),
            -childDiskspace, true);
      } else {
        inodeMap.put(addedNode);
      }
    }
    return addedNode;
  }