[PATCH] fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Fri May 3 15:41:13 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3771

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/71/3771/1

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

 - replaced osl_trace with sal_info
 - replaced dbg_* with sal_*

Change-Id: I80aca85562e4a43fded5c37f9895e51f79e42c14
---
M xmloff/source/core/RDFaImportHelper.cxx
M xmloff/source/core/xmlexp.cxx
M xmloff/source/core/xmlimp.cxx
M xmloff/source/draw/sdxmlimp.cxx
M xmloff/source/text/txtparai.cxx
5 files changed, 69 insertions(+), 81 deletions(-)



diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
index e377894..3ff61d1 100644
--- a/xmloff/source/core/RDFaImportHelper.cxx
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -191,7 +191,7 @@
         }
         else
         {
-            OSL_ENSURE(XML_NAMESPACE_NONE != nKey, "no namespace?");
+            SAL_WARN_IF(XML_NAMESPACE_NONE == nKey, "xmloff.core", "no namespace?");
             if ((XML_NAMESPACE_UNKNOWN != nKey) &&
                 (XML_NAMESPACE_XMLNS   != nKey))
             {
@@ -201,12 +201,12 @@
             }
             else
             {
-                OSL_TRACE( "ReadCURIE: invalid CURIE: invalid prefix" );
+                SAL_INFO("xmloff.core", "ReadCURIE: invalid CURIE: invalid prefix" );
                 return OUString();
             }
         }
     }
-    OSL_TRACE( "ReadCURIE: invalid CURIE: no prefix" );
+    SAL_INFO("xmloff.core", "ReadCURIE: invalid CURIE: no prefix" );
     return OUString();
 }
 
@@ -229,7 +229,7 @@
     while (!CURIEs.isEmpty());
     if (vec.empty())
     {
-        OSL_TRACE( "ReadCURIEs: invalid CURIEs" );
+        SAL_INFO("xmloff.core", "ReadCURIEs: invalid CURIEs" );
     }
     return vec;
 }
@@ -246,7 +246,7 @@
         }
         else
         {
-            OSL_TRACE( "ReadURIOrSafeCURIE: invalid SafeCURIE" );
+            SAL_INFO("xmloff.core", "ReadURIOrSafeCURIE: invalid SafeCURIE" );
             return OUString();
         }
     }
@@ -254,7 +254,7 @@
     {
         if (i_rURIOrSafeCURIE.matchAsciiL("_:", 2)) // blank node
         {
-            OSL_TRACE( "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
+            SAL_INFO("xmloff.core", "ReadURIOrSafeCURIE: invalid URI: scheme is _" );
             return OUString();
         }
         else
@@ -282,7 +282,7 @@
 {
     if (i_rURI.matchAsciiL("_:", 2)) // blank node
     {
-        OSL_TRACE("MakeURI: cannot create URI for blank node");
+        SAL_INFO("xmloff.core", "MakeURI: cannot create URI for blank node");
         return 0;
     }
     else
@@ -293,7 +293,7 @@
         }
         catch (uno::Exception &)
         {
-            OSL_FAIL("MakeURI: cannot create URI");
+            SAL_WARN("xmloff.core", "MakeURI: cannot create URI");
             return 0;
         }
     }
@@ -309,7 +309,7 @@
         // N.B.: content.xml and styles.xml are distinct graphs
         OUString name( i_rResource.copy(2) );
         const uno::Reference< rdf::XBlankNode > xBNode( LookupBlankNode(name) );
-        OSL_ENSURE(xBNode.is(), "no blank node?");
+        SAL_WARN_IF(!xBNode.is(), "xmloff.core", "no blank node?");
         return uno::Reference<rdf::XResource>( xBNode, uno::UNO_QUERY);
     }
     else
@@ -334,8 +334,7 @@
 void RDFaInserter::InsertRDFaEntry(
     struct RDFaEntry const & i_rEntry)
 {
-    OSL_ENSURE(i_rEntry.m_xObject.is(),
-        "InsertRDFaEntry: invalid arg: null object");
+    SAL_WARN_IF(!i_rEntry.m_xObject.is(), "xmloff.core", "InsertRDFaEntry: invalid arg: null object");
     if (!i_rEntry.m_xObject.is()) return;
 
     const uno::Reference< rdf::XResource > xSubject(
@@ -388,7 +387,7 @@
     }
     catch (uno::Exception &)
     {
-        OSL_FAIL("InsertRDFaEntry: setStatementRDFa failed?");
+        SAL_WARN("xmloff.core", "InsertRDFaEntry: setStatementRDFa failed?");
     }
 }
 
