[Libreoffice-commits] core.git: chart2/source sc/source sd/source sw/source

Michael Stahl mstahl at redhat.com
Tue Feb 9 14:20:09 UTC 2016


 chart2/source/model/filter/XMLFilter.cxx |    3 ++-
 sc/source/filter/xml/xmlwrap.cxx         |    3 ++-
 sd/source/filter/xml/sdxmlwrp.cxx        |    3 ++-
 sw/source/filter/xml/swxml.cxx           |    4 +++-
 4 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit e9309e1f32e9029b62d67a3706ea63d4c5bb587a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Feb 9 14:58:47 2016 +0100

    don't assert that no ODF import happens without a base URL
    
    Turns out that if you create a new document and then copy an embedded
    object from it to the clipboard, there really is no usable base URL.
    
    So don't assert and just log something, hopefully the important file
    import cases have been fixed already.
    
    Change-Id: Iee1027cbab4db10a273518739a5ab2c31627180e

diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index c18ac15..ed133f4 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -383,7 +383,8 @@ sal_Int32 XMLFilter::impl_Import(
             }
         }
 
-        assert(!aBaseUri.isEmpty()); // needed for relative URLs
+        // needed for relative URLs, but in clipboard copy/paste there may be none
+        SAL_INFO_IF(aBaseUri.isEmpty(), "chart2", "chart::XMLFilter: no base URL");
         if( !aBaseUri.isEmpty() )
             xImportInfo->setPropertyValue( "BaseURI", uno::makeAny( aBaseUri ) );
 
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 0df5913..f6dde8d 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -349,7 +349,8 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError )
     // Set base URI
     OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!\n" );
     OUString aBaseURL = pMedium ? pMedium->GetBaseURL() : OUString();
-    assert(!aBaseURL.isEmpty()); // needed for relative URLs
+    // needed for relative URLs, but in clipboard copy/paste there may be none
+    SAL_INFO_IF(aBaseURL.isEmpty(), "sc.filter", "ScXMLImportWrapper: no base URL");
     OUString sPropName("BaseURI");
     xInfoSet->setPropertyValue( sPropName, uno::makeAny( aBaseURL ) );
 
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 98ae655..5829e61 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -587,7 +587,8 @@ bool SdXMLFilter::Import( ErrCode& nError )
 
     // Set base URI
     OUString const baseURI(mrMedium.GetBaseURL());
-    assert(!baseURI.isEmpty()); // needed for relative URLs
+    // needed for relative URLs, but in clipboard copy/paste there may be none
+    SAL_INFO_IF(baseURI.isEmpty(), "sd.filter", "SdXMLFilter: no base URL");
     xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI));
 
     if( 0 == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() )
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 7c9b241..33c976f 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -492,7 +492,9 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc)
 
 sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName )
 {
-    // TODO: sadly SwXMLTextBlocks doesn't set this? assert(!rBaseURL.isEmpty()); // needed for relative URLs
+    // needed for relative URLs, but in clipboard copy/paste there may be none
+    // and also there is the SwXMLTextBlocks special case
+    SAL_INFO_IF(rBaseURL.isEmpty(), "sw.filter", "sw::XMLReader: no base URL");
 
     // Get service factory
     uno::Reference< uno::XComponentContext > xContext =


More information about the Libreoffice-commits mailing list