summaryrefslogtreecommitdiffstats
path: root/ucb/source/ucp/cmis/cmis_content.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'ucb/source/ucp/cmis/cmis_content.cxx')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx52
1 files changed, 46 insertions, 6 deletions
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 7be8c458118b..bc77db188351 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -253,6 +253,32 @@ namespace
return property;
}
+
+ uno::Sequence< uno::Any > generateErrorArguments( const cmis::URL & rURL )
+ {
+ uno::Sequence< uno::Any > aArguments(3);
+
+ size_t i = 0;
+ aArguments[i++] <<= beans::PropertyValue(
+ OUString( "Binding URL" ),
+ - 1,
+ uno::makeAny( rURL.getBindingUrl() ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ aArguments[i++] <<= beans::PropertyValue(
+ OUString( "Username" ),
+ -1,
+ uno::makeAny( rURL.getUsername() ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ aArguments[i++] <<= beans::PropertyValue(
+ OUString( "Repository Id" ),
+ -1,
+ uno::makeAny( rURL.getRepositoryId() ),
+ beans::PropertyState_DIRECT_VALUE );
+
+ return aArguments;
+ }
}
namespace cmis
@@ -365,14 +391,28 @@ namespace cmis
m_pSession = libcmis::SessionFactory::createSession(
OUSTR_TO_STDSTR( m_aURL.getBindingUrl( ) ),
rUsername, rPassword, OUSTR_TO_STDSTR( m_aURL.getRepositoryId( ) ), false, oauth2Data );
- if ( m_pSession == NULL )
+ if ( m_pSession == nullptr )
+ {
+ // Fail: session was not created
+ ucbhelper::cancelCommandExecution(
+ ucb::IOErrorCode_INVALID_DEVICE,
+ generateErrorArguments(m_aURL),
+ xEnv,
+ OUString());
+ }
+ else if ( m_pSession->getRepository() == nullptr )
+ {
+ // Fail: no repository or repository is invalid
ucbhelper::cancelCommandExecution(
- ucb::IOErrorCode_INVALID_DEVICE,
- uno::Sequence< uno::Any >( 0 ),
- xEnv,
- OUString( ) );
+ ucb::IOErrorCode_INVALID_DEVICE,
+ generateErrorArguments(m_aURL),
+ xEnv,
+ OUString("error accessing a repository"));
+ }
else
- m_pProvider->registerSession( sSessionId, m_pSession );
+ {
+ m_pProvider->registerSession(sSessionId, m_pSession);
+ }
}
else
{