@@ -412,7 +411,7 @@
 {
     if (i_rProperty.isEmpty())
     {
-        OSL_TRACE("AddRDFa: invalid input: xhtml:property empty");
+        SAL_INFO("xmloff.core", "AddRDFa: invalid input: xhtml:property empty");
         return ::boost::shared_ptr<ParsedRDFaAttributes>();
     }
     // must parse CURIEs here: need namespace declaration context
@@ -440,12 +439,12 @@
 {
     if (!i_xObject.is())
     {
-        OSL_FAIL("AddRDFa: invalid arg: null textcontent");
+        SAL_WARN("xmloff.core", "AddRDFa: invalid arg: null textcontent");
         return;
     }
     if (!i_pRDFaAttributes.get())
     {
-        OSL_FAIL("AddRDFa: invalid arg: null RDFa attributes");
+        SAL_WARN("xmloff.core", "AddRDFa: invalid arg: null RDFa attributes");
         return;
     }
     m_RDFaEntries.push_back(RDFaEntry(i_xObject, i_pRDFaAttributes));
@@ -470,11 +469,11 @@
 void RDFaImportHelper::InsertRDFa(
     uno::Reference< rdf::XRepositorySupplier> const & i_xModel)
 {
-    OSL_ENSURE(i_xModel.is(), "InsertRDFa: invalid arg: model null");
+    SAL_WARN_IF(!i_xModel.is(), "xmloff.core", "InsertRDFa: invalid arg: model null");
     if (!i_xModel.is()) return;
     const uno::Reference< rdf::XDocumentRepository > xRepository(
         i_xModel->getRDFRepository(), uno::UNO_QUERY);
-    OSL_ENSURE(xRepository.is(), "InsertRDFa: no DocumentRepository?");
+    SAL_WARN_IF(!xRepository.is(), "xmloff.core", "InsertRDFa: no DocumentRepository?");
     if (!xRepository.is()) return;
     RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
     ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 82ba725..7be1686 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -459,7 +459,7 @@
     msWS( GetXMLToken(XML_WS) ),
     mbSaveLinkedSections(sal_True)
 {
-    DBG_ASSERT( xContext.is(), "got no service manager" );
+    SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
     _InitCtor();
 }
 
@@ -489,7 +489,7 @@
     msWS( GetXMLToken(XML_WS) ),
     mbSaveLinkedSections(sal_True)
 {
-    DBG_ASSERT( xContext.is(), "got no service manager" );
+    SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
     mpImpl->SetSchemeOf( msOrigFileName );
     _InitCtor();
 
@@ -527,7 +527,7 @@
     msWS( GetXMLToken(XML_WS) ),
     mbSaveLinkedSections(sal_True)
 {
-    DBG_ASSERT( xContext.is(), "got no service manager" );
+    SAL_WARN_IF(!xContext.is(), "xmloff.core", "got no service manager" );
     mpImpl->SetSchemeOf( msOrigFileName );
     _InitCtor();
 
@@ -1035,8 +1035,7 @@
 #ifdef DBG_UTIL
 void SvXMLExport::CheckAttrList()
 {
-    DBG_ASSERT( !mpAttrList->getLength(),
-                "XMLExport::CheckAttrList: list is not empty" );
+    SAL_WARN_IF( mpAttrList->getLength(), "xmloff.core", "XMLExport::CheckAttrList: list is not empty" );
 }
 #endif
 
@@ -1293,8 +1292,7 @@
             Reference< xml::sax::XDocumentHandler > xTmpDocHandler(
                 m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Oasis2OOoTransformer", aArgs, m_xContext),
                 UNO_QUERY);
-            OSL_ENSURE( xTmpDocHandler.is(),
-                "can't instantiate OASIS transformer component" );
+            SAL_WARN_IF(!xTmpDocHandler.is(), "xmloff.core", "can't instantiate OASIS transformer component" );
             if( xTmpDocHandler.is() )
             {
                 mxHandler = xTmpDocHandler;
@@ -1340,7 +1338,7 @@
         case SvtSaveOptions::ODFVER_010: break;
 
         default:
-            OSL_FAIL("xmloff::SvXMLExport::exportDoc(), unexpected odf default version!");
+            SAL_WARN("xmloff.core", "xmloff::SvXMLExport::exportDoc(), unexpected odf default version!");
         }
 
         if( pVersion )
@@ -1976,7 +1974,7 @@
                     if (aAny.getValueType() == getBooleanCppuType())
                         mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
                     else {
-                        SAL_WARN( "xmloff.core", "why is it no boolean?" );
+                        SAL_WARN("xmloff.core", "why is it no boolean?" );
                     }
                 }
             }
@@ -2077,7 +2075,7 @@
         }
     }
 
-    OSL_ENSURE( sFilterService.getLength(), "no export filter for own object" );
+    SAL_WARN_IF( !sFilterService.getLength(), "xmloff.core", "no export filter for own object" );
 
     if( sFilterService.isEmpty() )
         return sal_False;
@@ -2115,8 +2113,7 @@
     Reference< document::XExporter > xExporter(
         m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, m_xContext),
         UNO_QUERY);
