sfx2: SfxMedium::Transfer_Impl() ignore exceptions when getting props
Somehow (bisected to commit bc48f2656c9a7bc1f41541bff66ec2c4496466a4)
this throws an exception now when getting "Title" when storing a
new file to a WebDAV server (the server naturally replies with 404).
There is already a fallback to get the filename, so just ignore
exceptions here so the transfer can succeed.
Change-Id: Ic609f2a4f5a67670b2d8eeb74680730053a7d3a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152678
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index f43213b..d937986 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2426,11 +2426,18 @@ void SfxMedium::Transfer_Impl()
// LongName wasn't defined anywhere, only used here... get the Title instead
// as it's less probably empty
OUString aFileName;
Any aAny = aDestContent.getPropertyValue("Title");
aAny >>= aFileName;
aAny = aDestContent.getPropertyValue( "ObjectId" );
OUString sObjectId;
aAny >>= sObjectId;
try
{
Any aAny = aDestContent.getPropertyValue("Title");
aAny >>= aFileName;
aAny = aDestContent.getPropertyValue("ObjectId");
aAny >>= sObjectId;
}
catch (uno::Exception const&)
{
SAL_INFO("sfx.doc", "exception while getting Title or ObjectId");
}
if ( aFileName.isEmpty() )
aFileName = GetURLObject().getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );