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

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Sun Apr 21 08:51:03 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3526

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/26/3526/1

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

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

Change-Id: I4db4a2db0f4f2e9913826f428ba129099b1ac8a8
---
M xmloff/source/chart/SchXMLImport.cxx
M xmloff/source/chart/SchXMLLegendContext.cxx
M xmloff/source/chart/SchXMLPlotAreaContext.cxx
M xmloff/source/chart/SchXMLSeries2Context.cxx
M xmloff/source/chart/SchXMLSeriesHelper.cxx
M xmloff/source/chart/SchXMLTableContext.cxx
M xmloff/source/chart/SchXMLTools.cxx
M xmloff/source/chart/contexts.cxx
8 files changed, 60 insertions(+), 121 deletions(-)



diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 6f758c8..91ba282 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -165,7 +165,7 @@
     }
     else
     {
-        OSL_FAIL( "No valid XChartDocument given as XModel" );
+        SAL_WARN("xmloff.chart", "No valid XChartDocument given as XModel" );
         pContext = new SvXMLImportContext( rImport, nPrefix, rLocalName );
     }
 
@@ -436,12 +436,7 @@
     }
     catch( const uno::Exception & ex )
     {
-        (void)ex; // avoid warning for pro build
-        OSL_FAIL( OUStringToOString(
-                        OUString(  "Exception caught. Type: " ) +
-                        OUString::createFromAscii( typeid( ex ).name()) +
-                        OUString(  ", Message: " ) +
-                        ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+       SAL_WARN("xmloff.chart",  "Exception caught. Type: " << OUString::createFromAscii( typeid( ex ).name()) << ", Message: " << ex.Message);
     }
 }
 
@@ -520,12 +515,7 @@
     }
     catch( const uno::Exception & ex )
     {
-        (void)ex; // avoid warning for pro build
-        OSL_FAIL( OUStringToOString(
-                        OUString(  "Exception caught. Type: " ) +
-                        OUString::createFromAscii( typeid( ex ).name()) +
-                        OUString(  ", Message: " ) +
-                        ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+        SAL_WARN("xmloff.chart", "Exception caught. Type: " << OUString::createFromAscii( typeid( ex ).name()) << ", Message: " << ex.Message);
     }
     return xResult;
 }
@@ -678,12 +668,8 @@
     }
     catch( const uno::Exception & rEx )
     {
-#ifdef DBG_UTIL
         OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-        OSL_TRACE("SchXMLChartContext::StartElement(): Exception caught: %s", aBStr.getStr());
-#else
-        (void)rEx; // avoid warning for pro build
-#endif
+        SAL_INFO("xmloff.chart", "SchXMLChartContext::StartElement(): Exception caught: " << aBStr);
     }
 }
 
diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx
index ba44bf3..73b651fb 100644
--- a/xmloff/source/chart/SchXMLLegendContext.cxx
+++ b/xmloff/source/chart/SchXMLLegendContext.cxx
@@ -105,7 +105,7 @@
         }
         catch(const beans::UnknownPropertyException&)
         {
-            OSL_TRACE( "Property HasLegend not found" );
+            SAL_INFO("xmloff.chart", "Property HasLegend not found" );
         }
     }
 
@@ -113,7 +113,7 @@
     uno::Reference< beans::XPropertySet > xLegendProps( xLegendShape, uno::UNO_QUERY );
     if( !xLegendShape.is() || !xLegendProps.is() )
     {
-        OSL_TRACE( "legend could not be created" );
+        SAL_INFO("xmloff.chart", "legend could not be created" );
         return;
     }
 
@@ -151,7 +151,7 @@
                     }
                     catch(const beans::UnknownPropertyException&)
                     {
-                        OSL_TRACE( "Property Alignment (legend) not found" );
+                        SAL_INFO("xmloff.chart", "Property Alignment (legend) not found" );
                     }
                 }
                 break;
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 8fef27b..a8663f5 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -121,12 +121,8 @@
     }
     catch( const uno::Exception & rEx )
     {
-#ifdef DBG_UTIL
         OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-        OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.getStr());
-#else
-        (void)rEx; // avoid warning for pro build
-#endif
+        SAL_INFO("xmloff.chart", "Exception caught for property NumberOfLines: " << aBStr);
     }
 }
 
