From 4d4bfb28a75c7887a46fec3c0f71260781ae0471 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 16 Nov 2009 14:59:17 +0100 Subject: #i84012# +getLocalName --- unotools/inc/unotools/confignode.hxx | 3 +++ unotools/source/config/confignode.cxx | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'unotools') diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index 580274004e1a..2e305030fa2b 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -88,6 +88,9 @@ namespace utl /// dtor ~OConfigurationNode() {} + /// returns the local name of the node + ::rtl::OUString getLocalName() const; + /** open a sub node @param _rPath access path of the to-be-opened sub node. May be a hierarchical path. */ diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 4b1b9fe272db..56d258461e95 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #if OSL_DEBUG_LEVEL > 0 @@ -138,6 +139,22 @@ namespace utl clear(); } + //------------------------------------------------------------------------ + ::rtl::OUString OConfigurationNode::getLocalName() const + { + ::rtl::OUString sLocalName; + try + { + Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); + sLocalName = xNamed->getName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sLocalName; + } + //------------------------------------------------------------------------ ::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const { @@ -155,13 +172,9 @@ namespace utl else sName = xEscaper->unescapeString(sName); } - catch(IllegalArgumentException&) - { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: illegal argument (caught an exception saying so)!"); - } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: caught an exception!"); + DBG_UNHANDLED_EXCEPTION(); } } } -- cgit From cab402a8aa21c2ba6d2d66d45d44b3b2b07cedf8 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 3 Dec 2009 14:12:42 +0100 Subject: diagnostics --- unotools/source/config/confignode.cxx | 37 ++++++++++------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 56d258461e95..c8134137db0c 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -468,16 +468,9 @@ namespace utl aReturn = m_xHierarchyAccess->getByHierarchicalName(_rPath); } } - catch(NoSuchElementException& e) + catch(const NoSuchElementException&) { - #if OSL_DEBUG_LEVEL > 0 - rtl::OStringBuffer aBuf( 256 ); - aBuf.append("OConfigurationNode::getNodeValue: caught a NoSuchElementException while trying to open "); - aBuf.append( rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE(sal_False, aBuf.getStr()); - #else - (void)e; - #endif + DBG_UNHANDLED_EXCEPTION(); } return aReturn; } @@ -500,7 +493,7 @@ namespace utl } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::cloneAsRoot: could not retrieve the node path!"); + DBG_UNHANDLED_EXCEPTION(); } } @@ -561,13 +554,9 @@ namespace utl m_xCommitter->commitChanges(); return sal_True; } - catch(WrappedTargetException&) - { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a WrappedTargetException!"); - } - catch(RuntimeException&) + catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::commit: caught a RuntimeException!"); + DBG_UNHANDLED_EXCEPTION(); } return sal_False; } @@ -604,7 +593,7 @@ namespace utl } catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithProvider: unable to check the service conformance of the provider given!"); + DBG_UNHANDLED_EXCEPTION(); } } #endif @@ -648,15 +637,9 @@ namespace utl try { xComp->dispose(); } catch(Exception&) { } } } - catch(Exception& e) + catch(const Exception&) { - #if OSL_DEBUG_LEVEL > 0 - ::rtl::OString sMessage( "OConfigurationTreeRoot::createWithProvider: caught an exception while creating the access object!\nmessage:\n" ); - sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); - OSL_ENSURE( sal_False, sMessage.getStr() ); - #else - (void)e; - #endif + DBG_UNHANDLED_EXCEPTION(); } } bTryAgain = CM_PREFER_UPDATABLE == _eMode; @@ -683,9 +666,9 @@ namespace utl if (xProviderAsFac.is()) return createWithProvider(xProviderAsFac, _rPath, _nDepth, _eMode, _bLazyWrite); } - catch(Exception&) + catch(const Exception&) { - OSL_ENSURE(sal_False, "OConfigurationTreeRoot::createWithServiceFactory: error while instantiating the provider service!"); + DBG_UNHANDLED_EXCEPTION(); } } return OConfigurationTreeRoot(); -- cgit From 31a763ce50ce977168ba7806077465130c89b26a Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Wed, 6 Jan 2010 16:46:36 +0100 Subject: #i61429# - Adapted UCB clients to deprecated XContentCreator interface. --- unotools/source/ucbhelper/ucbhelper.cxx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'unotools') diff --git a/unotools/source/ucbhelper/ucbhelper.cxx b/unotools/source/ucbhelper/ucbhelper.cxx index 2b301efc4e52..a798f485516a 100644 --- a/unotools/source/ucbhelper/ucbhelper.cxx +++ b/unotools/source/ucbhelper/ucbhelper.cxx @@ -46,15 +46,13 @@ #include #include #include +#include #include -#include #include #include #include #include -#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_ #include -#endif #include #include #include @@ -489,11 +487,7 @@ sal_Bool UCBContentHelper::CanMakeFolder( const String& rFolder ) try { Content aCnt( rFolder, uno::Reference< XCommandEnvironment > () ); - uno::Reference< XContentCreator > xCreator = uno::Reference< XContentCreator >( aCnt.get(), UNO_QUERY ); - if ( !xCreator.is() ) - return sal_False; - - Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo(); + Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); sal_Int32 nCount = aInfo.getLength(); if ( nCount == 0 ) return sal_False; @@ -538,11 +532,7 @@ sal_Bool UCBContentHelper::MakeFolder( Content& aCnt, const String& aTitle, Cont try { - uno::Reference< XContentCreator > xCreator( aCnt.get(), UNO_QUERY ); - if ( !xCreator.is() ) - return sal_False; - - Sequence< ContentInfo > aInfo = xCreator->queryCreatableContentsInfo(); + Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo(); sal_Int32 nCount = aInfo.getLength(); if ( nCount == 0 ) return sal_False; -- cgit