diff options
author | Giuseppe Castagno <giuseppe.castagno@acca-esse.eu> | 2015-11-17 12:37:24 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-12-02 14:23:31 +0000 |
commit | dd9c15b36f69bec4d4fc9b0049f7e496e5eb9e9d (patch) | |
tree | bb4b28c79e8cdd01d0374144bf87d1d27e95d857 /ucb | |
parent | cc30af5b89747f8684e90d5d3352672190dbbf9c (diff) |
Add/change some logs in WebDAV ucb.ucp layer.
At the same time replace old OSL_TRACE, OSL_FAIL, OSL_ENSURE
with SAL_* as appropriate:
OSL_TRACE =--> SAL_LOG or =--> SAL_WARN if requires some kind of
attention by the developer.
OSL_FAIL =--> SAL_WARN or =--> SAL_INFO if the warning is brought up
later in the program flow.
OSL_ENSURE =--> assert oe SAL_WARN_IF when appropriate.
Change-Id: I1cf8f76acdec6f37746488b22cbf579802a9d79d
Reviewed-on: https://gerrit.libreoffice.org/20034
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/webdav-neon/ContentProperties.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx | 3 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/LockSequence.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx | 19 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonLockStore.cxx | 20 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/NeonSession.cxx | 139 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx | 25 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontent.cxx | 49 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx | 30 |
10 files changed, 189 insertions, 113 deletions
diff --git a/ucb/source/ucp/webdav-neon/ContentProperties.cxx b/ucb/source/ucp/webdav-neon/ContentProperties.cxx index 64244aa9123b..9c39daa30150 100644 --- a/ucb/source/ucp/webdav-neon/ContentProperties.cxx +++ b/ucb/source/ucp/webdav-neon/ContentProperties.cxx @@ -94,8 +94,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource ) : m_xProps( new PropertyValueMap ), m_bTrailingSlash( false ) { - OSL_ENSURE( !rResource.uri.isEmpty(), - "ContentProperties ctor - Empty resource URI!" ); + assert( !rResource.uri.isEmpty() && "ContentProperties ctor - Empty resource URI!" ); // Title try diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx index e3d331b95a82..2079fbd9f893 100644 --- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx @@ -1100,8 +1100,7 @@ void DAVResourceAccess::initialize() const OUString & DAVResourceAccess::getRequestURI() const { - OSL_ENSURE( m_xSession.is(), - "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-neon/LockSequence.cxx b/ucb/source/ucp/webdav-neon/LockSequence.cxx index 60808f945bf3..e79ecd233a83 100644 --- a/ucb/source/ucp/webdav-neon/LockSequence.cxx +++ b/ucb/source/ucp/webdav-neon/LockSequence.cxx @@ -161,7 +161,7 @@ extern "C" int LockSequence_chardata_callback( pCtx->hasDepth = true; } else - OSL_FAIL( "LockSequence_chardata_callback - Unknown depth!" ); + SAL_WARN( "ucb.ucp.webdav", "LockSequence_chardata_callback - Unknown depth!" ); break; case STATE_OWNER: @@ -185,6 +185,10 @@ extern "C" int LockSequence_chardata_callback( // field-content = <the OCTETs making up the field-value // and consisting of either *TEXT or combinations // of token, separators, and quoted-string> + // + // RFC4918, <http://tools.ietf.org/html/rfc4918#section-10.7> + // "The timeout value for TimeType "Second" MUST + // NOT be greater than 2^32-1." if ( rtl_str_compareIgnoreAsciiCase_WithLength( buf, len, "Infinite", 8 ) == 0 ) @@ -208,7 +212,7 @@ extern "C" int LockSequence_chardata_callback( { pCtx->pLock->Timeout = sal_Int64( -1 ); pCtx->hasTimeout = true; - OSL_FAIL( "LockSequence_chardata_callback - Unknown timeout!" ); + SAL_WARN( "ucb.ucp.webdav", "LockSequence_chardata_callback - Unknown timeout!" ); } break; diff --git a/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx b/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx index 4d7dc9180643..cdf3be9014b8 100644 --- a/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav-neon/NeonHeadRequest.cxx @@ -44,11 +44,30 @@ void process_headers( ne_request * req, void * cursor = nullptr; const char * name, *value; +#if defined SAL_LOG_INFO + { + if( !rHeaderNames.empty() ) + { + std::vector< OUString >::const_iterator it( + rHeaderNames.begin() ); + const std::vector< OUString >::const_iterator end( + rHeaderNames.end() ); + + while ( it != end ) + { + SAL_INFO( "ucb.ucp.webdav", "HEAD - requested header: " << (*it) ); + ++it; + } + } + } +#endif while ( ( cursor = ne_response_header_iterate( req, cursor, &name, &value ) ) != nullptr ) { OUString aHeaderName( OUString::createFromAscii( name ) ); OUString aHeaderValue( OUString::createFromAscii( value ) ); + SAL_INFO( "ucb.ucp.webdav", "HEAD - received header: " << aHeaderName << ":" << aHeaderValue); + // Note: Empty vector means that all headers are requested. bool bIncludeIt = ( rHeaderNames.empty() ); diff --git a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx index 2c088516c8f2..5e37bd4690ec 100644 --- a/ucb/source/ucp/webdav-neon/NeonLockStore.cxx +++ b/ucb/source/ucp/webdav-neon/NeonLockStore.cxx @@ -64,7 +64,7 @@ private: void TickerThread::execute() { - OSL_TRACE( "TickerThread: start." ); + SAL_INFO( "ucb.ucp.webdav", "TickerThread: start." ); // we have to go through the loop more often to be able to finish ~quickly const int nNth = 25; @@ -84,13 +84,24 @@ void TickerThread::execute() salhelper::Thread::wait( aTV ); } - OSL_TRACE( "TickerThread: stop." ); + SAL_INFO( "ucb.ucp.webdav", "TickerThread: stop." ); } NeonLockStore::NeonLockStore() : m_pNeonLockStore( ne_lockstore_create() ) { - OSL_ENSURE( m_pNeonLockStore, "Unable to create neon lock store!" ); + /* + * ne_lockstore_create() never returns a NULL; neon calls abort() in case of an out-of-memory + * situation. + * Please see: + * <http://www.webdav.org/neon/doc/html/refneon.html> + * topic title "Memory handling", copied here verbatim: + * + * "neon does not attempt to cope gracefully with an out-of-memory situation; + * instead, by default, the abort function is called to immediately terminate + * the process. An application may register a custom function which will be + * called before abort in such a situation; see ne_oom_callback." + */ } NeonLockStore::~NeonLockStore() @@ -100,8 +111,7 @@ NeonLockStore::~NeonLockStore() aGuard.reset(); // actually no threads should even try to access members now // release active locks, if any. - OSL_ENSURE( m_aLockInfoMap.empty(), - "NeonLockStore::~NeonLockStore - Releasing active locks!" ); + SAL_WARN_IF( !m_aLockInfoMap.empty(), "ucb.ucp.webdav", "NeonLockStore::~NeonLockStore - Releasing active locks!" ); LockInfoMap::const_iterator it( m_aLockInfoMap.begin() ); const LockInfoMap::const_iterator end( m_aLockInfoMap.end() ); diff --git a/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx index 40833454d6ff..33ff51a6339a 100644 --- a/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav-neon/NeonPropFindRequest.cxx @@ -109,7 +109,7 @@ extern "C" int NPFR_propfind_iter( void* userdata, DAVPropertyValue thePropertyValue; thePropertyValue.IsCaseSensitive = true; - OSL_ENSURE( pname->nspace, "NPFR_propfind_iter - No namespace!" ); + assert( pname->nspace && "NPFR_propfind_iter - No namespace!" ); DAVProperties::createUCBPropName( pname->nspace, pname->name, @@ -121,8 +121,8 @@ extern "C" int NPFR_propfind_iter( void* userdata, if ( UCBDeadPropertyValue::createFromXML( value, thePropertyValue.Value ) ) { - OSL_ENSURE( thePropertyValue.Value.hasValue(), - "NPFR_propfind_iter - No value!" ); + SAL_WARN_IF( !thePropertyValue.Value.hasValue(), + "ucb.ucp.webdav", "NPFR_propfind_iter - No value for UCBDeadProperty!" ); bHasValue = true; } } diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 6ce8651078eb..f696e5513251 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -123,15 +123,14 @@ static sal_uInt16 makeStatusCode( const OUString & rStatusText ) if ( rStatusText.getLength() < 3 ) { - OSL_FAIL( - "makeStatusCode - status text string to short!" ); + SAL_WARN( "ucb.ucp.webdav", "makeStatusCode - status text string to short!" ); return 0; } sal_Int32 nPos = rStatusText.indexOf( ' ' ); if ( nPos == -1 ) { - OSL_FAIL( "makeStatusCode - wrong status text format!" ); + SAL_WARN( "ucb.ucp.webdav", "makeStatusCode - wrong status text format!" ); return 0; } @@ -316,8 +315,7 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ) ); if ( aUser.getLength() > ( NE_ABUFSIZ - 1 ) ) { - OSL_FAIL( - "NeonSession_NeonAuth - username to long!" ); + SAL_WARN( "ucb.ucp.webdav", "NeonSession_NeonAuth - username too long!" ); return -1; } @@ -325,8 +323,7 @@ extern "C" int NeonSession_NeonAuth( void * inUserData, OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ) ); if ( aPass.getLength() > ( NE_ABUFSIZ - 1 ) ) { - OSL_FAIL( - "NeonSession_NeonAuth - password to long!" ); + SAL_WARN( "ucb.ucp.webdav", "NeonSession_NeonAuth - password too long!" ); return -1; } @@ -599,6 +596,7 @@ NeonSession::NeonSession( const rtl::Reference< DAVSessionFactory > & rSessionFa m_aScheme = theUri.GetScheme(); m_aHostName = theUri.GetHost(); m_nPort = theUri.GetPort(); + SAL_INFO( "ucb.ucp.webdav", "NeonSession ctor - URL < " << inUri << ">" ); } NeonSession::~NeonSession( ) @@ -827,22 +825,20 @@ void NeonSession::PROPFIND( const OUString & inPath, const DAVRequestEnvironment & rEnv ) throw ( std::exception ) { + + osl::Guard< osl::Mutex > theGuard( m_aMutex ); + #if defined SAL_LOG_INFO { //debug - SAL_INFO( "ucb.ucp.webdav", "PROPFIND - inPath: <" << inPath << "> inDepth: " << inDepth ); - OUString aProps; - for(std::vector< OUString >::const_iterator it = inPropNames.begin(); - it < inPropNames.end(); ++it) - { - aProps += *it; - aProps += ", "; - } - SAL_INFO( "ucb.ucp.webdav", " properties: " << aProps); + SAL_INFO( "ucb.ucp.webdav", "PROPFIND - relative URL: <" << inPath << "> Depth: " << inDepth ); + for(std::vector< OUString >::const_iterator it = inPropNames.begin(); + it < inPropNames.end(); ++it) + { + SAL_INFO( "ucb.ucp.webdav", "PROFIND - property requested: " << *it ); + } } //debug #endif - osl::Guard< osl::Mutex > theGuard( m_aMutex ); - Init( rEnv ); int theRetVal = NE_OK; @@ -863,9 +859,8 @@ void NeonSession::PROPFIND( const OUString & inPath, const DAVRequestEnvironment & rEnv ) throw( std::exception ) { - SAL_INFO( "ucb.ucp.webdav", "PROPFIND - inPath: <" << inPath << "> inDepth: " << inDepth ); - osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "PROPFIND - relative URL: <" << inPath << "> Depth: " << inDepth ); Init( rEnv ); @@ -882,14 +877,11 @@ void NeonSession::PROPFIND( const OUString & inPath, for ( std::vector< DAVResourceInfo >::const_iterator itres = ioResInfo.begin(); itres < ioResInfo.end(); ++itres) { - OUString aProps; for ( std::vector< OUString >::const_iterator it = (*itres).properties.begin(); it < (*itres).properties.end(); ++it) { - aProps += *it; - aProps += ", "; + SAL_INFO( "ucb.ucp.webdav", "PROPFIND - returned property (name only): " << *it ); } - SAL_INFO( "ucb.ucp.webdav", " returned property names: " << aProps); } } //debug #endif @@ -902,6 +894,8 @@ void NeonSession::PROPPATCH( const OUString & inPath, const DAVRequestEnvironment & rEnv ) throw( std::exception ) { + SAL_INFO( "ucb.ucp.webdav", "PROPPATCH - relative URL <" << inPath << ">" ); + /* @@@ Which standard live properties can be set by the client? This is a known WebDAV RFC issue ( verified: 04/10/2001 ) --> http://www.ics.uci.edu/pub/ietf/webdav/protocol/issues.html @@ -980,7 +974,7 @@ void NeonSession::PROPPATCH( const OUString & inPath, } else { - OSL_FAIL( "NeonSession::PROPPATCH - unsupported type!" ); + SAL_WARN( "ucb.ucp.webdav", "PROPPATCH - Unsupported type!" ); // Error! pItems[ n ].value = nullptr; theRetVal = NE_ERROR; @@ -1032,6 +1026,7 @@ void NeonSession::HEAD( const OUString & inPath, throw( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "HEAD - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1051,6 +1046,7 @@ NeonSession::GET( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "GET - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1074,6 +1070,7 @@ void NeonSession::GET( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "GET - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1096,6 +1093,7 @@ NeonSession::GET( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "GET - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1124,6 +1122,7 @@ void NeonSession::GET( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "GET - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1147,6 +1146,7 @@ void NeonSession::PUT( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "PUT - relative URL <" << inPath << ">" ); uno::Sequence< sal_Int8 > aDataToSend; if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) ) @@ -1173,6 +1173,7 @@ NeonSession::POST( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "POST - relative URL <" << inPath << ">" ); uno::Sequence< sal_Int8 > aDataToSend; if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) ) @@ -1206,6 +1207,7 @@ void NeonSession::POST( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "POST - relative URL <" << inPath << ">" ); uno::Sequence< sal_Int8 > aDataToSend; if ( !getDataFromInputStream( inInputStream, aDataToSend, true ) ) @@ -1232,6 +1234,7 @@ void NeonSession::MKCOL( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "MKCOL - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1249,6 +1252,7 @@ void NeonSession::COPY( const OUString & inSourceURL, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "COPY - inSourceURL: "<<inSourceURL<<" inDestinationURL: "<<inDestinationURL); Init( rEnv ); @@ -1275,6 +1279,7 @@ void NeonSession::MOVE( const OUString & inSourceURL, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "MOVE - inSourceURL: "<<inSourceURL<<" inDestinationURL: "<<inDestinationURL); Init( rEnv ); @@ -1297,6 +1302,7 @@ void NeonSession::DESTROY( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "DESTROY - relative URL <" << inPath << ">" ); Init( rEnv ); @@ -1328,7 +1334,7 @@ namespace } else { - OSL_TRACE( "No chance to refresh lock before timeout!" ); + SAL_WARN( "ucb.ucp.webdav", "LOCK - no chance to refresh lock before timeout!" ); } } return lastChanceToSendRefreshRequest; @@ -1343,6 +1349,7 @@ void NeonSession::LOCK( const OUString & inPath, throw ( std::exception ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); + SAL_INFO( "ucb.ucp.webdav", "LOCK (create) - relative URL: <" << inPath << ">" ); // before issuing the lock command, // better check first if we already have one on this href @@ -1424,18 +1431,15 @@ void NeonSession::LOCK( const OUString & inPath, aTokens[ 0 ] = OUString::createFromAscii( theLock->token ); rLock.LockTokens = aTokens; - OSL_TRACE( "NeonSession::LOCK: created lock for %s. token: %s", - OUStringToOString( makeAbsoluteURL( inPath ), - RTL_TEXTENCODING_UTF8 ).getStr(), - theLock->token ); + SAL_INFO( "ucb.ucp.webdav", "LOCK (create) - Created lock for <" << makeAbsoluteURL( inPath ) + << "> token: <" << theLock->token << "> timeout: " << theLock->timeout << " sec."); } else { ne_lock_destroy( theLock ); - OSL_TRACE( "NeonSession::LOCK: obtaining lock for %s failed!", - OUStringToOString( makeAbsoluteURL( inPath ), - RTL_TEXTENCODING_UTF8 ).getStr() ); + SAL_INFO( "ucb.ucp.webdav", "LOCK (create) - Obtaining lock for <" + << makeAbsoluteURL( inPath ) << " failed!" ); } HandleError( theRetVal, inPath, rEnv ); @@ -1447,10 +1451,12 @@ bool NeonSession::LOCK( NeonLock * pLock, { osl::Guard< osl::Mutex > theGuard( m_aMutex ); -#if OSL_DEBUG_LEVEL > 0 - char * p = ne_uri_unparse( &(pLock->uri) ); - OSL_TRACE( "NeonSession::LOCK: Refreshing lock for %s.", p ); - ne_free( p ); +#if defined SAL_LOG_INFO + { + char * p = ne_uri_unparse( &(pLock->uri) ); + SAL_INFO( "ucb.ucp.webdav", "LOCK (refresh) - relative URL: <" << p << "> token: <" << pLock->token << ">" ); + ne_free( p ); + } #endif // refresh existing lock. @@ -1463,12 +1469,16 @@ bool NeonSession::LOCK( NeonLock * pLock, rlastChanceToSendRefreshRequest = lastChanceToSendRefreshRequest( startCall, pLock->timeout ); - OSL_TRACE( "Lock successfully refreshed." ); + SAL_INFO( "ucb.ucp.webdav", "LOCK (refresh) - Lock successfully refreshed." ); return true; } else { - OSL_TRACE( "Lock not refreshed!" ); +#if defined SAL_LOG_WARN + char * p = ne_uri_unparse( &(pLock->uri) ); + SAL_WARN( "ucb.ucp.webdav", "LOCK (refresh) - not refreshed! Relative URL: <" << p << "> token: <" << pLock->token << ">" ); + ne_free( p ); +#endif return false; } } @@ -1485,6 +1495,7 @@ void NeonSession::UNLOCK( const OUString & inPath, if ( !theLock ) throw DAVException( DAVException::DAV_NOT_LOCKED ); + SAL_INFO( "ucb.ucp.webdav", "UNLOCK - relative URL: <" << inPath << "> token: <" << theLock->token << ">" ); Init( rEnv ); int theRetVal = ne_unlock( m_pHttpSession, theLock ); @@ -1496,9 +1507,8 @@ void NeonSession::UNLOCK( const OUString & inPath, } else { - OSL_TRACE( "NeonSession::UNLOCK: unlocking of %s failed.", - OUStringToOString( makeAbsoluteURL( inPath ), - RTL_TEXTENCODING_UTF8 ).getStr() ); + SAL_INFO( "ucb.ucp.webdav", "UNLOCK - Unlocking of <" + << makeAbsoluteURL( inPath ) << "> failed." ); } HandleError( theRetVal, inPath, rEnv ); @@ -1508,20 +1518,34 @@ bool NeonSession::UNLOCK( NeonLock * pLock ) { osl::Guard< osl::Mutex > theGuard( m_aMutex ); -#if OSL_DEBUG_LEVEL > 0 - char * p = ne_uri_unparse( &(pLock->uri) ); - OSL_TRACE( "NeonSession::UNLOCK: Unlocking %s.", p ); - ne_free( p ); +#if defined SAL_LOG_INFO + { + char * p = ne_uri_unparse( &(pLock->uri) ); + SAL_INFO( "ucb.ucp.webdav", "UNLOCK (from store) - relative URL: <" << p << "> token: <" << pLock->token << ">" ); + ne_free( p ); + } #endif if ( ne_unlock( m_pHttpSession, pLock ) == NE_OK ) { - OSL_TRACE( "UNLOCK succeeded." ); +#if defined SAL_LOG_INFO + { + char * p = ne_uri_unparse( &(pLock->uri) ); + SAL_INFO( "ucb.ucp.webdav", "UNLOCK (from store) - relative URL: <" << p << "> token: <" << pLock->token << "> succeeded." ); + ne_free( p ); + } +#endif return true; } else { - OSL_TRACE( "UNLOCK failed!" ); +#if defined SAL_LOG_WARN + { + char * p = ne_uri_unparse( &(pLock->uri) ); + SAL_INFO( "ucb.ucp.webdav", "UNLOCK (from store) - relative URL: <" << p << "> token: <" << pLock->token << "> failed!" ); + ne_free( p ); + } +#endif return false; } } @@ -1529,7 +1553,7 @@ bool NeonSession::UNLOCK( NeonLock * pLock ) void NeonSession::abort() throw ( std::exception ) { - SAL_INFO("ucb.ucp.webdav", "neon commands cannot be aborted"); + SAL_INFO( "ucb.ucp.webdav", "neon commands cannot be aborted" ); } const ucbhelper::InternetProxyServer & NeonSession::getProxySettings() const @@ -1616,11 +1640,8 @@ bool NeonSession::removeExpiredLocktoken( const OUString & inURL, // No lockdiscovery prop in propfind result / locktoken not found // in propfind result -> not locked - OSL_TRACE( "NeonSession::removeExpiredLocktoken: Removing " - " expired lock token for %s. token: %s", - OUStringToOString( inURL, - RTL_TEXTENCODING_UTF8 ).getStr(), - theLock->token ); + SAL_WARN( "ucb.ucp.webdav", "Removing expired lock token for <" << inURL + << "> token: " << theLock->token ); m_aNeonLockStore.removeLock( theLock ); ne_lock_destroy( theLock ); @@ -1653,7 +1674,7 @@ void NeonSession::HandleError( int nError, sal_uInt16 code = makeStatusCode( aText ); - SAL_WARN( "ucb.ucp.webdav","Neon received http error: '" << aText << "'"); + SAL_WARN( "ucb.ucp.webdav", "Neon received http error: '" << aText << "'" ); if ( code == SC_LOCKED ) { if ( m_aNeonLockStore.findByUri( @@ -1682,7 +1703,7 @@ void NeonSession::HandleError( int nError, throw DAVException( DAVException::DAV_HTTP_ERROR, aText, code ); } case NE_LOOKUP: // Name lookup failed. - SAL_WARN( "ucb.ucp.webdav","Name lookup failed" ); + SAL_WARN( "ucb.ucp.webdav", "Name lookup failed" ); throw DAVException( DAVException::DAV_HTTP_LOOKUP, NeonUri::makeConnectionEndPointString( m_aHostName, m_nPort ) ); @@ -1693,6 +1714,7 @@ void NeonSession::HandleError( int nError, m_aHostName, m_nPort ) ); case NE_PROXYAUTH: // User authentication failed on proxy + SAL_WARN( "ucb.ucp.webdav", "DAVException::DAV_HTTP_AUTHPROXY" ); throw DAVException( DAVException::DAV_HTTP_AUTHPROXY, NeonUri::makeConnectionEndPointString( m_aProxyName, m_nProxyPort ) ); @@ -1703,12 +1725,13 @@ void NeonSession::HandleError( int nError, m_aHostName, m_nPort ) ); case NE_TIMEOUT: // Connection timed out + SAL_WARN( "ucb.ucp.webdav", "DAVException::DAV_HTTP_TIMEOUT" ); throw DAVException( DAVException::DAV_HTTP_TIMEOUT, NeonUri::makeConnectionEndPointString( m_aHostName, m_nPort ) ); case NE_FAILED: // The precondition failed - SAL_WARN( "ucb.ucp.webdav","The precondition failed" ); + SAL_WARN( "ucb.ucp.webdav", "The precondition failed" ); throw DAVException( DAVException::DAV_HTTP_FAILED, NeonUri::makeConnectionEndPointString( m_aHostName, m_nPort ) ); @@ -1721,6 +1744,7 @@ void NeonSession::HandleError( int nError, case NE_REDIRECT: { NeonUri aUri( ne_redirect_location( m_pHttpSession ) ); + SAL_INFO( "ucb.ucp.webdav", "DAVException::DAV_HTTP_REDIRECT: new URI: " << aUri.GetURI() ); throw DAVException( DAVException::DAV_HTTP_REDIRECT, aUri.GetURI() ); } @@ -1820,6 +1844,7 @@ int NeonSession::GET( ne_session * sess, { char buffer[8192]; + SAL_INFO( "ucb.ucp.webdav", "GET - received header: " << name << ": " << value ); ne_snprintf(buffer, sizeof buffer, "%s: %s", name, value); runResponseHeaderHandler(userdata, buffer); } diff --git a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx index a275f52c2087..22acd274610b 100644 --- a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx @@ -110,7 +110,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback( switch ( state ) { case STATE_TYPE: - OSL_ENSURE( !pCtx->pType, + assert( !pCtx->pType && "UCBDeadPropertyValue_endelement_callback - " "Type already set!" ); pCtx->pType @@ -118,7 +118,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback( break; case STATE_VALUE: - OSL_ENSURE( !pCtx->pValue, + assert( !pCtx->pValue && "UCBDeadPropertyValue_endelement_callback - " "Value already set!" ); pCtx->pValue @@ -213,7 +213,7 @@ static OUString decodeValue( const OUString & rValue ) if ( nPos == nEnd ) { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } @@ -225,7 +225,7 @@ static OUString decodeValue( const OUString & rValue ) if ( nPos > nEnd - 4 ) { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } @@ -240,7 +240,7 @@ static OUString decodeValue( const OUString & rValue ) } else { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } } @@ -250,7 +250,7 @@ static OUString decodeValue( const OUString & rValue ) if ( nPos > nEnd - 3 ) { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } @@ -263,7 +263,7 @@ static OUString decodeValue( const OUString & rValue ) } else { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } } @@ -273,7 +273,7 @@ static OUString decodeValue( const OUString & rValue ) if ( nPos > nEnd - 3 ) { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } @@ -286,13 +286,13 @@ static OUString decodeValue( const OUString & rValue ) } else { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } } else { - OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); + SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" ); return OUString(); } } @@ -403,7 +403,7 @@ bool UCBDeadPropertyValue::createFromXML( const OString & rInData, } else { - OSL_FAIL( "UCBDeadPropertyValue::createFromXML - " + SAL_WARN( "ucb.ucp.webdav", "createFromXML() - " "Unsupported property type!" ); success = false; } @@ -501,8 +501,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, } else { - OSL_FAIL( "UCBDeadPropertyValue::toXML - " - "Unsupported property type!" ); + SAL_WARN( "ucb.ucp.webdav", "toXML() - unsupported property type!" ); return false; } diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx index 33c2686adbf6..f77b1ef61368 100644 --- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx +++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx @@ -877,20 +877,20 @@ void Content::addProperty( const ucb::PropertyCommandArgument& aCmdArg, break; default: - OSL_FAIL( "Content::addProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::addProperty - " "Unsupported resource type!" ); break; } } catch ( uno::Exception const & ) { - OSL_FAIL( "Content::addProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::addProperty - " "Unable to determine resource type!" ); } } else { - OSL_FAIL( "Content::addProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::addProperty - " "Unable to determine resource type!" ); } } @@ -963,20 +963,20 @@ void Content::removeProperty( const OUString& Name, break; default: - OSL_FAIL( "Content::removeProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::removeProperty - " "Unsupported resource type!" ); break; } } catch ( uno::Exception const & ) { - OSL_FAIL( "Content::removeProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::removeProperty - " "Unable to determine resource type!" ); } } else { - OSL_FAIL( "Content::removeProperty - " + SAL_WARN( "ucb.ucp.webdav", "Content::removeProperty - " "Unable to determine resource type!" ); // throw beans::UnknownPropertyException(); } @@ -1069,8 +1069,7 @@ Content::createNewContent( const ucb::ContentInfo& Info ) OUString aURL = m_xIdentifier->getContentIdentifier(); - OSL_ENSURE( !aURL.isEmpty(), - "WebdavContent::createNewContent - empty identifier!" ); + assert( !aURL.isEmpty() && "WebdavContent::createNewContent - empty identifier!" ); if ( ( aURL.lastIndexOf( '/' ) + 1 ) != aURL.getLength() ) aURL += "/"; @@ -1833,8 +1832,7 @@ uno::Sequence< uno::Any > Content::setPropertyValues( } catch ( DAVException const & e ) { -// OSL_FAIL( // "Content::setPropertyValues - PROPPATCH failed!" ); - + SAL_WARN( "ucb.ucp.webdav", "Content::setPropertyValues - PROPPATCH failed!" ); cancelCommandExecution( e, xEnv ); // unreachable } @@ -2266,7 +2264,7 @@ void Content::insert( if ( aEscapedTitle.isEmpty() ) { - OSL_FAIL( "Content::insert - Title missing!" ); + SAL_WARN( "ucb.ucp.webdav", "Content::insert - Title missing!" ); uno::Sequence<OUString> aProps { "Title" }; ucbhelper::cancelCommandExecution( @@ -2342,7 +2340,7 @@ void Content::insert( // break; default: - OSL_FAIL( "Content::insert - " + SAL_WARN( "ucb.ucp.webdav", "Content::insert - " "Unknown interaction selection!" ); throw ucb::CommandFailedException( OUString( "Unknown interaction selection!" ), @@ -2870,7 +2868,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; @@ -2885,13 +2883,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; } @@ -2910,7 +2908,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; } @@ -2973,7 +2971,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( @@ -2986,7 +2984,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 @@ -3013,7 +3011,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 @@ -3041,7 +3039,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 ); // Unreachable @@ -3073,7 +3071,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 @@ -3089,7 +3087,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; @@ -3102,7 +3100,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 ); // Unreachable @@ -3123,7 +3121,7 @@ bool Content::exchangeIdentity( // Already persistent? if ( m_bTransient ) { - OSL_FAIL( "Content::exchangeIdentity - Not persistent!" ); + SAL_WARN( "ucb.ucp.webdav", "Content::exchangeIdentity - Not persistent!" ); return false; } @@ -3171,7 +3169,7 @@ bool Content::exchangeIdentity( } } - OSL_FAIL( "Content::exchangeIdentity - " + SAL_WARN( "ucb.ucp.webdav", "Content::exchangeIdentity - " "Panic! Cannot exchange identity!" ); return false; } @@ -3502,6 +3500,7 @@ Content::ResourceType Content::getResourceType( "different resource types for <" << rURL << ">: " << +eResourceType << " vs. " << +m_eResourceType); } + SAL_INFO( "ucb.ucp.webdav", "m_eResourceType for <"<<rURL<<">: " << m_eResourceType ); return m_eResourceType; } diff --git a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx index 44510d034369..c3b4e04826a1 100644 --- a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx +++ b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx @@ -378,12 +378,34 @@ bool DataSupplier::getData() propertyNames, resources, getResultSet()->getEnvironment() ); - } - catch ( DAVException & ) +#if defined SAL_LOG_INFO + { + //print the resource for every URI returned + std::vector< DAVResource >::const_iterator it3 = resources.begin(); + std::vector< DAVResource >::const_iterator end3 = resources.end(); + while ( it3 != end3 ) + { + NeonUri aCurrURI( (*it3).uri ); + OUString aCurrPath = aCurrURI.GetPath(); + aCurrPath = NeonUri::unescape( aCurrPath ); + SAL_INFO( "ucb.ucp.webdav", "getData() - resource URL: <" << (*it3).uri << ">, unescaped to: <" << aCurrPath << "> )" ); + std::vector< DAVPropertyValue >::const_iterator it4 = (*it3).properties.begin(); + std::vector< DAVPropertyValue >::const_iterator end4 = (*it3).properties.end(); + while ( it4 != end4 ) + { + SAL_INFO( "ucb.ucp.webdav", "PROPFIND - property name: " << (*it4).Name ); + ++it4; + } + ++it3; + } + } +#endif + } + catch ( DAVException & ) { -// OSL_FAIL( "PROPFIND : DAVException" ); + SAL_WARN( "ucb.ucp.webdav", "Running PROPFIND: DAVException" ); m_pImpl->m_bThrowException = true; - } + } if ( !m_pImpl->m_bThrowException ) { |