[Libreoffice-commits] .: ucb/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Thu Jun 28 08:28:15 PDT 2012
ucb/source/ucp/cmis/cmis_content.cxx | 80 +++++++++++++++++++++--------------
1 file changed, 50 insertions(+), 30 deletions(-)
New commits:
commit 6fe84df471e80e47dcc41c2fb02d39a178477a0e
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Thu Jun 28 17:25:31 2012 +0200
CMIS UCP: fixed save as which was broken by bad exceptions catching
Change-Id: I81bb45279b23d0c8d77f8e7aa366d038efa13d89
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f4f73e5..6c41521 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -276,41 +276,56 @@ namespace cmis
for( sal_Int32 n = 0; n < nProps; ++n )
{
+ const beans::Property& rProp = pProps[ n ];
+
try
{
- const beans::Property& rProp = pProps[ n ];
-
if ( rProp.Name == "IsDocument" )
{
- if ( getObject( ).get( ) )
+ try
+ {
xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:document" );
- else if ( m_pObjectType.get( ) )
- xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:document" );
- else
- xRow->appendVoid( rProp );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ if ( m_pObjectType.get( ) )
+ xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:document" );
+ else
+ xRow->appendVoid( rProp );
+ }
}
else if ( rProp.Name == "IsFolder" )
{
- if ( getObject( ).get( ) )
+ try
+ {
xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:folder" );
- else if ( m_pObjectType.get( ) )
- xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:folder" );
- else
- xRow->appendVoid( rProp );
+ }
+ catch ( const libcmis::Exception& )
+ {
+ if ( m_pObjectType.get( ) )
+ xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:folder" );
+ else
+ xRow->appendVoid( rProp );
+ }
}
else if ( rProp.Name == "Title" )
{
rtl::OUString sTitle;
- if ( getObject().get() )
+ try
+ {
sTitle = STD_TO_OUSTR( getObject()->getName() );
- else if ( m_pObjectProps.size() > 0 )
+ }
+ catch ( const libcmis::Exception& )
{
- map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
- if ( it != m_pObjectProps.end( ) )
+ if ( m_pObjectProps.size() > 0 )
{
- vector< string > values = it->second->getStrings( );
- if ( values.size() > 0 )
- sTitle = STD_TO_OUSTR( values.front( ) );
+ map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
+ if ( it != m_pObjectProps.end( ) )
+ {
+ vector< string > values = it->second->getStrings( );
+ if ( values.size() > 0 )
+ sTitle = STD_TO_OUSTR( values.front( ) );
+ }
}
}
@@ -337,7 +352,7 @@ namespace cmis
else if ( rProp.Name == "TitleOnServer" )
{
string path;
- if ( getObject().get( ) )
+ try
{
vector< string > paths = getObject( )->getPaths( );
if ( paths.size( ) > 0 )
@@ -347,8 +362,10 @@ namespace cmis
xRow->appendString( rProp, STD_TO_OUSTR( path ) );
}
- else
+ catch ( const libcmis::Exception& )
+ {
xRow->appendVoid( rProp );
+ }
}
else if ( rProp.Name == "IsReadOnly" )
{
@@ -371,11 +388,18 @@ namespace cmis
}
else if ( rProp.Name == "Size" )
{
- libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) );
- if ( NULL != document )
- xRow->appendLong( rProp, document->getContentLength() );
- else
+ try
+ {
+ libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) );
+ if ( NULL != document )
+ xRow->appendLong( rProp, document->getContentLength() );
+ else
+ xRow->appendVoid( rProp );
+ }
+ catch ( const libcmis::Exception& )
+ {
xRow->appendVoid( rProp );
+ }
}
else if ( rProp.Name == "CreatableContentsInfo" )
{
@@ -386,11 +410,7 @@ namespace cmis
}
catch ( const libcmis::Exception& e )
{
- ucbhelper::cancelCommandExecution(
- ucb::IOErrorCode_GENERAL,
- uno::Sequence< uno::Any >( 0 ),
- xEnv,
- rtl::OUString::createFromAscii( e.what() ) );
+ xRow->appendVoid( rProp );
}
}
More information about the Libreoffice-commits
mailing list