summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-28 17:25:31 +0200
committerCédric Bosdonnat <cedric.bosdonnat@free.fr>2012-06-28 17:26:37 +0200
commit6fe84df471e80e47dcc41c2fb02d39a178477a0e (patch)
tree064d9ffd3a7c7d93ed3d6257b26948edf9fd13b1
parent64040dbbb5b35e8838f55b791f86a4d6819070b0 (diff)
CMIS UCP: fixed save as which was broken by bad exceptions catching
Change-Id: I81bb45279b23d0c8d77f8e7aa366d038efa13d89
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx80
1 files changed, 50 insertions, 30 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index f4f73e59158c..6c4152149abb 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 );
}
}