Kaydet (Commit) e07cefb4 authored tarafından Matúš Kukan's avatar Matúš Kukan

webdav: Do not call into DAVResourceAccess with mutex locked.

This commit cherry-picks 0c350011
for serf webdav version.

Change-Id: I108b0068cad847bf4947ece5e690f789ef034ae9
üst a5958793
......@@ -1472,8 +1472,8 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
}
catch ( DAVException const & e )
{
bNetworkAccessAllowed
= shouldAccessNetworkAfterException( e );
bNetworkAccessAllowed = bNetworkAccessAllowed &&
shouldAccessNetworkAfterException( e );
if ( !bNetworkAccessAllowed )
{
......@@ -3329,66 +3329,78 @@ const Content::ResourceType & Content::getResourceType(
bool * networkAccessAllowed )
throw ( uno::Exception )
{
if ( m_eResourceType == UNKNOWN )
{
osl::Guard< osl::Mutex > aGuard( m_aMutex );
osl::MutexGuard g(m_aMutex);
if (m_eResourceType != UNKNOWN) {
return m_eResourceType;
}
}
ResourceType eResourceType = UNKNOWN;
ResourceType eResourceType = UNKNOWN;
try
try
{
// Try to fetch some frequently used property value, e.g. those
// used when loading documents... along with identifying whether
// this is a DAV resource.
std::vector< DAVResource > resources;
std::vector< OUString > aPropNames;
uno::Sequence< beans::Property > aProperties( 5 );
aProperties[ 0 ].Name = "IsFolder";
aProperties[ 1 ].Name = "IsDocument";
aProperties[ 2 ].Name = "IsReadOnly";
aProperties[ 3 ].Name = "MediaType";
aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
ContentProperties::UCBNamesToDAVNames(
aProperties, aPropNames );
rResAccess->PROPFIND(
DAVZERO, aPropNames, resources, xEnv );
// TODO - is this really only one?
if ( resources.size() == 1 )
{
// Try to fetch some frequently used property value, e.g. those
// used when loading documents... along with identifying whether
// this is a DAV resource.
std::vector< DAVResource > resources;
std::vector< OUString > aPropNames;
uno::Sequence< beans::Property > aProperties( 5 );
aProperties[ 0 ].Name = "IsFolder";
aProperties[ 1 ].Name = "IsDocument";
aProperties[ 2 ].Name = "IsReadOnly";
aProperties[ 3 ].Name = "MediaType";
aProperties[ 4 ].Name = DAVProperties::SUPPORTEDLOCK;
ContentProperties::UCBNamesToDAVNames(
aProperties, aPropNames );
rResAccess->PROPFIND(
DAVZERO, aPropNames, resources, xEnv );
// TODO - is this really only one?
if ( resources.size() == 1 )
{
m_xCachedProps.reset(
new CachableContentProperties( resources[ 0 ] ) );
m_xCachedProps->containsAllNames(
aProperties, m_aFailedPropNames );
}
osl::MutexGuard g(m_aMutex);
m_xCachedProps.reset(
new CachableContentProperties( resources[ 0 ] ) );
m_xCachedProps->containsAllNames(
aProperties, m_aFailedPropNames );
}
eResourceType = DAV;
eResourceType = DAV;
}
catch ( DAVException const & e )
{
rResAccess->resetUri();
if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
{
// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
// resource is NON_DAV
eResourceType = NON_DAV;
}
catch ( DAVException const & e )
else if (networkAccessAllowed != 0)
{
rResAccess->resetUri();
if ( e.getStatus() == SC_METHOD_NOT_ALLOWED )
{
// Status SC_METHOD_NOT_ALLOWED is a safe indicator that the
// resource is NON_DAV
eResourceType = NON_DAV;
}
else if (networkAccessAllowed != 0)
{
*networkAccessAllowed = *networkAccessAllowed
&& shouldAccessNetworkAfterException(e);
}
*networkAccessAllowed = *networkAccessAllowed
&& shouldAccessNetworkAfterException(e);
}
// cancel command execution is case that no user authentication data has been provided.
if ( e.getError() == DAVException::DAV_HTTP_NOAUTH )
{
cancelCommandExecution( e, uno::Reference< ucb::XCommandEnvironment >() );
}
// cancel command execution is case that no user authentication data has been provided.
if ( e.getError() == DAVException::DAV_HTTP_NOAUTH )
{
cancelCommandExecution( e, uno::Reference< ucb::XCommandEnvironment >() );
}
}
osl::MutexGuard g(m_aMutex);
if (m_eResourceType == UNKNOWN) {
m_eResourceType = eResourceType;
} else {
SAL_WARN_IF(
eResourceType != m_eResourceType, "ucb.ucp.webdav",
"different resource types for <" << rResAccess->getURL() << ">: "
<< +eResourceType << " vs. " << +m_eResourceType);
}
return m_eResourceType;
}
......
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