[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 5 commits - libcmis/boost-win.patch libcmis/makefile.mk ooo.lst.in ucb/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Wed Jun 27 01:17:19 PDT 2012


 libcmis/boost-win.patch               |   20 -
 libcmis/makefile.mk                   |    7 
 ooo.lst.in                            |    2 
 ucb/source/ucp/cmis/cmis_content.cxx  |  462 +++++++++++++++++++---------------
 ucb/source/ucp/cmis/cmis_content.hxx  |    2 
 ucb/source/ucp/cmis/cmis_provider.cxx |    6 
 6 files changed, 277 insertions(+), 222 deletions(-)

New commits:
commit fb6578d4cddf031f9c331536f353707c92b9666b
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Tue Jun 26 16:28:21 2012 +0200

    CMIS UCP: Use the URL host as ID for cached sessions
    
    Using the binding URL as ID for the cached sessions is bad as there may
    be several repositories on the same binding URL... which means different
    libcmis::Session objects.
    
    Change-Id: Id3605ee4fdfbfc32b72615fb573220e94c8748af

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index bb6e1a0..59febd9 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -162,13 +162,14 @@ namespace cmis
         m_sURL = m_xIdentifier->getContentIdentifier( );
         cmis::URL url( m_sURL );
 
-        // Look for a cached session
-        m_pSession = pProvider->getSession( url.getBindingUrl( ) );
+        // Look for a cached session, key is binding url + repo id
+        INetURLObject aUrlObj( m_sURL );
+        m_pSession = pProvider->getSession( aUrlObj.GetHost( ) );
         if ( NULL == m_pSession )
         {
             // Initiate a CMIS session and register it as we found nothing
             m_pSession = libcmis::SessionFactory::createSession( url.getSessionParams( ) );
-            pProvider->registerSession( url.getBindingUrl( ), m_pSession );
+            pProvider->registerSession( aUrlObj.GetHost( ), m_pSession );
         }
 
         m_sObjectPath = url.getObjectPath( );
diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx
index a13e9f7..f65a1ca 100644
--- a/ucb/source/ucp/cmis/cmis_provider.cxx
+++ b/ucb/source/ucp/cmis/cmis_provider.cxx
@@ -88,16 +88,10 @@ ContentProvider::ContentProvider(
     const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
 : ::ucbhelper::ContentProviderImplHelper( rSMgr )
 {
-#if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "ContentProvider::ContentProvider( )\n" );
-#endif
 }
 
 ContentProvider::~ContentProvider()
 {
-#if OSL_DEBUG_LEVEL > 1
-    fprintf(stderr, "ContentProvider::~ContentProvider( )\n" );
-#endif
 }
 
 XINTERFACE_IMPL_3( ContentProvider,
commit 5d41f72f8edf880c496831078fadf1f72ece9251
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Tue Jun 26 13:29:53 2012 +0200

    libcmis: forgot to update windows patch for 0.2.3
    
    Change-Id: I7ea63acbe2f75f1e53611d75a6adc14c2bcac887

diff --git a/libcmis/boost-win.patch b/libcmis/boost-win.patch
index fde29df..b794787 100644
--- a/libcmis/boost-win.patch
+++ b/libcmis/boost-win.patch
@@ -1,5 +1,5 @@
---- misc/libcmis-0.2.2/src/libcmis/atom-object.cxx	2012-06-01 07:44:26.000000000 -0600
-+++ misc/build/libcmis-0.2.2/src/libcmis/atom-object.cxx	2012-06-04 07:52:24.131190200 -0600
+--- misc/libcmis-0.2.3/src/libcmis/atom-object.cxx	2012-06-01 07:44:26.000000000 -0600
++++ misc/build/libcmis-0.2.3/src/libcmis/atom-object.cxx	2012-06-04 07:52:24.131190200 -0600
 @@ -29,6 +29,9 @@
  #include <algorithm>
  #include <sstream>
@@ -10,8 +10,8 @@
  #include <boost/date_time/posix_time/posix_time.hpp>
  
  #include "atom-object.hxx"
---- misc/libcmis-0.2.2/src/libcmis/object.hxx	2012-06-01 07:38:36.000000000 -0600
-+++ misc/build/libcmis-0.2.2/src/libcmis/object.hxx	2012-06-04 07:52:21.900386200 -0600
+--- misc/libcmis-0.2.3/src/libcmis/object.hxx	2012-06-01 07:38:36.000000000 -0600
++++ misc/build/libcmis-0.2.3/src/libcmis/object.hxx	2012-06-04 07:52:21.900386200 -0600
 @@ -32,6 +32,9 @@
  #include <map>
  #include <string>
@@ -22,8 +22,8 @@
  #include <boost/date_time.hpp>
  #include <boost/shared_ptr.hpp>
  
---- misc/libcmis-0.2.2/src/libcmis/property-type.hxx	2012-02-17 08:00:50.000000000 -0700
-+++ misc/build/libcmis-0.2.2/src/libcmis/property-type.hxx	2012-06-04 07:52:17.157977900 -0600
+--- misc/libcmis-0.2.3/src/libcmis/property-type.hxx	2012-02-17 08:00:50.000000000 -0700
++++ misc/build/libcmis-0.2.3/src/libcmis/property-type.hxx	2012-06-04 07:52:17.157977900 -0600
 @@ -28,6 +28,9 @@
  #ifndef _PROPERTY_TYPE_HXX_
  #define _PROPERTY_TYPE_HXX_
@@ -34,8 +34,8 @@
  #include <boost/date_time.hpp>
  #include <libxml/tree.h>
  
---- misc/libcmis-0.2.2/src/libcmis/property.hxx	2012-02-17 06:38:33.000000000 -0700
-+++ misc/build/libcmis-0.2.2/src/libcmis/property.hxx	2012-06-04 07:52:19.388781800 -0600
+--- misc/libcmis-0.2.3/src/libcmis/property.hxx	2012-02-17 06:38:33.000000000 -0700
++++ misc/build/libcmis-0.2.3/src/libcmis/property.hxx	2012-06-04 07:52:19.388781800 -0600
 @@ -31,6 +31,9 @@
  #include <libxml/tree.h>
  #include <libxml/xmlwriter.h>
@@ -46,8 +46,8 @@
  #include <boost/date_time.hpp>
  #include <boost/shared_ptr.hpp>
  
---- misc/libcmis-0.2.2/src/libcmis/xml-utils.hxx	2012-05-30 06:17:12.000000000 -0600
-+++ misc/build/libcmis-0.2.2/src/libcmis/xml-utils.hxx	2012-06-04 07:52:10.621566400 -0600
+--- misc/libcmis-0.2.3/src/libcmis/xml-utils.hxx	2012-05-30 06:17:12.000000000 -0600
++++ misc/build/libcmis-0.2.3/src/libcmis/xml-utils.hxx	2012-06-04 07:52:10.621566400 -0600
 @@ -30,6 +30,9 @@
  
  #include <string>
commit 0189febb3af57beb08982bb3a0b84ab6d89cb2a6
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Tue Jun 26 12:49:09 2012 +0200

    cmisucp: catch the exception when getting CMIS object
    
    Fixes crashers like the one when cancelling authentication request.
    The error message are still not meaningful for the user, but this would
    require libcmis API changes.
    
    Change-Id: I22afbf4d39522a2b0dbd043a68dfef2b9308dcec

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index 9159c64..bb6e1a0 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -209,25 +209,18 @@ namespace cmis
     {
     }
 
-    libcmis::ObjectPtr Content::getObject( )
+    libcmis::ObjectPtr Content::getObject( ) throw ( libcmis::Exception )
     {
-        try
+        if ( !m_pObject.get() )
         {
-            if ( !m_pObject.get() )
+            if ( !m_sObjectPath.isEmpty( ) )
+                m_pObject = m_pSession->getObjectByPath( OUSTR_TO_STDSTR( m_sObjectPath ) );
+            else
             {
-                if ( !m_sObjectPath.isEmpty( ) )
-                    m_pObject = m_pSession->getObjectByPath( OUSTR_TO_STDSTR( m_sObjectPath ) );
-                else
-                {
-                    m_pObject = m_pSession->getRootFolder( );
-                    m_sObjectPath = "/";
-                }
+                m_pObject = m_pSession->getRootFolder( );
+                m_sObjectPath = "/";
             }
         }
-        catch ( const libcmis::Exception& e )
-        {
-            SAL_INFO( "cmisucp", "Unexpected exception: " << e.what() );
-        }
 
         return m_pObject;
     }
@@ -240,8 +233,21 @@ namespace cmis
 
     bool Content::isFolder(const uno::Reference< ucb::XCommandEnvironment >& xEnv )
     {
-        resetAuthProvider( xEnv );
-        return getObject( )->getBaseType( ) == "cmis:folder";
+        bool bIsFolder = false;
+        try
+        {
+            resetAuthProvider( xEnv );
+            bIsFolder = getObject( )->getBaseType( ) == "cmis:folder";
+        }
+        catch ( const libcmis::Exception& e )
+        {
+            ucbhelper::cancelCommandExecution(
+                                ucb::IOErrorCode_GENERAL,
+                                uno::Sequence< uno::Any >( 0 ),
+                                xEnv,
+                                rtl::OUString::createFromAscii( e.what() ) );
+        }
+        return bIsFolder;
     }
 
     uno::Any Content::getBadArgExcept()
@@ -267,111 +273,122 @@ namespace cmis
 
         for( sal_Int32 n = 0; n < nProps; ++n )
         {
-            const beans::Property& rProp = pProps[ n ];
-
-            if ( rProp.Name == "IsDocument" )
-            {
-                if ( getObject( ).get( ) )
-                    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 );
-            }
-            else if ( rProp.Name == "IsFolder" )
-            {
-                if ( getObject( ).get( ) )
-                    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 );
-            }
-            else if ( rProp.Name == "Title" )
+            try
             {
-                rtl::OUString sTitle;
-                if ( getObject().get() )
-                    sTitle = rtl::OUString::createFromAscii( getObject()->getName().c_str( ) );
-                else if ( m_pObjectProps.size() > 0 )
+                const beans::Property& rProp = pProps[ n ];
+
+                if ( rProp.Name == "IsDocument" )
                 {
-                    map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
-                    if ( it != m_pObjectProps.end( ) )
+                    if ( getObject( ).get( ) )
+                        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 );
+                }
+                else if ( rProp.Name == "IsFolder" )
+                {
+                    if ( getObject( ).get( ) )
+                        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 );
+                }
+                else if ( rProp.Name == "Title" )
+                {
+                    rtl::OUString sTitle;
+                    if ( getObject().get() )
+                        sTitle = rtl::OUString::createFromAscii( getObject()->getName().c_str( ) );
+                    else if ( m_pObjectProps.size() > 0 )
                     {
-                        vector< string > values = it->second->getStrings( );
-                        if ( values.size() > 0 )
-                            sTitle = rtl::OUString::createFromAscii( values.front( ).c_str( ) );
+                        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 = rtl::OUString::createFromAscii( values.front( ).c_str( ) );
+                        }
                     }
-                }
 