-    OSL_ENSURE( xExporter.is(),
-                "can't instantiate export filter component for own object" );
+    SAL_WARN_IF( !xExporter.is(), "xmloff.core", "can't instantiate export filter component for own object" );
     if( !xExporter.is() )
         return sal_False;
 
@@ -2244,9 +2241,8 @@
         mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
         mpImpl->mNamespaceMaps.pop();
     }
-    OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
-        (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
-        "SvXMLExport: NamespaceMaps corrupted");
+    SAL_WARN_IF(!mpImpl->mNamespaceMaps.empty() &&
+        (mpImpl->mNamespaceMaps.top().second >= mpImpl->mDepth), "xmloff.core", "SvXMLExport: NamespaceMaps corrupted");
 
     if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
     {
@@ -2407,8 +2403,7 @@
                 }
                 else
                 {
-                    OSL_FAIL("SvXMLExport::AddAttributeXmlId: "
-                         "invalid stream name");
+                    SAL_WARN("xmloff.core","SvXMLExport::AddAttributeXmlId: " << "invalid stream name");
                 }
             }
             else
@@ -2425,8 +2420,7 @@
                 }
                 else
                 {
-                    OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
-                        "no stream name given: dropping styles.xml xml:id");
+                    SAL_INFO("xmloff.core", "SvXMLExport::AddAttributeXmlId: " << "no stream name given: dropping styles.xml xml:id");
                 }
             }
         }
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index b9de04c..1b08933 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -172,7 +172,7 @@
         }
         catch (Exception const& e)
         {
-            SAL_WARN("xmloff", "exception getting BuildId" << e.Message);
+            SAL_WARN("xmloff.core", "exception getting BuildId" << e.Message);
         }
     }
     return OUString();
@@ -203,8 +203,7 @@
                             }
                             else
                             {
-                                SAL_INFO_IF('4' != loVersion[0], "xmloff",
-                                        "unknown LO version: " << loVersion);
+                                SAL_INFO_IF('4' != loVersion[0], "xmloff.core", "unknown LO version: " << loVersion);
                                 mnGeneratorVersion = SvXMLImport::LO_4x;
                             }
                             return; // ignore buildIds
@@ -298,7 +297,7 @@
         , mpRDFaHelper() // lazy
         , mpDocumentInfo() // lazy
     {
-        OSL_ENSURE(mxComponentContext.is(), "SvXMLImport: no ComponentContext");
+        SAL_WARN_IF(!mxComponentContext.is(), "xmloff.core", "SvXMLImport: no ComponentContext");
         if (!mxComponentContext.is()) throw uno::RuntimeException();
     }
 
@@ -410,7 +409,7 @@
     mbIsTableShapeSupported( false ),
     mbIsGraphicLoadOnDemandSupported( true )
 {
-    DBG_ASSERT( xContext.is(), "got no service manager" );
+    SAL_WARN_IF( !xContext.is(), "xmloff.core", "got no service manager" );
     _InitCtor();
 }
 
@@ -679,7 +678,7 @@
         pContext = (*mpContexts)[nCount - 1]->CreateChildContext( nPrefix,
                                                                  aLocalName,
                                                                  xAttrList );
-        DBG_ASSERT( pContext && pContext->GetPrefix() == nPrefix,
+        SAL_WARN_IF( !pContext || (pContext->GetPrefix() != nPrefix), "xmloff.core",
                 "SvXMLImport::startElement: created context has wrong prefix" );
     }
     else
@@ -707,7 +706,7 @@
         }
     }
 
