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 )
: 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
......
......@@ -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() )
......
......@@ -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;
......
......@@ -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() );
......
......@@ -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() );
......
......@@ -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;
}
}
......
......@@ -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;
}
......
......@@ -378,10 +378,32 @@ bool DataSupplier::getData()
propertyNames,
resources,
getResultSet()->getEnvironment() );
#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;
}
......
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