summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/webdav/webdavcontent.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'ucb/source/ucp/webdav/webdavcontent.cxx')
-rw-r--r--ucb/source/ucp/webdav/webdavcontent.cxx116
1 files changed, 64 insertions, 52 deletions
diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx
index c91cfc2054fb..faca5653cfa3 100644
--- a/ucb/source/ucp/webdav/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav/webdavcontent.cxx
@@ -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;
}