-                // Nothing worked... get it from the path
-                if ( sTitle.isEmpty( ) )
-                {
-                    rtl::OUString sPath = m_sObjectPath;
+                    // Nothing worked... get it from the path
+                    if ( sTitle.isEmpty( ) )
+                    {
+                        rtl::OUString sPath = m_sObjectPath;
 
-                    // Get rid of the trailing slash problem
-                    if ( sPath[ sPath.getLength( ) - 1 ] == '/' )
-                        sPath = sPath.copy( 0, sPath.getLength() - 1 );
+                        // Get rid of the trailing slash problem
+                        if ( sPath[ sPath.getLength( ) - 1 ] == '/' )
+                            sPath = sPath.copy( 0, sPath.getLength() - 1 );
 
-                    // Get the last segment
-                    sal_Int32 nPos = sPath.lastIndexOf( '/' );
-                    if ( nPos >= 0 )
-                        sTitle = sPath.copy( nPos + 1 );
-                }
+                        // Get the last segment
+                        sal_Int32 nPos = sPath.lastIndexOf( '/' );
+                        if ( nPos >= 0 )
+                            sTitle = sPath.copy( nPos + 1 );
+                    }
 
-                if ( !sTitle.isEmpty( ) )
-                    xRow->appendString( rProp, sTitle );
-                else
-                    xRow->appendVoid( rProp );
-            }
-            else if ( rProp.Name == "TitleOnServer" )
-            {
-                string path;
-                if ( getObject().get( ) )
-                {
-                    vector< string > paths = getObject( )->getPaths( );
-                    if ( paths.size( ) > 0 )
-                        path = paths.front( );
+                    if ( !sTitle.isEmpty( ) )
+                        xRow->appendString( rProp, sTitle );
                     else
-                        path = getObject()->getName( );
+                        xRow->appendVoid( rProp );
+                }
+                else if ( rProp.Name == "TitleOnServer" )
+                {
+                    string path;
+                    if ( getObject().get( ) )
+                    {
+                        vector< string > paths = getObject( )->getPaths( );
+                        if ( paths.size( ) > 0 )
+                            path = paths.front( );
+                        else
+                            path = getObject()->getName( );
 
-                    xRow->appendString( rProp, rtl::OUString::createFromAscii( path.c_str() ) );
+                        xRow->appendString( rProp, rtl::OUString::createFromAscii( path.c_str() ) );
+                    }
+                    else
+                        xRow->appendVoid( rProp );
                 }
-                else
-                    xRow->appendVoid( rProp );
-            }
-            else if ( rProp.Name == "IsReadOnly" )
-            {
-                boost::shared_ptr< libcmis::AllowableActions > allowableActions = getObject()->getAllowableActions( );
-                sal_Bool bReadOnly = sal_False;
-                if ( allowableActions->isAllowed( libcmis::ObjectAction::SetContentStream ) )
-                    bReadOnly = sal_True;
+                else if ( rProp.Name == "IsReadOnly" )
+                {
+                    boost::shared_ptr< libcmis::AllowableActions > allowableActions = getObject()->getAllowableActions( );
+                    sal_Bool bReadOnly = sal_False;
+                    if ( allowableActions->isAllowed( libcmis::ObjectAction::SetContentStream ) )
+                        bReadOnly = sal_True;
 
-                xRow->appendBoolean( rProp, bReadOnly );
-            }
-            else if ( rProp.Name == "DateCreated" )
-            {
-                util::DateTime aTime = lcl_boostToUnoTime( getObject( )->getCreationDate( ) );
-                xRow->appendTimestamp( rProp, aTime );
-            }
-            else if ( rProp.Name == "DateModified" )
-            {
-                util::DateTime aTime = lcl_boostToUnoTime( getObject( )->getLastModificationDate( ) );
-                xRow->appendTimestamp( rProp, aTime );
-            }
-            else if ( rProp.Name == "Size" )
-            {
-                libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) );
-                if ( NULL != document )
-                    xRow->appendLong( rProp, document->getContentLength() );
+                    xRow->appendBoolean( rProp, bReadOnly );
+                }
+                else if ( rProp.Name == "DateCreated" )
+                {
+                    util::DateTime aTime = lcl_boostToUnoTime( getObject( )->getCreationDate( ) );
+                    xRow->appendTimestamp( rProp, aTime );
+                }
+                else if ( rProp.Name == "DateModified" )
+                {
+                    util::DateTime aTime = lcl_boostToUnoTime( getObject( )->getLastModificationDate( ) );
+                    xRow->appendTimestamp( rProp, aTime );
+                }
+                else if ( rProp.Name == "Size" )
+                {
+                    libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get( ) );
+                    if ( NULL != document )
+                        xRow->appendLong( rProp, document->getContentLength() );
+                    else
+                        xRow->appendVoid( rProp );
+                }
+                else if ( rProp.Name == "CreatableContentsInfo" )
+                {
+                    xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
+                }
                 else