@@ -184,7 +180,7 @@
 
         maSceneImportHelper.getCameraDefaultFromDiagram( mxDiagram );
     }
-    DBG_ASSERT( mxDiagram.is(), "Couldn't get XDiagram" );
+    SAL_WARN_IF( !mxDiagram.is(),"xmloff.chart", "Couldn't get XDiagram" );
 
     // turn off all axes initially
     uno::Any aFalseBool;
@@ -231,7 +227,7 @@
         }
         catch( const beans::UnknownPropertyException & )
         {
-            OSL_FAIL( "Property required by service not supported" );
+            SAL_WARN("xmloff.chart", "Property required by service not supported" );
         }
     }
 }
@@ -315,7 +311,7 @@
             }
             catch( const beans::UnknownPropertyException & )
             {
-                SAL_WARN( "xmloff.chart", "Properties missing" );
+                SAL_WARN("xmloff.chart", "Properties missing" );
             }
         }
     }
@@ -415,12 +411,8 @@
     }
     catch( const uno::Exception & rEx )
     {
-#ifdef DBG_UTIL
         OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-        OSL_TRACE("PlotAreaContext:EndElement(): Exception caught: %s", aBStr.getStr());
-#else
-        (void)rEx; // avoid warning for pro build
-#endif
+        SAL_INFO("xmloff.chart", "PlotAreaContext:EndElement(): Exception caught: " << aBStr);
     }
     } // if
 
@@ -589,12 +581,8 @@
             }
             catch( const uno::Exception & rEx )
             {
-#ifdef DBG_UTIL
                 OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-                OSL_TRACE( "Exception caught for property NumberOfLines: %s", aBStr.getStr());
-#else
-                (void)rEx; // avoid warning for pro build
-#endif
+                SAL_INFO("xmloff.chart", "Exception caught for property NumberOfLines: " << aBStr);
             }
         }
 
@@ -609,12 +597,8 @@
             }
             catch( const uno::Exception & rEx )
             {
-#ifdef DBG_UTIL
                 OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-                OSL_TRACE("Exception caught for property Volume: %s", aBStr.getStr());
-#else
-                (void)rEx; // avoid warning for pro build
-#endif
+                SAL_INFO("xmloff.chart", "Exception caught for property Volume: " << aBStr);
             }
         }
     }
@@ -1365,7 +1349,7 @@
                 xEqProp->setPropertyValue( OUString(  "RelativePosition" ),
                                            uno::makeAny( aRelPos ));
             }
-            OSL_ASSERT( mrRegressionStyle.meType == DataRowPointStyle::REGRESSION );
+            SAL_WARN_IF( mrRegressionStyle.meType != DataRowPointStyle::REGRESSION, "xmloff.chart", "mrRegressionStyle.meType != DataRowPointStyle::REGRESSION" );
             mrRegressionStyle.m_xEquationProperties.set( xEqProp );
         }
     }
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 527bbd5..148b735 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -282,7 +282,7 @@
 
 SchXMLSeries2Context::~SchXMLSeries2Context()
 {
-    OSL_ASSERT( maPostponedSequences.empty());
+    SAL_WARN_IF( !maPostponedSequences.empty(), "xmloff.chart", "maPostponedSequences is NULL");
 }
 
 void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
@@ -355,7 +355,7 @@
 
     try
     {
-        OSL_ASSERT( mxNewDoc.is());
+        SAL_WARN_IF( !mxNewDoc.is(), "xmloff.chart", "mxNewDoc is NULL");
         if( m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable && ! bHasRange )
             m_rGlobalSeriesImportInfo.rbAllRangeAddressesAvailable = sal_False;
 
@@ -445,12 +445,7 @@
     }
     catch( const uno::Exception & ex )
     {
-        (void)ex; // avoid warning for pro build
-        OSL_FAIL( OUStringToOString(
-                        OUString(  "Exception caught. Type: " ) +
-                        OUString::createFromAscii( typeid( ex ).name()) +
-                        OUString(  ", Message: " ) +
-                        ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+        SAL_WARN("xmloff.chart", "Exception caught. Type: " << OUString::createFromAscii( typeid( ex ).name()) << ", Message: " << ex.Message);
     }
 
     //init mbSymbolSizeIsMissingInFile:
@@ -840,9 +835,7 @@
             }
             catch( const uno::Exception & rEx )
             {
-                (void)rEx; // avoid warning for pro build
-                OSL_TRACE( "Exception caught during setting styles to series: %s",
-                                OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
             }
         }
     }
