diff options
author | Frank Schönheit <fs@openoffice.org> | 2000-10-27 13:23:00 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2000-10-27 13:23:00 +0000 |
commit | eec8dea3a6569391c7eb1899aaac2adcbaee5afc (patch) | |
tree | dd8036dcd04172bf566ee519163961804782a725 /configmgr | |
parent | ced48048199733e9d4552160ac9cfd29d4595f88 (diff) |
#79864# requestSubTree is allowed to throw a NoSuchElementException
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/tree/cmtree.cxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx index 8d00089430e4..95dcbbb13530 100644 --- a/configmgr/source/tree/cmtree.cxx +++ b/configmgr/source/tree/cmtree.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cmtree.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: dg $ $Date: 2000-10-24 11:07:56 $ + * last change: $Author: fs $ $Date: 2000-10-27 14:23:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -671,7 +671,7 @@ namespace configmgr } // ----------------------------------------------------------------------------- - ISubtree* Tree::requestSubtree( OUString const& aComponentName, sal_Int16 nLevel ) + ISubtree* Tree::requestSubtree( OUString const& aComponentName, sal_Int16 nLevel ) throw (container::NoSuchElementException) { // OLD: // INode* pResult = m_pRoot->getChild(aComponentName); @@ -700,7 +700,7 @@ namespace configmgr if (pNode) pSubtree = pNode->asISubtree(); else - return NULL; + throw container::NoSuchElementException(); } else break; @@ -711,7 +711,9 @@ namespace configmgr bCompleteForRequest = pSubtree && (ALL_LEVELS == pSubtree->getLevel() || (ALL_LEVELS != nLevel && nLevel <= pSubtree->getLevel())); - return bCompleteForRequest ? pSubtree : NULL; + if (!pSubtree || !bCompleteForRequest) + throw container::NoSuchElementException(); + } // ----------------------------------------------------------------------------- @@ -905,8 +907,18 @@ namespace configmgr void Tree::updateTree( TreeChangeList& aTree) throw (starlang::WrappedTargetException, uno::RuntimeException) { ConfigurationName aSubtreeName(aTree.pathToRoot, aTree.root.getNodeName()); - // request the subtree, atleast one level must exist! - ISubtree *pSubtree = requestSubtree(aSubtreeName.fullName(), 1); + ISubtree *pSubtree = NULL; + try + { + // request the subtree, atleast one level must exist! + pSubtree = requestSubtree(aSubtreeName.fullName(), 1); + } + catch(container::NoSuchElementException&e) + { + starlang::WrappedTargetException aError; + aError.TargetException <<= e; + throw starlang::WrappedTargetException(aError); + } #ifdef DEBUG ::rtl::OString aStr("Tree: there is no Subtree for name:="); |