-                    xRow->appendVoid( rProp );
+                    SAL_INFO( "cmisucp", "Looking for unsupported property " << rProp.Name );
             }
-            else if ( rProp.Name == "CreatableContentsInfo" )
+            catch ( const libcmis::Exception& e )
             {
-                xRow->appendObject( rProp, uno::makeAny( queryCreatableContentsInfo( xEnv ) ) );
+                ucbhelper::cancelCommandExecution(
+                                    ucb::IOErrorCode_GENERAL,
+                                    uno::Sequence< uno::Any >( 0 ),
+                                    xEnv,
+                                    rtl::OUString::createFromAscii( e.what() ) );
             }
-            else
-                SAL_INFO( "cmisucp", "Looking for unsupported property " << rProp.Name );
         }
 
         return uno::Reference< sdbc::XRow >( xRow.get() );
@@ -504,105 +521,106 @@ namespace cmis
                 xEnv );
         }
 
-        try
+        // For transient content, the URL is the one of the parent
+        if ( m_bTransient )
         {
-            // For transient content, the URL is the one of the parent
-            if ( m_bTransient )
+            rtl::OUString sNewPath;
+
+            // Try to get the object from the server if there is any
+            libcmis::Folder* pFolder = NULL;
+            try
             {
-                rtl::OUString sNewPath;
+                pFolder = dynamic_cast< libcmis::Folder* >( getObject( ).get( ) );
+            }
+            catch ( const libcmis::Exception& )
+            {
+            }
+
+            if ( pFolder != NULL )
+            {
+                map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
+                if ( it == m_pObjectProps.end( ) )
+                {
+                    ucbhelper::cancelCommandExecution( uno::makeAny
+                        ( uno::RuntimeException( "Missing name property",
+                            static_cast< cppu::OWeakObject * >( this ) ) ),
+                        xEnv );
+                }
+                string newName = it->second->getStrings( ).front( );
+                string newPath = pFolder->getPath( );
+                if ( newPath[ newPath.size( ) - 1 ] != '/' )
+                    newPath += "/";
+                newPath += newName;
+
+                libcmis::ObjectPtr object;
+                try
+                {
+                    object = m_pSession->getObjectByPath( newPath );
+                    sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
+                }
+                catch ( const libcmis::Exception& )
+                {
+                    // Nothing matched the path
+                }
 
-                // Try to get the object from the server if there is any
-                libcmis::Folder* pFolder = dynamic_cast< libcmis::Folder* >( getObject( ).get( ) );
-                if ( pFolder != NULL )
+                if ( NULL != object.get( ) )
                 {
-                    map< string, libcmis::PropertyPtr >::iterator it = m_pObjectProps.find( "cmis:name" );
-                    if ( it == m_pObjectProps.end( ) )
+                    // Are the base type matching?
+                    if ( object->getBaseType( ) != m_pObjectType->getBaseType( )->getId() )
                     {
                         ucbhelper::cancelCommandExecution( uno::makeAny
-                            ( uno::RuntimeException( "Missing name property",
+                            ( uno::RuntimeException( "Can't change a folder into a document and vice-versa.",
                                 static_cast< cppu::OWeakObject * >( this ) ) ),
                             xEnv );
                     }
-                    string newName = it->second->getStrings( ).front( );
-                    string newPath = pFolder->getPath( );
-                    if ( newPath[ newPath.size( ) - 1 ] != '/' )
-                        newPath += "/";
-                    newPath += newName;
-
-                    libcmis::ObjectPtr object;
-                    try
-                    {
-                        object = m_pSession->getObjectByPath( newPath );
-                        sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
-                    }
-                    catch ( const libcmis::Exception& )
+
+                    // Update the existing object if it's a document
+                    libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get( ) );
+                    if ( NULL != document )
                     {
-                        // Nothing matched the path
+                        boost::shared_ptr< ostream > pOut( new ostringstream ( ios_base::binary | ios_base::in | ios_base::out ) );
+                        uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut );
+                        copyData( xInputStream, xOutput );
+                        document->setContentStream( pOut, string( ), bReplaceExisting );
                     }
+                }
+                else
+                {
+                    // We need to create a brand new object... either folder or document
+                    bool bIsFolder = m_pObjectType->getBaseType( )->getId( ) == "cmis:folder";
+                    setCmisProperty( "cmis:objectTypeId", m_pObjectType->getId( ) );
 
-                    if ( NULL != object.get( ) )
+                    if ( bIsFolder )
                     {
-                        // Are the base type matching?
-                        if ( object->getBaseType( ) != m_pObjectType->getBaseType( )->getId() )
-                        {
-                            ucbhelper::cancelCommandExecution( uno::makeAny
-                                ( uno::RuntimeException( "Can't change a folder into a document and vice-versa.",
-                                    static_cast< cppu::OWeakObject * >( this ) ) ),
-                                xEnv );
-                        }
-
-                        // Update the existing object if it's a document
-                        libcmis::Document* document = dynamic_cast< libcmis::Document* >( object.get( ) );
-                        if ( NULL != document )
-                        {
-                            boost::shared_ptr< ostream > pOut( new ostringstream ( ios_base::binary | ios_base::in | ios_base::out ) );
-                            uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut );
-                            copyData( xInputStream, xOutput );
-                            document->setContentStream( pOut, string( ), bReplaceExisting );
-                        }
+                        libcmis::FolderPtr pNew = pFolder->createFolder( m_pObjectProps );
+                        sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
                     }
                     else
                     {
-                        // We need to create a brand new object... either folder or document
-                        bool bIsFolder = m_pObjectType->getBaseType( )->getId( ) == "cmis:folder";
-                        setCmisProperty( "cmis:objectTypeId", m_pObjectType->getId( ) );
-
-                        if ( bIsFolder )
-                        {
-                            libcmis::FolderPtr pNew = pFolder->createFolder( m_pObjectProps );
-                            sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
-                        }
-                        else
-                        {
-                            boost::shared_ptr< ostream > pOut( new ostringstream ( ios_base::binary | ios_base::in | ios_base::out ) );
-                            uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut );
-                            copyData( xInputStream, xOutput );
-                            libcmis::DocumentPtr pNew = pFolder->createDocument( m_pObjectProps, pOut, string() );
-                            sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
-                        }
+                        boost::shared_ptr< ostream > pOut( new ostringstream ( ios_base::binary | ios_base::in | ios_base::out ) );
+                        uno::Reference < io::XOutputStream > xOutput = new ucbhelper::StdOutputStream( pOut );
+                        copyData( xInputStream, xOutput );
+                        libcmis::DocumentPtr pNew = pFolder->createDocument( m_pObjectProps, pOut, string() );
+                        sNewPath = rtl::OUString::createFromAscii( newPath.c_str( ) );
                     }
+                }
 
-                    if ( !sNewPath.isEmpty( ) )
-                    {
-                        // Update the current content: it's no longer transient
-                        m_sObjectPath = sNewPath;
-                        URL aUrl( m_sURL );
-                        aUrl.setObjectPath( m_sObjectPath );
-                        m_sURL = aUrl.asString( );
-                        m_pObject.reset( );
-                        m_pObjectType.reset( );
-                        m_pObjectProps.clear( );
-                        m_bTransient = false;
-
-                        inserted();
-                    }
+                if ( !sNewPath.isEmpty( ) )
+                {
+                    // Update the current content: it's no longer transient
+                    m_sObjectPath = sNewPath;
+                    URL aUrl( m_sURL );
+                    aUrl.setObjectPath( m_sObjectPath );
+                    m_sURL = aUrl.asString( );
+                    m_pObject.reset( );
+                    m_pObjectType.reset( );
+                    m_pObjectProps.clear( );
+                    m_bTransient = false;
+
+                    inserted();
                 }
             }
         }
-        catch ( const libcmis::Exception& e )
-        {
-            throw uno::Exception( rtl::OUString::createFromAscii( e.what( ) ), *this );
-        }
     }
 
     const int TRANSFER_BUFFER_SIZE = 65536;
@@ -621,13 +639,24 @@ namespace cmis
 
     uno::Sequence< uno::Any > Content::setPropertyValues(
             const uno::Sequence< beans::PropertyValue >& rValues,
-            const uno::Reference< ucb::XCommandEnvironment >& )
+            const uno::Reference< ucb::XCommandEnvironment >& xEnv )
     {
-        // Get the already set properties if possible
-        if ( !m_bTransient && getObject( ).get( ) )
+        try
+        {
+            // Get the already set properties if possible
+            if ( !m_bTransient && getObject( ).get( ) )
+            {
+                m_pObjectProps = getObject()->getProperties( );
+                m_pObjectType = getObject()->getTypeDescription();
+            }
+        }
+        catch ( const libcmis::Exception& e )
         {
-            m_pObjectProps = getObject()->getProperties( );
-            m_pObjectType = getObject()->getTypeDescription();
+            ucbhelper::cancelCommandExecution(
+                                ucb::IOErrorCode_GENERAL,
+                                uno::Sequence< uno::Any >( 0 ),
+                                xEnv,
+                                rtl::OUString::createFromAscii( e.what() ) );
         }
 
         sal_Int32 nCount = rValues.getLength();
@@ -681,16 +710,27 @@ namespace cmis
             }
         }
 