@@ -924,7 +917,7 @@
                 // not exist here
                 if( iStyle->meType == DataRowPointStyle::REGRESSION && iStyle->m_xEquationProperties.is())
                 {
-                    OSL_ASSERT( iStyle->m_xSeries.is());
+                    SAL_WARN_IF( !iStyle->m_xSeries.is(), "xmloff.chart", "iStyle->m_xSeries is NULL");
                     Reference< chart2::XRegressionCurve > xRegCurve( SchXMLTools::getRegressionCurve( iStyle->m_xSeries ));
                     if( xRegCurve.is())
                         xRegCurve->setEquationProperties( iStyle->m_xEquationProperties );
@@ -932,9 +925,7 @@
             }
             catch( const uno::Exception & rEx )
             {
-                (void)rEx; // avoid warning for pro build
-                OSL_TRACE( "Exception caught during setting styles to series: %s",
-                                OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                SAL_INFO("xmloff.chart", "Exception caught during setting styles to series: " << rEx.Message );
             }
         }
     }
@@ -1030,9 +1021,7 @@
             }
             catch( const uno::Exception & rEx )
             {
-                (void)rEx; // avoid warning for pro build
-                OSL_TRACE( "Exception caught during setting styles to data points: %s",
-                                    OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                SAL_INFO("xmloff.chart", "Exception caught during setting styles to data points: " << rEx.Message );
             }
         }
     }   // styles iterator
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.cxx b/xmloff/source/chart/SchXMLSeriesHelper.cxx
index b6b7a66..61f7ee1 100644
--- a/xmloff/source/chart/SchXMLSeriesHelper.cxx
+++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx
@@ -65,11 +65,7 @@
     }
     catch( const uno::Exception & ex )
     {
-        (void)ex; // avoid warning for pro build
-
-        OSL_FAIL( OUStringToOString( "Exception caught. Type: " +
-                        OUString::createFromAscii( typeid( ex ).name() ) +
-                        ", Message: " + ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+        SAL_WARN("xmloff.chart", "Exception caught. Type: " << OUString::createFromAscii( typeid( ex ).name() ) << ", Message: " << ex.Message );
     }
 
     return aResult;
@@ -121,7 +117,7 @@
 
         //iterate through all chart types in the current coordinate system
         uno::Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
-        OSL_ASSERT( xChartTypeContainer.is());
+        SAL_WARN_IF( !xChartTypeContainer.is(), "xmloff.chart", "xChartTypeContainer is NULL");
         if( !xChartTypeContainer.is() )
             continue;
         uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
@@ -131,7 +127,7 @@
 
             //iterate through all series in this chart type
             uno::Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
-            OSL_ASSERT( xDataSeriesContainer.is());
+            SAL_WARN_IF( !xDataSeriesContainer.is(), "xmloff.chart", "xDataSeriesContainer is NULL");
             if( !xDataSeriesContainer.is() )
                 continue;
 
@@ -201,9 +197,7 @@
         }
         catch( const uno::Exception & rEx )
         {
-            (void)rEx; // avoid warning for pro build
-            OSL_TRACE( "Exception caught SchXMLSeriesHelper::createOldAPISeriesPropertySet: %s",
-                        OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("xmloff.chart", "Exception caught SchXMLSeriesHelper::createOldAPISeriesPropertySet: " << rEx.Message );
         }
     }
 
@@ -239,10 +233,7 @@
         }
         catch( const uno::Exception & rEx )
         {
-            (void)rEx; // avoid warning for pro build
-
-            OSL_TRACE( "Exception caught SchXMLSeriesHelper::createOldAPIDataPointPropertySet: %s",
-                        OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+            SAL_INFO("xmloff.chart", "Exception caught SchXMLSeriesHelper::createOldAPIDataPointPropertySet: " << rEx.Message );
         }
     }
 
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 2c2ca93..206e5e8 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -125,7 +125,7 @@
                 {
                     if( nCol == 0 && rTable.bHasHeaderColumn )
                     {
-                        OSL_ASSERT( static_cast< sal_Int32 >( nRow ) == nRowOffset );
+                        SAL_WARN_IF( static_cast< sal_Int32 >( nRow ) != nRowOffset, "xmloff.chart", "nRow != nRowOffset" );
                         rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
                                                  aRangeId, lcl_aCategoriesRange ));
                     }