-    DBG_ASSERT( pContext, "SvXMLImport::startElement: missing context" );
+    SAL_WARN_IF( !pContext, "xmloff.core", "SvXMLImport::startElement: missing context" );
     if( !pContext )
         pContext = new SvXMLImportContext( *this, nPrefix, aLocalName );
 
@@ -732,7 +731,7 @@
     throw(xml::sax::SAXException, uno::RuntimeException)
 {
     sal_uInt16 nCount = mpContexts->size();
-    DBG_ASSERT( nCount, "SvXMLImport::endElement: no context left" );
+    SAL_WARN_IF( nCount == 0, "xmloff.core", "SvXMLImport::endElement: no context left" );
     if( nCount > 0 )
     {
         // Get topmost context and remove it from the stack.
@@ -744,10 +743,8 @@
         OUString aLocalName;
         sal_uInt16 nPrefix =
             mpNamespaceMap->GetKeyByAttrName( rName, &aLocalName );
-        DBG_ASSERT( pContext->GetPrefix() == nPrefix,
-                "SvXMLImport::endElement: popped context has wrong prefix" );
-        DBG_ASSERT( pContext->GetLocalName() == aLocalName,
-                "SvXMLImport::endElement: popped context has wrong lname" );
+        SAL_WARN_IF( pContext->GetPrefix() != nPrefix,  "xmloff.core", "SvXMLImport::endElement: popped context has wrong prefix" );
+        SAL_WARN_IF( pContext->GetLocalName() != aLocalName, "xmloff.core", "SvXMLImport::endElement: popped context has wrong lname" );
 #endif
 
         // Call a EndElement at the current context.
@@ -840,7 +837,7 @@
         mxModel->addEventListener(mxEventListener);
     }
 
-    DBG_ASSERT( !mpNumImport, "number format import already exists." );
+    SAL_WARN_IF( mpNumImport, "xmloff.core", "number format import already exists." );
     if( mpNumImport )
     {
         delete mpNumImport;
@@ -1344,7 +1341,7 @@
     StyleMap::value_type aValue( aKey, rDisplayName );
     ::std::pair<StyleMap::iterator,bool> aRes( mpStyleMap->insert( aValue ) );
     SAL_WARN_IF( !aRes.second,
-                 "xmloff",
+                 "xmloff.core",
                  "duplicate style name" );
 
 }
@@ -1439,11 +1436,11 @@
         }
         catch ( uno::Exception& )
         {
-            OSL_FAIL("Numberformat could not be inserted");
+            SAL_WARN( "xmloff.core", "Numberformat could not be inserted");
         }
     }
     else {
-        OSL_FAIL("not possible to create NameContainer");
+        SAL_WARN( "xmloff.core", "not possible to create NameContainer");
     }
 }
 
@@ -1628,8 +1625,7 @@
 
 void SvXMLImport::_CreateNumberFormatsSupplier()
 {
-    DBG_ASSERT( !mxNumberFormatsSupplier.is(),
-                "number formats supplier already exists!" );
+    SAL_WARN_IF( mxNumberFormatsSupplier.is(), "xmloff.core", "number formats supplier already exists!" );
     if(mxModel.is())
         mxNumberFormatsSupplier =
             uno::Reference< util::XNumberFormatsSupplier> (mxModel, uno::UNO_QUERY);
@@ -1638,7 +1634,7 @@
 
 void SvXMLImport::_CreateDataStylesImport()
 {
-    DBG_ASSERT( mpNumImport == NULL, "data styles import already exists!" );
+    SAL_WARN_IF( mpNumImport != NULL, "xmloff.core", "data styles import already exists!" );
     uno::Reference<util::XNumberFormatsSupplier> xNum =
         GetNumberFormatsSupplier();
     if ( xNum.is() )
@@ -1654,7 +1650,7 @@
         OUString sStarBats( "StarBats" );
         mpImpl->hBatsFontConv = CreateFontToSubsFontConverter( sStarBats,
                  FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
-        OSL_ENSURE( mpImpl->hBatsFontConv, "Got no symbol font converter" );
+        SAL_WARN_IF( !mpImpl->hBatsFontConv, "xmloff.core", "Got no symbol font converter" );
     }
     if( mpImpl->hBatsFontConv )
     {
@@ -1672,7 +1668,7 @@
         OUString sStarMath( "StarMath" );
         mpImpl->hMathFontConv = CreateFontToSubsFontConverter( sStarMath,
                  FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
-        OSL_ENSURE( mpImpl->hMathFontConv, "Got no symbol font converter" );
+        SAL_WARN_IF( !mpImpl->hMathFontConv, "xmloff.core", "Got no symbol font converter" );
     }
     if( mpImpl->hMathFontConv )
     {
@@ -1865,11 +1861,11 @@
                     xMeta->setMetadataReference(mdref);
                 } catch (lang::IllegalArgumentException &) {
                     // probably duplicate; ignore
-                    OSL_TRACE("SvXMLImport::SetXmlId: cannot set xml:id");
+                    SAL_INFO("xmloff.core", "SvXMLImport::SetXmlId: cannot set xml:id");
                 }
             }
         } catch (uno::Exception &) {
-            OSL_FAIL("SvXMLImport::SetXmlId: exception?");
+            SAL_WARN("xmloff.core","SvXMLImport::SetXmlId: exception?");
         }
     }
 }
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index afa0ea6..3626c78 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -201,7 +201,7 @@
         }
         case XML_TOK_DOC_META:
         {
-            DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
+            SAL_INFO("xmloff.draw", "XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
             break;
         }
         case XML_TOK_DOC_SCRIPT:
@@ -924,7 +924,7 @@
         }
         catch(const uno::Exception&)
         {
-            OSL_TRACE( "#SdXMLImport::SetConfigurationSettings: Exception!" );
+            SAL_INFO("xmloff.draw",  "#SdXMLImport::SetConfigurationSettings: Exception!" );
         }
 
         pValues++;