-        if ( !m_bTransient && bChanged )
+        try
         {
-            getObject()->updateProperties();
+            if ( !m_bTransient && bChanged )
+            {
+                getObject()->updateProperties();
+            }
+        }
+        catch ( const libcmis::Exception& e )
+        {
+            ucbhelper::cancelCommandExecution(
+                                ucb::IOErrorCode_GENERAL,
+                                uno::Sequence< uno::Any >( 0 ),
+                                xEnv,
+                                rtl::OUString::createFromAscii( e.what() ) );
         }
 
         return aRet;
     }
 
     sal_Bool Content::feedSink( uno::Reference< uno::XInterface> xSink,
-        const uno::Reference< ucb::XCommandEnvironment >& /*xEnv*/ )
+        const uno::Reference< ucb::XCommandEnvironment >& xEnv )
     {
         if ( !xSink.is() )
             return sal_False;
@@ -705,17 +745,28 @@ namespace cmis
         if ( xDataStreamer.is() && !xOut.is() )
             xOut = xDataStreamer->getStream()->getOutputStream();
 
-        libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get() );
-        boost::shared_ptr< istream > aIn = document->getContentStream( );
+        try
+        {
+            libcmis::Document* document = dynamic_cast< libcmis::Document* >( getObject().get() );
+            boost::shared_ptr< istream > aIn = document->getContentStream( );
 
-        uno::Reference< io::XInputStream > xIn = new ucbhelper::StdInputStream( aIn );
-        if( !xIn.is( ) )
-            return sal_False;
+            uno::Reference< io::XInputStream > xIn = new ucbhelper::StdInputStream( aIn );
+            if( !xIn.is( ) )
+                return sal_False;
 
-        if ( xDataSink.is() )
-            xDataSink->setInputStream( xIn );
-        else if ( xOut.is() )
-            copyData( xIn, xOut );
+            if ( xDataSink.is() )
+                xDataSink->setInputStream( xIn );
+            else if ( xOut.is() )
+                copyData( xIn, xOut );
+        }
+        catch ( const libcmis::Exception& e )
+        {
+            ucbhelper::cancelCommandExecution(
+                                ucb::IOErrorCode_GENERAL,
+                                uno::Sequence< uno::Any >( 0 ),
+                                xEnv,
+                                rtl::OUString::createFromAscii( e.what() ) );
+        }
 
         return sal_True;
     }
@@ -814,7 +865,7 @@ namespace cmis
         return uno::Sequence< ucb::CommandInfo >(aCommandInfoTable, isFolder(xEnv) ? nProps : nProps - 2);
     }
 
-    ::rtl::OUString Content::getParentURL()
+    ::rtl::OUString Content::getParentURL( )
     {
         rtl::OUString sRet;
 
@@ -966,10 +1017,11 @@ namespace cmis
             }
             catch ( const libcmis::Exception& e )
             {
-                ucbhelper::cancelCommandExecution( uno::makeAny
-                    ( uno::RuntimeException( rtl::OUString::createFromAscii( e.what() ),
-                        static_cast< cppu::OWeakObject * >( this ) ) ),
-                    xEnv );
+                ucbhelper::cancelCommandExecution(
+                                    ucb::IOErrorCode_GENERAL,
+                                    uno::Sequence< uno::Any >( 0 ),
+                                    xEnv,
+                                    rtl::OUString::createFromAscii( e.what() ) );
             }
         }
         else
diff --git a/ucb/source/ucp/cmis/cmis_content.hxx b/ucb/source/ucp/cmis/cmis_content.hxx
index 21ec1d1..e98c88d 100644
--- a/ucb/source/ucp/cmis/cmis_content.hxx
+++ b/ucb/source/ucp/cmis/cmis_content.hxx
@@ -189,7 +189,7 @@ public:
         queryCreatableContentsInfo( const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xEnv )
                 throw( com::sun::star::uno::RuntimeException );
 
-    libcmis::ObjectPtr getObject( );
+    libcmis::ObjectPtr getObject( ) throw ( libcmis::Exception );
 };
 
 }
commit 498d220b1bb8514b4ca45ff85c5d5f46aa59cb0c
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Mon Jun 25 11:16:10 2012 +0200

    libcmis: updated to 0.2.3
    
    Among the useful fixes:
     * SharePoint fixes
     * Base64 encoding fixed
    
    Change-Id: Ic39a8d7ef9e9e19d5e0e37b6bfe86d0b2ba1bece

diff --git a/libcmis/makefile.mk b/libcmis/makefile.mk
index f3416ae..37e4f6b 100644
--- a/libcmis/makefile.mk
+++ b/libcmis/makefile.mk
@@ -41,11 +41,8 @@ TARGET=cmis
     @echo "Using system libcmis..."
 .ENDIF
 
-TARFILE_NAME=libcmis-0.2.2
-TARFILE_MD5=ce31ac7b92cb5e66459f67213bbb6168
-
-# Fixed for 0.2.3
-PATCH_FILES+=libcurl-version-fix.patch
+TARFILE_NAME=libcmis-0.2.3
+TARFILE_MD5=0d2dcdfbf28d6208751b33057f5361f0
 
 .IF "$(OS)$(COM)" == "WNTMSC"
 PATCH_FILES+=boost-win.patch
diff --git a/ooo.lst.in b/ooo.lst.in
index 23d56e4..af2f073 100644
--- a/ooo.lst.in
+++ b/ooo.lst.in
@@ -88,7 +88,7 @@ f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2
 3bf481ca95109b14435125c0dd1f2217-graphite2-1.0.3.tgz
 a9a1db27688bad49418667b434d29c1f-libvisio-0.0.18.tar.bz2
 e7a384790b13c29113e22e596ade9687-LinLibertineG-20120116.zip
-ce31ac7b92cb5e66459f67213bbb6168-libcmis-0.2.2.tar.gz
+0d2dcdfbf28d6208751b33057f5361f0-libcmis-0.2.3.tar.gz
 ce5a1def34578b75959ac31210f031f6-libcdr-0.0.8.tar.bz2
 327348d67c979c88c2dec59a23a17d85-lcms2-2.3.tar.gz
 @GOOGLE_DOCS_EXTENSION_PACK@
commit 056d7ff48c5485bce52063a0a7ade1fb9e6938b7
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Tue Jun 5 13:00:06 2012 +0200

    CMIS UCP: fixed Save As into a CMIS repo
    
    Change-Id: I8ab65f917e9442f8871a39d7d25a63336065bee6

diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index b25e1ac..9159c64 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -271,20 +271,26 @@ namespace cmis
 
             if ( rProp.Name == "IsDocument" )
             {
-                if ( getObject()->getBaseType( ) == "cmis:document" )
-                    xRow->appendBoolean( rProp, true );
+                if ( getObject( ).get( ) )
+                    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 );
             }
             else if ( rProp.Name == "IsFolder" )
             {
-                sal_Bool bFolder = getObject()->getBaseType( ) == "cmis:folder";
-                xRow->appendBoolean( rProp, bFolder );
+                if ( getObject( ).get( ) )
+                    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 );
             }
             else if ( rProp.Name == "Title" )
             {
                 rtl::OUString sTitle;
-                if ( getObject() )
+                if ( getObject().get() )
                     sTitle = rtl::OUString::createFromAscii( getObject()->getName().c_str( ) );
                 else if ( m_pObjectProps.size() > 0 )
                 {
@@ -308,7 +314,7 @@ namespace cmis
 
                     // Get the last segment
                     sal_Int32 nPos = sPath.lastIndexOf( '/' );
-                    if ( nPos > 0 )
+                    if ( nPos >= 0 )
                         sTitle = sPath.copy( nPos + 1 );
                 }
 
@@ -320,13 +326,18 @@ namespace cmis
             else if ( rProp.Name == "TitleOnServer" )
             {
                 string path;
-                vector< string > paths = getObject( )->getPaths( );
-                if ( paths.size( ) > 0 )
-                    path = paths.front( );
-                else
-                    path = getObject()->getName( );
+                if ( getObject().get( ) )
+                {
+                    vector< string > paths = getObject( )->getPaths( );
+                    if ( paths.size( ) > 0 )
+                        path = paths.front( );
+                    else
+                        path = getObject()->getName( );
 
-                xRow->appendString( rProp, rtl::OUString::createFromAscii( path.c_str() ) );
+                    xRow->appendString( rProp, rtl::OUString::createFromAscii( path.c_str() ) );
+                }
+                else
+                    xRow->appendVoid( rProp );
             }
             else if ( rProp.Name == "IsReadOnly" )
             {


More information about the Libreoffice-commits mailing list