@@ -144,7 +144,7 @@
                 {
                     if( nRow == 0 && rTable.bHasHeaderRow )
                     {
-                        OSL_ASSERT( static_cast< sal_Int32 >( nCol ) == nColOffset );
+                        SAL_WARN_IF( static_cast< sal_Int32 >( nCol ) != nColOffset, "xmloff.chart", "nCol != nColOffset" );
                         rOutRangeMap.insert( lcl_tOriginalRangeToInternalRangeMap::value_type(
                                                  aRangeId, lcl_aCategoriesRange ));
                     }
@@ -308,9 +308,9 @@
 {
     if( mbHasColumnPermutation )
     {
-        OSL_ASSERT( !mbHasRowPermutation );
+        SAL_WARN_IF( mbHasRowPermutation, "xmloff.chart", "mbHasColumnPermutation is true" );
         ::std::vector< sal_Int32 > aPermutation( lcl_SequenceToVector( maColumnPermutation ));
-        OSL_ASSERT( !aPermutation.empty());
+        SAL_WARN_IF( aPermutation.empty(), "xmloff.chart", "aPermutation is NULL");
         if( aPermutation.empty())
             return;
 
@@ -321,7 +321,7 @@
             bool bModified = false;
             ::std::vector< SchXMLCell > aModifiedRow;
             const size_t nPermSize = aPermutation.size();
-            OSL_ASSERT( static_cast< sal_Int32 >( nPermSize ) - 1 == *(::std::max_element( aPermutation.begin(), aPermutation.end())));
+            SAL_WARN_IF( static_cast< sal_Int32 >( nPermSize ) - 1 != *(::std::max_element( aPermutation.begin(), aPermutation.end())), "xmloff.chart", "nPermSize - 1 != *(::std::max_element( aPermutation.begin(), aPermutation.end())");
             const size_t nRowSize = aRowIt->size();
             const size_t nDestSize = ::std::min( nPermSize, nRowSize );
             for( size_t nDestinationIndex = 0; nDestinationIndex < nDestSize; ++nDestinationIndex )
@@ -333,12 +333,12 @@
                     // copy original on first real permutation
                     if( !bModified )
                     {
-                        OSL_ASSERT( aModifiedRow.empty());
+                        SAL_WARN_IF( !aModifiedRow.empty(), "xmloff.chart", "aModifiedRow is NOT NULL");
                         aModifiedRow.reserve( aRowIt->size());
                         ::std::copy( aRowIt->begin(), aRowIt->end(), ::std::back_inserter( aModifiedRow ));
-                        OSL_ASSERT( !aModifiedRow.empty());
+                        SAL_WARN_IF( aModifiedRow.empty(), "xmloff.chart", "aModifiedRow is NULL");
                     }
-                    OSL_ASSERT( nDestinationIndex < aModifiedRow.size());
+                    SAL_WARN_IF( nDestinationIndex >= aModifiedRow.size(), "xmloff.chart", "nDestinationIndex >= aModifiedRow.size()");
                     aModifiedRow[ nDestinationIndex ] = (*aRowIt)[ nSourceIndex ];
                     bModified = true;
                 }
@@ -351,13 +351,13 @@
     else if( mbHasRowPermutation )
     {
         ::std::vector< sal_Int32 > aPermutation( lcl_SequenceToVector( maRowPermutation ));
-        OSL_ASSERT( !aPermutation.empty());
+        SAL_WARN_IF( aPermutation.empty(), "xmloff.chart", "aPermutation is NULL");
         if( aPermutation.empty())
             return;
 
         bool bModified = false;
         const size_t nPermSize = aPermutation.size();
-        OSL_ASSERT( static_cast< sal_Int32 >( nPermSize ) - 1 == *(::std::max_element( aPermutation.begin(), aPermutation.end())));
+        SAL_WARN_IF( static_cast< sal_Int32 >( nPermSize ) - 1 != *(::std::max_element( aPermutation.begin(), aPermutation.end())), "xmloff.chart", "nPermSize - 1 != *(::std::max_element( aPermutation.begin(), aPermutation.end())");
         const size_t nTableRowCount = mrTable.aData.size();
         const size_t nDestSize = ::std::min( nPermSize, nTableRowCount );
         ::std::vector< ::std::vector< SchXMLCell > > aDestination;
@@ -370,12 +370,12 @@
                 // copy original on first real permutation
                 if( !bModified )
                 {
-                    OSL_ASSERT( aDestination.empty());
+                    SAL_WARN_IF( !aDestination.empty(), "xmloff.chart", "aDestination is NOT NULL");
                     aDestination.reserve( mrTable.aData.size());
                     ::std::copy( mrTable.aData.begin(), mrTable.aData.end(), ::std::back_inserter( aDestination ));
-                    OSL_ASSERT( !aDestination.empty());
+                    SAL_WARN_IF( aDestination.empty(), "xmloff.chart", "aDestination is NULL");
                 }
-                OSL_ASSERT( nDestinationIndex < aDestination.size());
+                SAL_WARN_IF( nDestinationIndex >= aDestination.size(), "xmloff.chart", "nDestinationIndex >= aDestination.size()");
                 aDestination[ nDestinationIndex ] = mrTable.aData[ nSourceIndex ];
                 bModified = true;
             }
@@ -816,7 +816,7 @@
             const ::std::vector< SchXMLCell >& rFirstRow = rTable.aData.front();
             const sal_Int32 nColumnLabelsSize = aComplexColumnDescriptions.getLength();
             const sal_Int32 nMax = ::std::min< sal_Int32 >( nColumnLabelsSize, static_cast< sal_Int32 >( rFirstRow.size()) - nColOffset );
-            OSL_ASSERT( nMax == nColumnLabelsSize );
+            SAL_WARN_IF( nMax != nColumnLabelsSize, "xmloff.chart", "nMax != nColumnLabelsSize");
             for( sal_Int32 i=0; i<nMax; ++i )
                 lcl_ApplyCellToComplexLabel( rFirstRow[i+nColOffset], aComplexColumnDescriptions[i] );
         }
@@ -954,7 +954,7 @@
             }
             else // labels
             {
-                OSL_ASSERT( aLSeqIt->first.second == SCH_XML_PART_LABEL );
+                SAL_WARN_IF( aLSeqIt->first.second != SCH_XML_PART_LABEL, "xmloff.chart", "aLSeqIt->first.second != SCH_XML_PART_LABEL" );
                 // labels
                 Reference< chart2::data::XDataSequence > xSeq( aLSeqIt->second->getLabel());
                 OUString aRange;
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index 482f4f5..cc6a796 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -309,7 +309,7 @@
     if( rChartTypeService.match( aPrefix ))
     {
         sal_Int32 nSkip = aPrefix.getLength();
-        OSL_ASSERT( rChartTypeService.getLength() >= nSkip );
+        SAL_WARN_IF( rChartTypeService.getLength() < nSkip, "xmloff.chart", "ChartTypeService.getLength() < nSkip" );
         sal_Int32 nTypeLength = rChartTypeService.getLength() - nSkip - aPostfix.getLength();
         // if postfix matches and leaves a non-empty type
         if( nTypeLength > 0 && rChartTypeService.match( aPostfix, nSkip + nTypeLength ))
@@ -363,14 +363,14 @@
 
     if( !xChartDoc.is() )
     {
-        OSL_FAIL( "need a chart document" );
+        SAL_WARN("xmloff.chart", "need a chart document" );
         return xRet;
     }
 
     Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
     if( !xDataProvider.is() )
     {
-        OSL_FAIL( "need a data provider" );
+        SAL_WARN("xmloff.chart", "need a data provider" );
         return xRet;
     }
 
@@ -400,7 +400,7 @@
         }
         catch( const lang::IllegalArgumentException & )
         {
-            OSL_FAIL( "could not create data sequence" );
+            SAL_WARN("xmloff.chart", "could not create data sequence" );
         }
     }
 
