Commits

Anonymous committed 186d4d1

#i114622# - Fixed wrong arguments for InteractiveLockingLockedExceptions-

Comments (0)

Files changed (1)

ucb/source/ucp/webdav/webdavcontent.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
     std::auto_ptr< ContentProperties > xProps;
     std::auto_ptr< ContentProperties > xCachedProps;
     std::auto_ptr< DAVResourceAccess > xResAccess;
-    rtl::OUString aEscapedTitle;
+    rtl::OUString aUnescapedTitle;
     bool bHasAll = false;
     uno::Reference< lang::XMultiServiceFactory > xSMgr;
     uno::Reference< ucb::XContentIdentifier > xIdentifier;
     {
         osl::Guard< osl::Mutex > aGuard( m_aMutex );
 
-        aEscapedTitle = NeonUri::unescape( m_aEscapedTitle );
+        aUnescapedTitle = NeonUri::unescape( m_aEscapedTitle );
         xSMgr.set( m_xSMgr );
         xIdentifier.set( m_xIdentifier );
         xProvider.set( m_xProvider.get() );
                         if ( m_eResourceType == NON_DAV )
                             xProps->addProperties( aMissingProps,
                                                    ContentProperties(
-                                                       aEscapedTitle,
+                                                       aUnescapedTitle,
                                                        false ) );
                     }
                     catch ( DAVException const & e )
         // might trigger HTTP redirect.
         // Therefore, title must be updated here.
         NeonUri aUri( xResAccess->getURL() );
-        aEscapedTitle = aUri.GetPathBaseName();
-
-        if ( UNKNOWN == rType )
+        aUnescapedTitle = aUri.GetPathBaseNameUnescaped();
+
+        if ( rType == UNKNOWN )
         {
-            xProps.reset( new ContentProperties( aEscapedTitle ) );
+            xProps.reset( new ContentProperties( aUnescapedTitle ) );
         }
 
         // For DAV resources we only know the Title, for non-DAV
         // resources we additionally know that it is a document.
-        if ( DAV == rType  )
+        else if ( rType == DAV )
         {
             //xProps.reset(
-            //    new ContentProperties( aEscapedTitle ) );
+            //    new ContentProperties( aUnescapedTitle ) );
             xProps->addProperty(
                 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
-                uno::makeAny( aEscapedTitle ),
+                uno::makeAny( aUnescapedTitle ),
                 true );
         }
         else
         {
             if ( !xProps.get() )
-                xProps.reset( new ContentProperties( aEscapedTitle, false ) );
+                xProps.reset( new ContentProperties( aUnescapedTitle, false ) );
             else
                 xProps->addProperty(
                     rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ),
-                    uno::makeAny( aEscapedTitle ),
+                    uno::makeAny( aUnescapedTitle ),
                     true );
 
             xProps->addProperty(
         // No server access for just created (not yet committed) objects.
         // Only a minimal set of properties supported at this stage.
         if (m_bTransient)
-            xProps.reset( new ContentProperties( aEscapedTitle,
+            xProps.reset( new ContentProperties( aUnescapedTitle,
                                                  m_bCollection ) );
     }
 
             m_xCachedProps->addProperties( *xProps.get() );
 
         m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) );
-        m_aEscapedTitle = aEscapedTitle;
+        m_aEscapedTitle = NeonUri::escapeSegment( aUnescapedTitle );
     }
 
     return xResultRow;
     // Map DAVException...
     uno::Any aException;
 
+    rtl::OUString aURL;
+    if ( m_bTransient )
+    {
+        aURL = getParentURL();
+        if ( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ) )
+            aURL += rtl::OUString::createFromAscii( "/" );
+
+        aURL += m_aEscapedTitle;
+    }
+    else
+    {
+        aURL = m_xIdentifier->getContentIdentifier();
+    }
+
     switch ( e.getStatus() )
     {
         case SC_NOT_FOUND:
             uno::Sequence< uno::Any > aArgs( 1 );
             aArgs[ 0 ] <<= beans::PropertyValue(
                 rtl::OUString::createFromAscii("Uri"), -1,
-                uno::makeAny(m_xIdentifier->getContentIdentifier()),
+                uno::makeAny(aURL),
                 beans::PropertyState_DIRECT_VALUE);
 
             aException <<=
                 rtl::OUString::createFromAscii( "Locked!" ),
                 static_cast< cppu::OWeakObject * >( this ),
                 task::InteractionClassification_ERROR,
-                m_xIdentifier->getContentIdentifier(),
-                sal_True );
+                aURL,
+                sal_False ); // not SelfOwned
 #else
         {
             uno::Sequence< uno::Any > aArgs( 1 );
             aArgs[ 0 ] <<= beans::PropertyValue(
                 rtl::OUString::createFromAscii("Uri"), -1,
-                uno::makeAny(m_xIdentifier->getContentIdentifier()),
+                uno::makeAny(aURL),
                 beans::PropertyState_DIRECT_VALUE);
 
             aException <<=
                 rtl::OUString::createFromAscii( "Locked (self)!" ),
                 static_cast< cppu::OWeakObject * >( this ),
                 task::InteractionClassification_ERROR,
-                m_xIdentifier->getContentIdentifier(),
-                sal_True );
+                aURL,
+                sal_True ); // SelfOwned
         break;
 
     case DAVException::DAV_NOT_LOCKED:
                 rtl::OUString::createFromAscii( "Not locked!" ),
                 static_cast< cppu::OWeakObject * >( this ),
                 task::InteractionClassification_ERROR,
-                m_xIdentifier->getContentIdentifier() );
+                aURL );
         break;
 
     case DAVException::DAV_LOCK_EXPIRED:
                 rtl::OUString::createFromAscii( "Lock expired!" ),
                 static_cast< cppu::OWeakObject * >( this ),
                 task::InteractionClassification_ERROR,
-                m_xIdentifier->getContentIdentifier() );
+                aURL );
         break;
 
     default: