Kaydet (Commit) 6fe84df4 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

CMIS UCP: fixed save as which was broken by bad exceptions catching

Change-Id: I81bb45279b23d0c8d77f8e7aa366d038efa13d89
üst 64040dbb
...@@ -276,41 +276,56 @@ namespace cmis ...@@ -276,41 +276,56 @@ namespace cmis
for( sal_Int32 n = 0; n < nProps; ++n ) for( sal_Int32 n = 0; n < nProps; ++n )
{ {
const beans::Property& rProp = pProps[ n ];
try try
{ {
const beans::Property& rProp = pProps[ n ];
if ( rProp.Name == "IsDocument" ) if ( rProp.Name == "IsDocument" )
{ {
if ( getObject( ).get( ) ) try
{
xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:document" ); xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:document" );
else if ( m_pObjectType.get( ) ) }
xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:document" ); catch ( const libcmis::Exception& )
else {
xRow->appendVoid( rProp ); if ( m_pObjectType.get( ) )
xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:document" );
else
xRow->appendVoid( rProp );
}
} }
else if ( rProp.Name == "IsFolder" ) else if ( rProp.Name == "IsFolder" )
{ {
if ( getObject( ).get( ) ) try
{
xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:folder" ); xRow->appendBoolean( rProp, getObject()->getBaseType( ) == "cmis:folder" );
else if ( m_pObjectType.get( ) ) }
xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:folder" ); catch ( const libcmis::Exception& )
else {
xRow->appendVoid( rProp ); if ( m_pObjectType.get( ) )
xRow->appendBoolean( rProp, m_pObjectType->getBaseType()->getId( ) == "cmis:folder" );
else
xRow->appendVoid( rProp );
}
} }
else if ( rProp.Name == "Title" ) else if ( rProp.Name == "Title" )
{ {
rtl::OUString sTitle; rtl::OUString sTitle;
if ( getObject().get() ) try
{
sTitle = STD_TO_OUSTR( getObject()->getName() ); 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 ( m_pObjectProps.size() > 0 )
if ( it != m_pObjectProps.end( ) )
{ {
vector< string > values = it->second->getStrings( ); map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
if ( values.size() > 0 ) if ( it != m_pObjectProps.end( ) )
sTitle = STD_TO_OUSTR( values.front( ) ); {
vector< string > values = it->second->getStrings( );
if ( values.size() > 0 )
sTitle = STD_TO_OUSTR( values.front( ) );
}
} }
} }
...@@ -337,7 +352,7 @@ namespace cmis ...@@ -337,7 +352,7 @@ namespace cmis
else if ( rProp.Name == "TitleOnServer" ) else if ( rProp.Name == "TitleOnServer" )
{ {
string path; string path;
if ( getObject().get( ) ) try
{ {
vector< string > paths = getObject( )->getPaths( ); vector< string > paths = getObject( )->getPaths( );
if ( paths.size( ) > 0 ) if ( paths.size( ) > 0 )
...@@ -347,8 +362,10 @@ namespace cmis ...@@ -347,8 +362,10 @@ namespace cmis
xRow->appendString( rProp, STD_TO_OUSTR( path ) ); xRow->appendString( rProp, STD_TO_OUSTR( path ) );
} }
else catch ( const libcmis::Exception& )
{
xRow->appendVoid( rProp ); xRow->appendVoid( rProp );
}
} }
else if ( rProp.Name == "IsReadOnly" ) else if ( rProp.Name == "IsReadOnly" )
{ {
...@@ -371,11 +388,18 @@ namespace cmis ...@@ -371,11 +388,18 @@ namespace cmis
} }
else if ( rProp.Name == "Size" ) else if ( rProp.Name == "Size" )
{ {
libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) ); try
if ( NULL != document ) {
xRow->appendLong( rProp, document->getContentLength() ); libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) );
else if ( NULL != document )
xRow->appendLong( rProp, document->getContentLength() );
else
xRow->appendVoid( rProp );
}
catch ( const libcmis::Exception& )
{
xRow->appendVoid( rProp ); xRow->appendVoid( rProp );
}
} }
else if ( rProp.Name == "CreatableContentsInfo" ) else if ( rProp.Name == "CreatableContentsInfo" )
{ {
...@@ -386,11 +410,7 @@ namespace cmis ...@@ -386,11 +410,7 @@ namespace cmis
} }
catch ( const libcmis::Exception& e ) catch ( const libcmis::Exception& e )
{ {
ucbhelper::cancelCommandExecution( xRow->appendVoid( rProp );
ucb::IOErrorCode_GENERAL,
uno::Sequence< uno::Any >( 0 ),
xEnv,
rtl::OUString::createFromAscii( e.what() ) );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment