Kaydet (Commit) 0ee79446 authored tarafından Giuseppe Castagno's avatar Giuseppe Castagno Kaydeden (comit) Christian Lohmaier

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/20034Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
(cherry picked from commit dd9c15b3)
Reviewed-on: https://gerrit.libreoffice.org/20373Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst 290cac71
...@@ -94,8 +94,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource ) ...@@ -94,8 +94,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource )
: m_xProps( new PropertyValueMap ), : m_xProps( new PropertyValueMap ),
m_bTrailingSlash( false ) m_bTrailingSlash( false )
{ {
OSL_ENSURE( !rResource.uri.isEmpty(), assert( !rResource.uri.isEmpty() && "ContentProperties ctor - Empty resource URI!" );
"ContentProperties ctor - Empty resource URI!" );
// Title // Title
try try
......
...@@ -1100,8 +1100,7 @@ void DAVResourceAccess::initialize() ...@@ -1100,8 +1100,7 @@ void DAVResourceAccess::initialize()
const OUString & DAVResourceAccess::getRequestURI() const const OUString & DAVResourceAccess::getRequestURI() const
{ {
OSL_ENSURE( m_xSession.is(), assert( m_xSession.is() && "DAVResourceAccess::getRequestURI - Not initialized!" );
"DAVResourceAccess::getRequestURI - Not initialized!" );
// In case a proxy is used we have to use the absolute URI for a request. // In case a proxy is used we have to use the absolute URI for a request.
if ( m_xSession->UsesProxy() ) if ( m_xSession->UsesProxy() )
......
...@@ -161,7 +161,7 @@ extern "C" int LockSequence_chardata_callback( ...@@ -161,7 +161,7 @@ extern "C" int LockSequence_chardata_callback(
pCtx->hasDepth = true; pCtx->hasDepth = true;
} }
else else
OSL_FAIL( "LockSequence_chardata_callback - Unknown depth!" ); SAL_WARN( "ucb.ucp.webdav", "LockSequence_chardata_callback - Unknown depth!" );
break; break;
case STATE_OWNER: case STATE_OWNER:
...@@ -185,6 +185,10 @@ extern "C" int LockSequence_chardata_callback( ...@@ -185,6 +185,10 @@ extern "C" int LockSequence_chardata_callback(
// field-content = <the OCTETs making up the field-value // field-content = <the OCTETs making up the field-value
// and consisting of either *TEXT or combinations // and consisting of either *TEXT or combinations
// of token, separators, and quoted-string> // 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( if ( rtl_str_compareIgnoreAsciiCase_WithLength(
buf, len, "Infinite", 8 ) == 0 ) buf, len, "Infinite", 8 ) == 0 )
...@@ -208,7 +212,7 @@ extern "C" int LockSequence_chardata_callback( ...@@ -208,7 +212,7 @@ extern "C" int LockSequence_chardata_callback(
{ {
pCtx->pLock->Timeout = sal_Int64( -1 ); pCtx->pLock->Timeout = sal_Int64( -1 );
pCtx->hasTimeout = true; pCtx->hasTimeout = true;
OSL_FAIL( "LockSequence_chardata_callback - Unknown timeout!" ); SAL_WARN( "ucb.ucp.webdav", "LockSequence_chardata_callback - Unknown timeout!" );
} }
break; break;
......
...@@ -44,11 +44,30 @@ void process_headers( ne_request * req, ...@@ -44,11 +44,30 @@ void process_headers( ne_request * req,
void * cursor = nullptr; void * cursor = nullptr;
const char * name, *value; 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, while ( ( cursor = ne_response_header_iterate( req, cursor,
&name, &value ) ) != nullptr ) { &name, &value ) ) != nullptr ) {
OUString aHeaderName( OUString::createFromAscii( name ) ); OUString aHeaderName( OUString::createFromAscii( name ) );
OUString aHeaderValue( OUString::createFromAscii( value ) ); OUString aHeaderValue( OUString::createFromAscii( value ) );
SAL_INFO( "ucb.ucp.webdav", "HEAD - received header: " << aHeaderName << ":" << aHeaderValue);
// Note: Empty vector means that all headers are requested. // Note: Empty vector means that all headers are requested.
bool bIncludeIt = ( rHeaderNames.empty() ); bool bIncludeIt = ( rHeaderNames.empty() );
......
...@@ -64,7 +64,7 @@ private: ...@@ -64,7 +64,7 @@ private:
void TickerThread::execute() 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 // we have to go through the loop more often to be able to finish ~quickly
const int nNth = 25; const int nNth = 25;
...@@ -84,13 +84,24 @@ void TickerThread::execute() ...@@ -84,13 +84,24 @@ void TickerThread::execute()
salhelper::Thread::wait( aTV ); salhelper::Thread::wait( aTV );
} }
OSL_TRACE( "TickerThread: stop." ); SAL_INFO( "ucb.ucp.webdav", "TickerThread: stop." );
} }
NeonLockStore::NeonLockStore() NeonLockStore::NeonLockStore()
: m_pNeonLockStore( ne_lockstore_create() ) : 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() NeonLockStore::~NeonLockStore()
...@@ -100,8 +111,7 @@ NeonLockStore::~NeonLockStore() ...@@ -100,8 +111,7 @@ NeonLockStore::~NeonLockStore()
aGuard.reset(); // actually no threads should even try to access members now aGuard.reset(); // actually no threads should even try to access members now
// release active locks, if any. // release active locks, if any.
OSL_ENSURE( m_aLockInfoMap.empty(), SAL_WARN_IF( !m_aLockInfoMap.empty(), "ucb.ucp.webdav", "NeonLockStore::~NeonLockStore - Releasing active locks!" );
"NeonLockStore::~NeonLockStore - Releasing active locks!" );
LockInfoMap::const_iterator it( m_aLockInfoMap.begin() ); LockInfoMap::const_iterator it( m_aLockInfoMap.begin() );
const LockInfoMap::const_iterator end( m_aLockInfoMap.end() ); const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
......
...@@ -109,7 +109,7 @@ extern "C" int NPFR_propfind_iter( void* userdata, ...@@ -109,7 +109,7 @@ extern "C" int NPFR_propfind_iter( void* userdata,
DAVPropertyValue thePropertyValue; DAVPropertyValue thePropertyValue;
thePropertyValue.IsCaseSensitive = true; thePropertyValue.IsCaseSensitive = true;
OSL_ENSURE( pname->nspace, "NPFR_propfind_iter - No namespace!" ); assert( pname->nspace && "NPFR_propfind_iter - No namespace!" );
DAVProperties::createUCBPropName( pname->nspace, DAVProperties::createUCBPropName( pname->nspace,
pname->name, pname->name,
...@@ -121,8 +121,8 @@ extern "C" int NPFR_propfind_iter( void* userdata, ...@@ -121,8 +121,8 @@ extern "C" int NPFR_propfind_iter( void* userdata,
if ( UCBDeadPropertyValue::createFromXML( if ( UCBDeadPropertyValue::createFromXML(
value, thePropertyValue.Value ) ) value, thePropertyValue.Value ) )
{ {
OSL_ENSURE( thePropertyValue.Value.hasValue(), SAL_WARN_IF( !thePropertyValue.Value.hasValue(),
"NPFR_propfind_iter - No value!" ); "ucb.ucp.webdav", "NPFR_propfind_iter - No value for UCBDeadProperty!" );
bHasValue = true; bHasValue = true;
} }
} }
......
...@@ -110,7 +110,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback( ...@@ -110,7 +110,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback(
switch ( state ) switch ( state )
{ {
case STATE_TYPE: case STATE_TYPE:
OSL_ENSURE( !pCtx->pType, assert( !pCtx->pType &&
"UCBDeadPropertyValue_endelement_callback - " "UCBDeadPropertyValue_endelement_callback - "
"Type already set!" ); "Type already set!" );
pCtx->pType pCtx->pType
...@@ -118,7 +118,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback( ...@@ -118,7 +118,7 @@ extern "C" int UCBDeadPropertyValue_chardata_callback(
break; break;
case STATE_VALUE: case STATE_VALUE:
OSL_ENSURE( !pCtx->pValue, assert( !pCtx->pValue &&
"UCBDeadPropertyValue_endelement_callback - " "UCBDeadPropertyValue_endelement_callback - "
"Value already set!" ); "Value already set!" );
pCtx->pValue pCtx->pValue
...@@ -213,7 +213,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -213,7 +213,7 @@ static OUString decodeValue( const OUString & rValue )
if ( nPos == nEnd ) if ( nPos == nEnd )
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
...@@ -225,7 +225,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -225,7 +225,7 @@ static OUString decodeValue( const OUString & rValue )
if ( nPos > nEnd - 4 ) if ( nPos > nEnd - 4 )
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
...@@ -240,7 +240,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -240,7 +240,7 @@ static OUString decodeValue( const OUString & rValue )
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
} }
...@@ -250,7 +250,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -250,7 +250,7 @@ static OUString decodeValue( const OUString & rValue )
if ( nPos > nEnd - 3 ) if ( nPos > nEnd - 3 )
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
...@@ -263,7 +263,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -263,7 +263,7 @@ static OUString decodeValue( const OUString & rValue )
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
} }
...@@ -273,7 +273,7 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -273,7 +273,7 @@ static OUString decodeValue( const OUString & rValue )
if ( nPos > nEnd - 3 ) if ( nPos > nEnd - 3 )
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
...@@ -286,13 +286,13 @@ static OUString decodeValue( const OUString & rValue ) ...@@ -286,13 +286,13 @@ static OUString decodeValue( const OUString & rValue )
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::decodeValue - syntax error!" ); SAL_WARN( "ucb.ucp.webdav", "decodeValue() - syntax error!" );
return OUString(); return OUString();
} }
} }
...@@ -403,7 +403,7 @@ bool UCBDeadPropertyValue::createFromXML( const OString & rInData, ...@@ -403,7 +403,7 @@ bool UCBDeadPropertyValue::createFromXML( const OString & rInData,
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::createFromXML - " SAL_WARN( "ucb.ucp.webdav", "createFromXML() - "
"Unsupported property type!" ); "Unsupported property type!" );
success = false; success = false;
} }
...@@ -501,8 +501,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData, ...@@ -501,8 +501,7 @@ bool UCBDeadPropertyValue::toXML( const uno::Any & rInData,
} }
else else
{ {
OSL_FAIL( "UCBDeadPropertyValue::toXML - " SAL_WARN( "ucb.ucp.webdav", "toXML() - unsupported property type!" );
"Unsupported property type!" );
return false; return false;
} }
......
...@@ -378,12 +378,34 @@ bool DataSupplier::getData() ...@@ -378,12 +378,34 @@ bool DataSupplier::getData()
propertyNames, propertyNames,
resources, resources,
getResultSet()->getEnvironment() ); getResultSet()->getEnvironment() );
} #if defined SAL_LOG_INFO
catch ( DAVException & ) {
//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; m_pImpl->m_bThrowException = true;
} }
if ( !m_pImpl->m_bThrowException ) if ( !m_pImpl->m_bThrowException )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment