summaryrefslogtreecommitdiffstats
path: root/ucb
diff options
context:
space:
mode:
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx52
-rw-r--r--ucb/source/ucp/cmis/cmis_url.hxx12
2 files changed, 52 insertions, 12 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
{
diff --git a/ucb/source/ucp/cmis/cmis_url.hxx b/ucb/source/ucp/cmis/cmis_url.hxx
index 56b1fc876859..14a32c00ca72 100644
--- a/ucb/source/ucp/cmis/cmis_url.hxx
+++ b/ucb/source/ucp/cmis/cmis_url.hxx
@@ -30,12 +30,12 @@ namespace cmis
public:
explicit URL( OUString const & urlStr );
- OUString& getObjectPath( ) { return m_sPath; }
- OUString& getObjectId( ) { return m_sId; }
- OUString& getBindingUrl( ) { return m_sBindingUrl; }
- OUString& getRepositoryId( ) { return m_sRepositoryId; }
- OUString& getUsername( ) { return m_sUser; }
- OUString& getPassword( ) { return m_sPass; }
+ const OUString& getObjectPath() const { return m_sPath; }
+ const OUString& getObjectId() const { return m_sId; }
+ const OUString& getBindingUrl() const { return m_sBindingUrl; }
+ const OUString& getRepositoryId() const { return m_sRepositoryId; }
+ const OUString& getUsername() const { return m_sUser; }
+ const OUString& getPassword() const { return m_sPass; }
void setObjectPath( const OUString& sPath );
void setObjectId( const OUString& sId );