[Libreoffice-commits] core.git: xmloff/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 19 09:18:24 UTC 2020


 xmloff/source/forms/elementimport.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit acf7d8d1ab6fe6ad0fb8a5d1ad2d2ef53f578757
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Wed Nov 18 21:56:25 2020 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 19 10:17:42 2020 +0100

    Avoid wrong warning in OElementImport::implApplyGenericProperties (xmloff)
    
    When empty sequence, there's nothing to convert so no need to spend time here and
    to indicate the following warning:
    Avoid warn:legacy.osl:93722:93722:xmloff/source/forms/elementimport.cxx:364:
    OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!
    
    + avoid these in the same time:
    warn:xmloff.forms:88800:88800:xmloff/source/forms/elementimport.cxx:428: DBG_UNHANDLED_EXCEPTION in implApplyGenericProperties
    exception: com.sun.star.lang.IllegalArgumentException message:
    /home/julien/lo/libreoffice/include/cppuhelper/proptypehlp.hxx:35 ArgumentPosition: 0
    
    In addition, convert 2 OSL_ENSURE of this block in SAL_WARN_IF
    
    Change-Id: I047eb5afba6fd22249010791aa61ebd1f83f3c67
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106082
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 1fac083e463c..42a151c9354b 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -356,16 +356,21 @@ namespace xmloff
 
                 if ( bValueIsSequence )
                 {
-                    OSL_ENSURE( eValueTypeClass == TypeClass_ANY,
+                    Sequence< Any > aXMLValueList;
+                    rPropValues.Value >>= aXMLValueList;
+                    // just skip this part if empty sequence
+                    if (!aXMLValueList.getLength())
+                        continue;
+
+                    Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
+
+                    SAL_WARN_IF( eValueTypeClass != TypeClass_ANY, "xmloff",
                         "OElementImport::implApplyGenericProperties: only ANYs should have been imported as generic list property!" );
                         // (OPropertyImport should produce only Sequencer< Any >, since it cannot know the real type
 
-                    OSL_ENSURE( ePropTypeClass == TypeClass_SHORT,
+                    SAL_WARN_IF( ePropTypeClass != TypeClass_SHORT, "xmloff",
                         "OElementImport::implApplyGenericProperties: conversion to sequences other than 'sequence< short >' not implemented, yet!" );
 
-                    Sequence< Any > aXMLValueList;
-                    rPropValues.Value >>= aXMLValueList;
-                    Sequence< sal_Int16 > aPropertyValueList( aXMLValueList.getLength() );
 
                     std::transform(aXMLValueList.begin(), aXMLValueList.end(), aPropertyValueList.begin(),
                         [](const Any& rXMLValue) -> sal_Int16 {


More information about the Libreoffice-commits mailing list