diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-03-18 09:36:50 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-03-18 09:36:50 +0000 |
commit | 4b279eaa29e7afeebcb423615ab930731b55d007 (patch) | |
tree | c89bd340575179bdc7f439d7e84152799a513707 /unotools/source/config/configitem.cxx | |
parent | a3540dd12fa9c8d47379292153dfef170ee8c76c (diff) |
INTEGRATION: CWS cfgfix01 (1.46.20); FILE MERGED
2005/03/10 12:32:16 jb 1.46.20.1: #i37322# Fix ReplaceSetProperties (sort of): When a simple value can't be removed from an extensible node, try setting it to VOID instead
Diffstat (limited to 'unotools/source/config/configitem.cxx')
-rw-r--r-- | unotools/source/config/configitem.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 54f7b7f80a8f..e8e696017443 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -2,9 +2,9 @@ * * $RCSfile: configitem.cxx,v $ * - * $Revision: 1.46 $ + * $Revision: 1.47 $ * - * last change: $Author: hjs $ $Date: 2004-06-28 12:52:17 $ + * last change: $Author: obo $ $Date: 2005-03-18 10:36:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1200,6 +1200,9 @@ sal_Bool ConfigItem::ReplaceSetProperties( const OUString* pSubNodeNames = aSubNodeNames.getConstArray(); const sal_Int32 nSubNodeCount = aSubNodeNames.getLength(); + Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY); + const bool isSimpleValueSet = !xFac.is(); + //remove unknown members first { const Sequence<OUString> aContainerSubNodes = xCont->getElementNames(); @@ -1217,16 +1220,31 @@ sal_Bool ConfigItem::ReplaceSetProperties( } } if(!bFound) + try { xCont->removeByName(pContainerSubNodes[nContSub]); } + catch (Exception & ) + { + if (isSimpleValueSet) + try + { + // #i37322#: fallback action: replace with <void/> + xCont->replaceByName(pContainerSubNodes[nContSub], Any()); + // fallback successfull: continue looping + continue; + } + catch (Exception &) + {} // propagate original exception, if fallback fails + + throw; + } } try { xBatch->commitChanges(); } CATCH_INFO("Exception from commitChanges(): ") } - Reference<XSingleServiceFactory> xFac(xCont, UNO_QUERY); - if(xFac.is()) + if(xFac.is()) // !isSimpleValueSet { for(sal_Int32 j = 0; j < nSubNodeCount; j++) { |