ucb/source/ucp/webdav-curl/ContentProperties.cxx | 4 +- ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx | 4 +- ucb/source/ucp/webdav-curl/webdavcontent.cxx | 23 ++++++++-------- ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx | 31 ++++++++++++++++++++++ 4 files changed, 47 insertions(+), 15 deletions(-)
New commits: commit 97a22b7a584ae6f5237e18be3265e1a72705d773 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Oct 8 11:58:04 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Nov 1 18:27:05 2021 +0100 ucb: webdav-curl: Add/change some logs in WebDAV ucb.ucp layer. [ replicate commit dd9c15b36f69bec4d4fc9b0049f7e496e5eb9e9d ] Change-Id: I9eb87ea7216c83ce1ac63f65dd96ebe6760a50a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123273 Tested-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/ucb/source/ucp/webdav-curl/ContentProperties.cxx b/ucb/source/ucp/webdav-curl/ContentProperties.cxx index 53e4593fc342..ea5357fcd88e 100644 --- a/ucb/source/ucp/webdav-curl/ContentProperties.cxx +++ b/ucb/source/ucp/webdav-curl/ContentProperties.cxx @@ -77,8 +77,8 @@ ContentProperties::ContentProperties( const DAVResource& rResource ) : m_xProps( new PropertyValueMap ), m_bTrailingSlash( false ) { - SAL_WARN_IF( !rResource.uri.getLength(), "ucb.ucp.webdav", - "ContentProperties ctor - Empty resource URI!" ); + assert(!rResource.uri.isEmpty() && + "ContentProperties ctor - Empty resource URI!"); // Title try diff --git a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx index 34c3429f3bf3..7a2aa2b7e590 100644 --- a/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-curl/DAVResourceAccess.cxx @@ -1019,8 +1019,8 @@ void DAVResourceAccess::initialize() const OUString & DAVResourceAccess::getRequestURI() const { - SAL_WARN_IF( !m_xSession.is(), "ucb.ucp.webdav", - "DAVResourceAccess::getRequestURI - Not initialized!" ); + assert(m_xSession.is() && + "DAVResourceAccess::getRequestURI - Not initialized!"); // In case a proxy is used we have to use the absolute URI for a request. if ( m_xSession->UsesProxy() ) diff --git a/ucb/source/ucp/webdav-curl/webdavcontent.cxx b/ucb/source/ucp/webdav-curl/webdavcontent.cxx index 43884cdbab47..01d8a40df7ee 100644 --- a/ucb/source/ucp/webdav-curl/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-curl/webdavcontent.cxx @@ -2884,7 +2884,7 @@ Content::ResourceType Content::resourceTypeForLocks( switch( e.getStatus() ) { case SC_NOT_FOUND: - SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks - URL: <" + SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() - URL: <" << m_xIdentifier->getContentIdentifier() << "> was not found. "); eResourceTypeForLocks = NOT_FOUND; break; @@ -2899,13 +2899,13 @@ Content::ResourceType Content::resourceTypeForLocks( case SC_NOT_IMPLEMENTED: // http://tools.ietf.org/html/rfc7231#section-6.6.2 case SC_METHOD_NOT_ALLOWED: // http://tools.ietf.org/html/rfc7231#section-6.5.5 // they all mean the resource is NON_DAV - SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" + SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException (SC_FORBIDDEN, SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = NON_DAV; break; default: //fallthrough - SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks DAVException - URL: <" + SAL_WARN( "ucb.ucp.webdav", "resourceTypeForLocks() DAVException - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); eResourceTypeForLocks = UNKNOWN; } @@ -2924,7 +2924,7 @@ Content::ResourceType Content::resourceTypeForLocks( "different resource types for <" << rURL << ">: " << +eResourceTypeForLocks << " vs. " << +m_eResourceTypeForLocks); } - SAL_INFO( "ucb.ucp.webdav", "resourceTypeForLocks - URL: <" + SAL_INFO( "ucb.ucp.webdav", "resourceTypeForLocks() - URL: <" << m_xIdentifier->getContentIdentifier() << ">, m_eResourceTypeForLocks: " << m_eResourceTypeForLocks ); return m_eResourceTypeForLocks; } @@ -2986,7 +2986,7 @@ void Content::lock( { case DAVException::DAV_LOCKED: { - SAL_WARN( "ucb.ucp.webdav", "lock: resource already locked - URL: <" + SAL_WARN( "ucb.ucp.webdav", "lock(): resource already locked - URL: <" << m_xIdentifier->getContentIdentifier() << ">"); throw ucb::InteractiveLockingLockedException( @@ -2999,7 +2999,7 @@ void Content::lock( break; case DAVException::DAV_HTTP_AUTH: { - SAL_WARN( "ucb.ucp.webdav", "lock: DAVException Authentication error - URL: <" + SAL_WARN( "ucb.ucp.webdav", "lock(): DAVException Authentication error - URL: <" << m_xIdentifier->getContentIdentifier() << ">" ); // this could mean: // - interaction handler for credential management not present (happens, depending @@ -3026,7 +3026,7 @@ void Content::lock( // this returned error is part of base http 1.1 RFCs case SC_NOT_IMPLEMENTED: case SC_METHOD_NOT_ALLOWED: - SAL_WARN( "ucb.ucp.webdav", "lock: DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" + SAL_WARN( "ucb.ucp.webdav", "lock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); // act as nothing happened // that's because when a resource is first created @@ -3054,7 +3054,7 @@ void Content::lock( ; } - SAL_WARN( "ucb.ucp.webdav","lock: DAVException - URL: <" + SAL_WARN( "ucb.ucp.webdav","lock(): DAVException - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); cancelCommandExecution( e, Environment, false ); // Unreachable @@ -3085,7 +3085,7 @@ void Content::unlock( switch( e.getError() ) { case DAVException::DAV_NOT_LOCKED: - SAL_WARN( "ucb.ucp.webdav", "unlock: DAVException::DAV_NOT_LOCKED - URL: <" + SAL_WARN( "ucb.ucp.webdav", "unlock(): DAVException::DAV_NOT_LOCKED - URL: <" << m_xIdentifier->getContentIdentifier() << ">"); // means that we don't own any lock on this resource // intercepted here to remove a confusing indication to the user @@ -3101,7 +3101,7 @@ void Content::unlock( // this returned error is part of base http 1.1 RFCs case SC_NOT_IMPLEMENTED: case SC_METHOD_NOT_ALLOWED: - SAL_WARN( "ucb.ucp.webdav", "unlock: DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" + SAL_WARN( "ucb.ucp.webdav", "unlock() DAVException (SC_NOT_IMPLEMENTED or SC_METHOD_NOT_ALLOWED) - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); return; break; @@ -3114,7 +3114,7 @@ void Content::unlock( //fallthrough ; } - SAL_WARN( "ucb.ucp.webdav","unlock: DAVException - URL: <" + SAL_WARN( "ucb.ucp.webdav","unlock(): DAVException - URL: <" << m_xIdentifier->getContentIdentifier() << ">, DAV error: " << e.getError() << ", HTTP error: " << e.getStatus() ); cancelCommandExecution( e, Environment, false ); // Unreachable @@ -3522,6 +3522,7 @@ Content::ResourceType Content::getResourceType( "different resource types for <" << rResAccess->getURL() << ">: " << +eResourceType << " vs. " << +m_eResourceType); } + SAL_INFO( "ucb.ucp.webdav", "m_eResourceType for <" << rResAccess->getURL() << ">: " << m_eResourceType ); return m_eResourceType; } diff --git a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx index 987bc81b66b6..b7dfb86d167c 100644 --- a/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx +++ b/ucb/source/ucp/webdav-curl/webdavdatasupplier.cxx @@ -23,6 +23,7 @@ #include <memory> #include <utility> +#include <rtl/ustrbuf.hxx> #include <com/sun/star/ucb/OpenMode.hpp> #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/providerhelper.hxx> @@ -57,6 +58,35 @@ struct ResultListEntry explicit ResultListEntry( std::unique_ptr<ContentProperties> && pEntry ) : pData( std::move(pEntry) ) {} }; +auto DumpResources(std::vector<DAVResource> const& rResources) -> OUString +{ + OUStringBuffer buf; + for (auto const& rResource : rResources) + { + buf.append("resource URL: <"); + buf.append(rResource.uri); + try { + CurlUri const uri(rResource.uri); + buf.append("> parsed URL: <"); + buf.append(DecodeURI(uri.GetPath())); + buf.append("> "); + } catch (...) { + // parsing uri could fail + buf.append("> parsing URL failed! "); + } + buf.append("properties: "); + for (auto const& it : rResource.properties) + { + buf.append("\""); + buf.append(it.Name); + buf.append("\" "); + } + buf.append("\n"); + } + buf.stripEnd('\n'); // the last newline is superfluous, remove it + return buf.makeStringAndClear(); +} + } // ResultList. @@ -343,6 +373,7 @@ bool DataSupplier::getData() propertyNames, resources, getResultSet()->getEnvironment() ); + SAL_INFO("ucb.ucp.webdav", "getData() - " << DumpResources(resources)); } catch ( DAVException & ) {