ucb/source/ucp/cmis/cmis_content.cxx | 156 +++++++++++++++++++++-------------- 1 file changed, 98 insertions(+), 58 deletions(-)
New commits: commit 705b6b61e3cb7c9180debaf90f8a08faf0de2bfb Author: Caolán McNamara <[email protected]> Date: Thu Nov 6 10:20:33 2014 +0000 coverity#983989 Uncaught exception Change-Id: I7508ee67a10b43686600b41dd58c1a8a5aa90c51 diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 720f16d..08d01a8 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1854,40 +1854,51 @@ namespace cmis uno::Sequence< uno::Type > SAL_CALL Content::getTypes() throw( uno::RuntimeException, std::exception ) { - if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) ) - { - static cppu::OTypeCollection aFolderCollection - (CPPU_TYPE_REF( lang::XTypeProvider ), - CPPU_TYPE_REF( lang::XServiceInfo ), - CPPU_TYPE_REF( lang::XComponent ), - CPPU_TYPE_REF( ucb::XContent ), - CPPU_TYPE_REF( ucb::XCommandProcessor ), - CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ), - CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ), - CPPU_TYPE_REF( beans::XPropertyContainer ), - CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ), - CPPU_TYPE_REF( container::XChild ), - CPPU_TYPE_REF( ucb::XContentCreator ) ); - return aFolderCollection.getTypes(); + try + { + if ( isFolder( uno::Reference< ucb::XCommandEnvironment >() ) ) + { + static cppu::OTypeCollection aFolderCollection + (CPPU_TYPE_REF( lang::XTypeProvider ), + CPPU_TYPE_REF( lang::XServiceInfo ), + CPPU_TYPE_REF( lang::XComponent ), + CPPU_TYPE_REF( ucb::XContent ), + CPPU_TYPE_REF( ucb::XCommandProcessor ), + CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ), + CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ), + CPPU_TYPE_REF( beans::XPropertyContainer ), + CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ), + CPPU_TYPE_REF( container::XChild ), + CPPU_TYPE_REF( ucb::XContentCreator ) ); + return aFolderCollection.getTypes(); + } } - else + catch (const uno::RuntimeException&) { - static cppu::OTypeCollection aFileCollection - (CPPU_TYPE_REF( lang::XTypeProvider ), - CPPU_TYPE_REF( lang::XServiceInfo ), - CPPU_TYPE_REF( lang::XComponent ), - CPPU_TYPE_REF( ucb::XContent ), - CPPU_TYPE_REF( ucb::XCommandProcessor ), - CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ), - CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ), - CPPU_TYPE_REF( beans::XPropertyContainer ), - CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ), - CPPU_TYPE_REF( container::XChild ) ); - - return aFileCollection.getTypes(); + throw; + } + catch (const uno::Exception& e) + { + uno::Any a(cppu::getCaughtException()); + throw lang::WrappedTargetRuntimeException( + "wrapped Exception " + e.Message, + uno::Reference<uno::XInterface>(), a); } - } + static cppu::OTypeCollection aFileCollection + (CPPU_TYPE_REF( lang::XTypeProvider ), + CPPU_TYPE_REF( lang::XServiceInfo ), + CPPU_TYPE_REF( lang::XComponent ), + CPPU_TYPE_REF( ucb::XContent ), + CPPU_TYPE_REF( ucb::XCommandProcessor ), + CPPU_TYPE_REF( beans::XPropertiesChangeNotifier ), + CPPU_TYPE_REF( ucb::XCommandInfoChangeNotifier ), + CPPU_TYPE_REF( beans::XPropertyContainer ), + CPPU_TYPE_REF( beans::XPropertySetInfoChangeNotifier ), + CPPU_TYPE_REF( container::XChild ) ); + + return aFileCollection.getTypes(); + } uno::Sequence< ucb::ContentInfo > Content::queryCreatableContentsInfo( const uno::Reference< ucb::XCommandEnvironment >& xEnv) commit ffc3b11dc32e72651abc1ff054eafdbd424587cc Author: Caolán McNamara <[email protected]> Date: Thu Nov 6 10:19:01 2014 +0000 coverity#983985 Uncaught exception Change-Id: I0082d75aa2c00daa35d8d72e44fbb6da161f9774 diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 4bc9d00..720f16d 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -1893,35 +1893,46 @@ namespace cmis const uno::Reference< ucb::XCommandEnvironment >& xEnv) throw( uno::RuntimeException ) { - if ( isFolder( xEnv ) ) + try { - uno::Sequence< ucb::ContentInfo > seq(2); - - // Minimum set of props we really need - uno::Sequence< beans::Property > props( 1 ); - props[0] = beans::Property( - OUString("Title"), - -1, - cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); - - // file - seq[0].Type = CMIS_FILE_TYPE; - seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | - ucb::ContentInfoAttribute::KIND_DOCUMENT ); - seq[0].Properties = props; - - // folder - seq[1].Type = CMIS_FOLDER_TYPE; - seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; - seq[1].Properties = props; - - return seq; + if ( isFolder( xEnv ) ) + { + uno::Sequence< ucb::ContentInfo > seq(2); + + // Minimum set of props we really need + uno::Sequence< beans::Property > props( 1 ); + props[0] = beans::Property( + OUString("Title"), + -1, + cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND ); + + // file + seq[0].Type = CMIS_FILE_TYPE; + seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | + ucb::ContentInfoAttribute::KIND_DOCUMENT ); + seq[0].Properties = props; + + // folder + seq[1].Type = CMIS_FOLDER_TYPE; + seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER; + seq[1].Properties = props; + + return seq; + } } - else + catch (const uno::RuntimeException&) { - return uno::Sequence< ucb::ContentInfo >(); + throw; + } + catch (const uno::Exception& e) + { + uno::Any a(cppu::getCaughtException()); + throw lang::WrappedTargetRuntimeException( + "wrapped Exception " + e.Message, + uno::Reference<uno::XInterface>(), a); } + return uno::Sequence< ucb::ContentInfo >(); } list< uno::Reference< ucb::XContent > > Content::getChildren( ) commit 0ac7311562bc059d803aa61186b5a5fc7f7dd1a7 Author: Caolán McNamara <[email protected]> Date: Thu Nov 6 10:16:45 2014 +0000 coverity#983984 Uncaught exception Change-Id: I6a166a1691e39e21a4d765ca7dd0a7fcfba8126b diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 039b438..4bc9d00 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -17,6 +17,7 @@ #include <com/sun/star/io/XActiveDataSink.hpp> #include <com/sun/star/io/XActiveDataStreamer.hpp> #include <com/sun/star/lang/IllegalAccessException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/ucb/ContentInfo.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> @@ -40,6 +41,7 @@ #endif #include <comphelper/processfactory.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <config_oauth2.h> #include <ucbhelper/cancelcommandexecution.hxx> #include <ucbhelper/content.hxx> @@ -1657,9 +1659,25 @@ namespace cmis OUString SAL_CALL Content::getContentType() throw( uno::RuntimeException, std::exception ) { - return isFolder( uno::Reference< ucb::XCommandEnvironment >() ) - ? OUString(CMIS_FOLDER_TYPE) - : OUString(CMIS_FILE_TYPE); + OUString sRet; + try + { + sRet = isFolder( uno::Reference< ucb::XCommandEnvironment >() ) + ? OUString(CMIS_FOLDER_TYPE) + : OUString(CMIS_FILE_TYPE); + } + catch (const uno::RuntimeException&) + { + throw; + } + catch (const uno::Exception& e) + { + uno::Any a(cppu::getCaughtException()); + throw lang::WrappedTargetRuntimeException( + "wrapped Exception " + e.Message, + uno::Reference<uno::XInterface>(), a); + } + return sRet; } uno::Any SAL_CALL Content::execute(
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
