summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-22 22:49:50 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-22 22:49:50 +0100
commit74d5307270a229da2f6b2f5418ca0b95d6ea87fb (patch)
treed7eca432a1e517092e1a7f806bb8e6ac86625f0e
parent5fa3246b0dca2bf3cf7767695436152e142ddf80 (diff)
autorecovery: #i108366# attachResource: correct the calculation of DocFileLocation and DocURL, in case the doc has
been recovered.
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx23
1 files changed, 17 insertions, 6 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index ed071e0b01a7..26b078b2f4b0 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -816,19 +816,30 @@ const Reference< XNumberFormatsSupplier > & ODatabaseModelImpl::getNumberFormats
void ODatabaseModelImpl::attachResource( const ::rtl::OUString& _rURL, const Sequence< PropertyValue >& _rArgs )
{
::comphelper::NamedValueCollection aMediaDescriptor( _rArgs );
+ ENSURE_OR_THROW( _rURL.getLength(), "invalid URL" );
- ::rtl::OUString sDocumentLocation( aMediaDescriptor.getOrDefault( "SalvagedFile", _rURL ) );
- if ( !sDocumentLocation.getLength() )
- // this indicates "the document is being recovered, but _rURL already is the real document URL,
- // not the temporary document location"
- sDocumentLocation = _rURL;
+ ::rtl::OUString sDocumentLocation( _rURL );
+ ::rtl::OUString sDocumentURL( _rURL );
if ( aMediaDescriptor.has( "SalvagedFile" ) )
+ {
+ const ::rtl::OUString sSalvagedFile( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) );
+ // If SalvagedFile is an empty string, this indicates "the document is being recovered, but _rURL already
+ // is the real document URL, not the temporary document location"
+ if ( sSalvagedFile.getLength() )
+ {
+ // otherwise, SalvagedFile is the URL of the document which we should mimic, though we're loaded from
+ // the file denoted by _rURL.
+ sDocumentLocation = _rURL;
+ sDocumentURL = sSalvagedFile;
+ }
+
aMediaDescriptor.remove( "SalvagedFile" );
+ }
m_aArgs = stripLoadArguments( aMediaDescriptor );
- switchToURL( sDocumentLocation, _rURL );
+ switchToURL( sDocumentLocation, sDocumentURL );
}
// -----------------------------------------------------------------------------