@@ -416,7 +416,7 @@
         }
         catch( const lang::IllegalArgumentException & )
         {
-            OSL_FAIL( "could not create data sequence" );
+            SAL_WARN("xmloff.chart", "could not create data sequence" );
         }
     }
     return xRet;
@@ -446,7 +446,7 @@
                 if( nCooSysIndex < aCooSysSeq.getLength())
                 {
                     uno::Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[nCooSysIndex] );
-                    OSL_ASSERT( xCooSys.is());
+                    SAL_WARN_IF( !xCooSys.is(), "xmloff.chart", "xCooSys is NULL");
                     if( nDimensionIndex < xCooSys->getDimension() )
                     {
                         const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nDimensionIndex);
@@ -479,10 +479,7 @@
                                 }
                                 catch( const lang::IllegalArgumentException & ex )
                                 {
-                                    (void)ex; // avoid warning for pro build
-                                    OSL_FAIL( OUStringToOString(
-                                                    OUString(  "IllegalArgumentException caught, Message: " ) +
-                                                    ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+                                    SAL_WARN("xmloff.chart", "IllegalArgumentException caught, Message: " << ex.Message );
                                 }
                                 aData.Categories.set( xLabeledSeq );
                                 if( pLSequencesPerIndex )
@@ -502,7 +499,7 @@
     }
     catch( uno::Exception & )
     {
-        OSL_FAIL( "Exception caught while creating Categories" );
+        SAL_WARN("xmloff.chart", "Exception caught while creating Categories" );
     }
 }
 
@@ -655,10 +652,7 @@
     }
     catch( const uno::Exception & ex )
     {
-        (void)ex; // avoid warning for pro build
-        OSL_FAIL( OUStringToOString(
-                        OUString(  "Exception caught, Message: " ) +
-                        ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+        SAL_WARN("xmloff.chart", "Exception caught, Message: " << ex.Message );
     }
 }
 
@@ -685,10 +679,7 @@
         }
         catch( const uno::Exception & ex )
         {
-            (void)ex; // avoid warning for pro build
-            OSL_FAIL( OUStringToOString(
-                            OUString(  "Exception caught, Message: " ) +
-                            ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+            SAL_WARN("xmloff.chart", "Exception caught, Message: " << ex.Message );
         }
     }
     return bResult;
@@ -721,7 +712,7 @@
     }
     catch( const uno::Exception & )
     {
-        OSL_FAIL( "Copying property sets failed!" );
+        SAL_WARN("xmloff.chart", "Copying property sets failed!" );
     }
 }
 
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx
index 8f5f9e2..80dd860 100644
--- a/xmloff/source/chart/contexts.cxx
+++ b/xmloff/source/chart/contexts.cxx
@@ -80,12 +80,11 @@
         SvXMLImportContext( rImport, nPrefix, rLName ),
         mrImportHelper( rImpHelper )
 {
-    DBG_ASSERT( XML_NAMESPACE_OFFICE == nPrefix &&
-        ( IsXMLToken( rLName, XML_DOCUMENT ) ||
-          IsXMLToken( rLName, XML_DOCUMENT_META) ||
-          IsXMLToken( rLName, XML_DOCUMENT_STYLES) ||
-          IsXMLToken( rLName, XML_DOCUMENT_CONTENT) ),
-                "SchXMLDocContext instanciated with no <office:document> element" );
+    SAL_WARN_IF( (XML_NAMESPACE_OFFICE != nPrefix) ||
+        ( !IsXMLToken( rLName, XML_DOCUMENT ) &&
+          !IsXMLToken( rLName, XML_DOCUMENT_META) &&
+          !IsXMLToken( rLName, XML_DOCUMENT_STYLES) &&
+          !IsXMLToken( rLName, XML_DOCUMENT_CONTENT) ), "xmloff.chart", "SchXMLDocContext instanciated with no <office:document> element" );
 }
 
 SchXMLDocContext::~SchXMLDocContext()
@@ -177,9 +176,8 @@
         SvXMLImportContext( rImport, nPrefix, rLName ),
         mrImportHelper( rImpHelper )
 {
-    DBG_ASSERT( XML_NAMESPACE_OFFICE == nPrefix &&
-                IsXMLToken( rLName, XML_CHART ),
-                "SchXMLBodyContext instanciated with no <office:chart> element" );
+    SAL_WARN_IF( (XML_NAMESPACE_OFFICE != nPrefix) ||
+                !IsXMLToken( rLName, XML_CHART ), "xmloff.chart", "SchXMLBodyContext instanciated with no <office:chart> element" );
 }
 
 SchXMLBodyContext::~SchXMLBodyContext()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4db4a2db0f4f2e9913826f428ba129099b1ac8a8
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