@@ -950,7 +950,7 @@
                 if (i_rStats[i].Value >>= val) {
                     nCount = val;
                 } else {
-                    OSL_FAIL("SdXMLImport::SetStatistics: invalid entry");
+                    SAL_WARN("xmloff.draw", "SdXMLImport::SetStatistics: invalid entry");
                 }
             }
         }
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 34ffa83..2ef7a9b 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -774,7 +774,7 @@
 
 void XMLMetaImportContextBase::EndElement()
 {
-    OSL_ENSURE(m_xStart.is(), "no mxStart?");
+    SAL_WARN_IF(!m_xStart.is(), "xmloff.text", "no mxStart?");
     if (!m_xStart.is()) return;
 
     const Reference<XTextRange> xEndRange(
@@ -894,8 +894,7 @@
 void XMLMetaImportContext::InsertMeta(
     const Reference<XTextRange> & i_xInsertionRange)
 {
-    OSL_ENSURE(!m_bHaveAbout == !m_sProperty.getLength(),
-        "XMLMetaImportContext::InsertMeta: invalid RDFa?");
+    SAL_WARN_IF(m_bHaveAbout != m_sProperty.getLength(), "xmloff.text", "XMLMetaImportContext::InsertMeta: invalid RDFa?");
     if (!m_XmlId.isEmpty() || (m_bHaveAbout && !m_sProperty.isEmpty()))
     {
         // insert mark
@@ -907,7 +906,7 @@
                 OUString(),
                 i_xInsertionRange, m_XmlId),
             uno::UNO_QUERY);
-        OSL_ENSURE(xMeta.is(), "cannot insert Meta?");
+        SAL_WARN_IF(!xMeta.is(), "xmloff.text", "cannot insert Meta?");
 
         if (xMeta.is() && m_bHaveAbout)
         {
@@ -917,7 +916,7 @@
     }
     else
     {
-        OSL_TRACE("invalid <text:meta>: no xml:id, no valid RDFa");
+        SAL_INFO("xmloff.text", "invalid <text:meta>: no xml:id, no valid RDFa");
     }
 }
 
@@ -986,7 +985,7 @@
                 OUString(),
                 i_xInsertionRange, m_XmlId),
             UNO_QUERY);
-        OSL_ENSURE(xPropertySet.is(), "cannot insert MetaField?");
+        SAL_WARN_IF(!xPropertySet.is(), "xmloff.text", "cannot insert MetaField?");
         if (!xPropertySet.is()) return;
 
         if (!m_DataStyleName.isEmpty())
@@ -1016,7 +1015,7 @@
     }
     else
     {
-        OSL_TRACE("invalid <text:meta-field>: no xml:id");
+        SAL_INFO("xmloff.text", "invalid <text:meta-field>: no xml:id");
     }
 }
 
@@ -1173,7 +1172,7 @@
         }
 
         default:
-            OSL_FAIL("unknown index mark type!");
+            SAL_WARN("xmloff.text", "unknown index mark type!");
             break;
     }
 }
@@ -1233,7 +1232,7 @@
             break;
 
         default:
-            OSL_FAIL("unknown index mark type!");
+            SAL_WARN("xmloff.text", "unknown index mark type!");
             break;
     }
 }
@@ -1284,7 +1283,7 @@
 
         default:
         {
-            OSL_FAIL("unknown index mark type!");
+            SAL_WARN("xmloff.text", "unknown index mark type!");
             OUString sTmp;
             sServiceName = sTmp;
             break;
@@ -1353,7 +1352,7 @@
     OUString sValue,
     Reference<beans::XPropertySet>& rPropSet)
 {
-    DBG_ASSERT(rPropSet.is(), "need PropertySet");
+    SAL_WARN_IF(!rPropSet.is(), "xmloff.text", "need PropertySet");
 
     if ((XML_NAMESPACE_TEXT == nNamespace) &&
         IsXMLToken( sLocalName, XML_OUTLINE_LEVEL ) )
@@ -2035,21 +2034,21 @@
                 (xAttrCursor, uno::UNO_QUERY_THROW);
             const uno::Reference<container::XEnumeration> xEnum(
                 xEA->createEnumeration(), uno::UNO_QUERY_THROW);
-            OSL_ENSURE(xEnum->hasMoreElements(), "xml:id: no paragraph?");
+            SAL_WARN_IF(!xEnum->hasMoreElements(), "xmloff.text", "xml:id: no paragraph?");
             if (xEnum->hasMoreElements()) {
                 uno::Reference<rdf::XMetadatable> xMeta;
                 xEnum->nextElement() >>= xMeta;
-                OSL_ENSURE(xMeta.is(), "xml:id: not XMetadatable");
+                SAL_WARN_IF(!xMeta.is(), "xmloff.text", "xml:id: not XMetadatable");
                 GetImport().SetXmlId(xMeta, m_sXmlId);
                 if (m_bHaveAbout)
                 {
                     GetImport().AddRDFa(xMeta,
                         m_sAbout, m_sProperty, m_sContent, m_sDatatype);
                 }
-                OSL_ENSURE(!xEnum->hasMoreElements(), "xml:id: > 1 paragraph?");
+                SAL_WARN_IF(xEnum->hasMoreElements(), "xmloff.text", "xml:id: > 1 paragraph?");
             }
         } catch (const uno::Exception &) {
-            OSL_TRACE("XMLParaContext::~XMLParaContext: exception");
+            SAL_INFO("xmloff.text", "XMLParaContext::~XMLParaContext: exception");
         }
     }
 
@@ -2265,7 +2264,7 @@
                 }
                 break;
             default:
-                DBG_ASSERT( !this, "What's this" );
+                SAL_WARN_IF( this, "xmloff.text", "What's this" );
                 break;
             }
         }
@@ -2368,10 +2367,10 @@
         i_rImport.GetTextImport()->GetTextListHelper() );
     if (m_ListId.isEmpty())
       {
-        OSL_ENSURE( i_rImport.GetODFVersion() != "1.2", "invalid numbered-paragraph: no list-id (1.2)" );
+        SAL_WARN_IF( i_rImport.GetODFVersion() == "1.2", "xmloff.text", "invalid numbered-paragraph: no list-id (1.2)" );
         m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level,
             StyleName);
-        OSL_ENSURE(!m_ListId.isEmpty(), "numbered-paragraph: no ListId");
+        SAL_WARN_IF(m_ListId.isEmpty(), "xmloff.text", "numbered-paragraph: no ListId");
         if (m_ListId.isEmpty()) {
             return;
         }
@@ -2379,7 +2378,7 @@
     m_xNumRules = rTextListsHelper.EnsureNumberedParagraph( i_rImport,
         m_ListId, m_Level, StyleName);
 
-    OSL_ENSURE(m_xNumRules.is(), "numbered-paragraph: no NumRules");
+    SAL_WARN_IF(!m_xNumRules.is(), "xmloff.text", "numbered-paragraph: no NumRules");
 
     i_rImport.GetTextImport()->GetTextListHelper().PushListContext( this );
 }

-- 
To view, visit https://gerrit.libreoffice.org/3771
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I80aca85562e4a43fded5c37f9895e51f79e42c14
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ioan Radu <ioan.radu.g at gmail.com>



More information about the LibreOffice mailing list