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

Ioan Radu (via Code Review) gerrit at gerrit.libreoffice.org
Tue Apr 16 13:30:01 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3423

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/23/3423/1

fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT

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

Change-Id: Ie5d3ae7d2c5dbaaed30d0b39740748845c9f1641
---
M xmloff/source/chart/SchXMLAxisContext.cxx
M xmloff/source/chart/SchXMLChartContext.cxx
M xmloff/source/chart/SchXMLExport.cxx
3 files changed, 71 insertions(+), 103 deletions(-)



diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
index b14618f..1a83c20 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -180,7 +180,7 @@
             aPropName = "HasZAxisTitle";
             break;
         case SCH_XML_AXIS_UNDEF:
-            OSL_TRACE( "Invalid axis" );
+            SAL_INFO("xmloff.chart", "Invalid axis" );
             break;
     }
     xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) );
@@ -217,7 +217,7 @@
                 aPropName = "HasZAxisHelpGrid";
             break;
         case SCH_XML_AXIS_UNDEF:
-            OSL_TRACE( "Invalid axis" );
+            SAL_INFO("xmloff.chart", "Invalid axis" );
             break;
     }
     xDiaProp->setPropertyValue( aPropName, uno::makeAny(sal_True) );
@@ -364,7 +364,7 @@
     }
     catch( uno::Exception & )
     {
-        OSL_TRACE( "Couldn't get axis" );
+        SAL_INFO("xmloff.chart", "Couldn't get axis" );
     }
 
     return xAxis;
@@ -423,7 +423,7 @@
                 aPropName = "HasSecondaryXAxis";
             break;
         case SCH_XML_AXIS_UNDEF:
-            OSL_TRACE( "Invalid axis" );
+            SAL_INFO("xmloff.chart", "Invalid axis" );
             break;
     }
     try
@@ -432,7 +432,7 @@
     }
     catch( beans::UnknownPropertyException & )
     {
-        OSL_TRACE( "Couldn't turn on axis" );
+        SAL_INFO("xmloff.chart", "Couldn't turn on axis" );
     }
     if( m_aCurrentAxis.eDimension==SCH_XML_AXIS_Z )
     {
@@ -443,7 +443,7 @@
         }
         catch( beans::UnknownPropertyException & )
         {
-            OSL_TRACE( "Couldn't turn on z axis" );
+            SAL_INFO("xmloff.chart", "Couldn't turn on z axis" );
         }
         if( !bSettingZAxisSuccedded )
             return;
@@ -460,7 +460,7 @@
         }
         catch( beans::UnknownPropertyException & )
         {
-            OSL_TRACE( "Couldn't turn on x axis" );
+            SAL_INFO("xmloff.chart", "Couldn't turn on x axis" );
         }
     }
 
@@ -602,7 +602,7 @@
         }
         catch( beans::UnknownPropertyException & )
         {
-            OSL_TRACE( "Property String for Title not available" );
+            SAL_INFO("xmloff.chart", "Property String for Title not available" );
         }
     }
 }
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 034a2f6..5aeb93b 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -57,6 +57,7 @@
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
 #include <com/sun/star/chart2/XTitled.hpp>
 
+
 using namespace com::sun::star;
 using namespace ::xmloff::token;
 using com::sun::star::uno::Reference;
@@ -104,7 +105,7 @@
     }
     catch(const uno::Exception&)
     {
-        OSL_FAIL( "Exception caught while moving data to candlestick series" );
+        SAL_WARN("xmloff.chart", "Exception caught while moving data to candlestick series" );
     }
 }
 
@@ -163,7 +164,7 @@
     catch(const uno::Exception& ex)
     {
         OString aBStr(OUStringToOString(ex.Message, RTL_TEXTENCODING_ASCII_US));
-        OSL_TRACE( "Exception caught while removing empty chart types: %s", aBStr.getStr());
+        SAL_INFO("xmloff.chart", "Exception caught while removing empty chart types: " << aBStr);
     }
 }
 
@@ -246,7 +247,7 @@
     const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetChartAttrTokenMap();
 
     uno::Reference< embed::XVisualObject > xVisualObject( mrImportHelper.GetChartDocument(), uno::UNO_QUERY);
-    DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size");
+    SAL_WARN_IF(!xVisualObject.is(), "xmloff.chart", "need xVisualObject for page size");
     if( xVisualObject.is() )
         maChartSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ); //#i103460# take the size given from the parent frame as default
 
@@ -332,7 +333,7 @@
 
     if( aOldChartTypeName.isEmpty() )
     {
-        OSL_FAIL( "need a charttype to create a diagram" );
+        SAL_WARN("xmloff.chart", "need a charttype to create a diagram" );
         //set a fallback value:
         OUString aChartClass_Bar( GetXMLToken(XML_BAR ) );
         aOldChartTypeName = SchXMLTools::GetChartTypeByClassName( aChartClass_Bar, true /* bUseOldNames */ );
@@ -360,7 +361,7 @@
             }
             catch(const uno::Exception&)
             {
-                OSL_FAIL( "Exception during import SchXMLChartContext::StartElement" );
+                SAL_WARN("xmloff.chart", "Exception during import SchXMLChartContext::StartElement" );
             }
         }
     }
@@ -405,14 +406,14 @@
 
     void setSeriesStyleNameToPoint( const OUString& rStyleName, sal_Int32 nPointIndex )
     {
-        DBG_ASSERT(nPointIndex < static_cast<sal_Int32>(m_aSeriesStyles.size()),"donut point <-> series count mismatch");
+        SAL_WARN_IF(nPointIndex >= static_cast<sal_Int32>(m_aSeriesStyles.size()), "xmloff.chart", "donut point <-> series count mismatch");
         if( nPointIndex < static_cast<sal_Int32>(m_aSeriesStyles.size()) )
             m_aSeriesStyles[nPointIndex]=rStyleName;
     }
 
     void setPointStyleNameToPoint( const OUString& rStyleName, sal_Int32 nPointIndex )
     {
-        DBG_ASSERT(nPointIndex < static_cast<sal_Int32>(m_aPointStyles.size()),"donut point <-> series count mismatch");
+        SAL_WARN_IF(nPointIndex >= static_cast<sal_Int32>(m_aPointStyles.size()), "xmloff.chart", "donut point <-> series count mismatch");
         if( nPointIndex < static_cast<sal_Int32>(m_aPointStyles.size()) )
             m_aPointStyles[nPointIndex]=rStyleName;
     }
@@ -698,7 +699,7 @@
                 }
                 catch(const beans::UnknownPropertyException&)
                 {
-                    OSL_FAIL( "Property String for Title not available" );
+                    SAL_WARN("xmloff.chart", "Property String for Title not available" );
                 }
             }
         }
@@ -715,7 +716,7 @@
                 }
                 catch(const beans::UnknownPropertyException&)
                 {
-                    OSL_FAIL( "Property String for Title not available" );
+                    SAL_WARN("xmloff.chart", "Property String for Title not available" );
                 }
             }
         }
@@ -816,7 +817,7 @@
             catch(const uno::Exception&)
             {
                 //try to fallback to internal data
-                OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" );
+                SAL_WARN("xmloff.chart", "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" );
                 if(!bHasOwnData)
                 {
                     bHasOwnData = true;
@@ -831,7 +832,7 @@
                         }
                         catch(const uno::Exception&)
                         {
-                            OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" );
+                            SAL_WARN("xmloff.chart", "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" );
                         }
                     }
                 }
@@ -840,7 +841,7 @@
     }
     else
     {
-        OSL_FAIL( " Must not get here" );
+        SAL_WARN("xmloff.chart", "Must not get here" );
     }
 
     // now all series and data point properties are available and can be set
@@ -982,7 +983,7 @@
     }
     catch(const uno::Exception&)
     {
-        OSL_FAIL( "Exception while merging series for stock chart" );
+        SAL_WARN("xmloff.chart", "Exception while merging series for stock chart" );
     }
 }
 
@@ -1083,7 +1084,7 @@
                 if( xSupp.is())
                     mxDrawPage = uno::Reference< drawing::XShapes >( xSupp->getDrawPage(), uno::UNO_QUERY );
 
-                DBG_ASSERT( mxDrawPage.is(), "Invalid Chart Page" );
+                SAL_WARN_IF( !mxDrawPage.is(), "xmloff.chart", "Invalid Chart Page" );
             }
             if( mxDrawPage.is())
                 pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
@@ -1110,7 +1111,7 @@
     sal_Bool /* bSetSwitchData */ )
 {
     uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
-    DBG_ASSERT( xDoc.is(), "No valid document!" );
+    SAL_WARN_IF( !xDoc.is(), "xmloff.chart", "No valid document!" );
     uno::Reference< frame::XModel > xModel (xDoc, uno::UNO_QUERY );
 
     // Remove Title and Diagram ("De-InitNew")
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index ee01a6a..3c281f5 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -335,14 +335,14 @@
         for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i )
         {
             Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[i] );
-            OSL_ASSERT( xCooSys.is());
+            SAL_WARN_IF( !xCooSys.is(), "xmloff.chart", "xCooSys is NULL" );
             for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
             {
                 const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
                 for(sal_Int32 nI=0; nI<=nMaxAxisIndex; ++nI)
                 {
                     Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( nN, nI );
-                    OSL_ASSERT( xAxis.is());
+                    SAL_WARN_IF( !xAxis.is(), "xmloff.chart", "xAxis is NULL");
                     if( xAxis.is())
                     {
                         chart2::ScaleData aScaleData = xAxis->getScaleData();
@@ -359,11 +359,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;
@@ -475,11 +471,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 bResult;
@@ -923,8 +915,7 @@
     catch( const uno::Exception & rEx )
     {
         (void)rEx; // avoid warning for pro build
-        OSL_TRACE( OUStringToOString( OUString(
-                    "something went wrong during table data collection: " ) + rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr());
+        SAL_INFO("xmloff.chart", "something went wrong during table data collection: " << rEx.Message);
     }
 
     return aResult;
@@ -975,7 +966,7 @@
         {
 #ifdef DBG_UTIL
             OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-            OSL_TRACE( "chart:exporting error bar ranges: %s", aBStr.getStr());
+            SAL_INFO("xmloff.chart", "chart:exporting error bar ranges: " << aBStr );
 #else
             (void)rEx; // avoid warning
 #endif
@@ -1123,7 +1114,7 @@
                                       sal_Bool bIncludeTable )
 {
     parseDocument( rChartDoc, sal_True, bIncludeTable );
-    DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" );
+    SAL_WARN_IF( !maAutoStyleNameQueue.empty(), "xmloff.chart", "There are still remaining autostyle names in the queue" );
 }
 
 static OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ )
@@ -1157,7 +1148,7 @@
     Reference< chart2::XChartDocument > xNewDoc( rChartDoc, uno::UNO_QUERY );
     if( !rChartDoc.is() || !xNewDoc.is() )
     {
-        OSL_FAIL( "No XChartDocument was given for export." );
+        SAL_WARN("xmloff.chart", "No XChartDocument was given for export." );
         return;
     }
 
@@ -1219,7 +1210,7 @@
         }
         catch( const beans::UnknownPropertyException & )
         {
-            DBG_WARNING( "Required property not found in ChartDocument" );
+            SAL_WARN("xmloff.chart", "Required property not found in ChartDocument" );
         }
     }
 
@@ -1273,7 +1264,7 @@
         {
             enum XMLTokenEnum eXMLChartType = SchXMLTools::getTokenByChartType( sChartType, true /* bUseOldNames */ );
 
-            DBG_ASSERT( eXMLChartType != XML_TOKEN_INVALID, "invalid chart class" );
+            SAL_WARN_IF( eXMLChartType == XML_TOKEN_INVALID, "xmloff.chart", "invalid chart class" );
             if( eXMLChartType == XML_TOKEN_INVALID )
                 eXMLChartType = XML_BAR;
 
@@ -1431,7 +1422,7 @@
                 }
                 catch( const beans::UnknownPropertyException & )
                 {
-                    DBG_WARNING( "Property Align not found in ChartLegend" );
+                    SAL_WARN("xmloff.chart", "Property Align not found in ChartLegend" );
                 }
 
                 // export absolute legend position
@@ -1465,7 +1456,7 @@
                     }
                     catch( const beans::UnknownPropertyException & )
                     {
-                        DBG_WARNING( "Property Expansion not found in ChartLegend" );
+                        SAL_WARN("xmloff.chart", "Property Expansion not found in ChartLegend" );
                     }
                 }
             }
@@ -1507,7 +1498,7 @@
                 for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
                 {
                     mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
-                    DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
+                    SAL_WARN_IF( !xShape.is(), "xmloff.chart",  "Shape without an XShape?" );
                     if( ! xShape.is())
                         continue;
 
@@ -1528,11 +1519,7 @@
             catch( const uno::Exception & rEx )
             {
                 (void)rEx; // avoid warning for pro build
-                OSL_TRACE(
-                    OUStringToOString(
-                        OUString( "AdditionalShapes not found: " ) +
-                        rEx.Message,
-                        RTL_TEXTENCODING_ASCII_US ).getStr());
+                SAL_INFO("xmloff.chart", "AdditionalShapes not found: " << rEx.Message );
             }
 
             if( mxAdditionalShapes.is())
@@ -1542,11 +1529,11 @@
                 // ZOrder which might be (actually is) larger than the number of
                 // shapes in mxAdditionalShapes
                 Reference< drawing::XDrawPageSupplier > xSupplier( rChartDoc, uno::UNO_QUERY );
-                DBG_ASSERT( xSupplier.is(), "Cannot retrieve draw page to initialize shape export" );
+                SAL_WARN_IF( !xSupplier.is(), "xmloff.chart", "Cannot retrieve draw page to initialize shape export" );
                 if( xSupplier.is() )
                 {
                     Reference< drawing::XShapes > xDrawPage( xSupplier->getDrawPage(), uno::UNO_QUERY );
-                    DBG_ASSERT( xDrawPage.is(), "Invalid draw page for initializing shape export" );
+                    SAL_WARN_IF( !xDrawPage.is(), "xmloff.chart", "Invalid draw page for initializing shape export" );
                     if( xDrawPage.is())
                         mrExport.GetShapeExport()->seekShapes( xDrawPage );
                 }
@@ -1561,7 +1548,7 @@
                 for( sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++ )
                 {
                     mxAdditionalShapes->getByIndex( nShapeId ) >>= xShape;
-                    DBG_ASSERT( xShape.is(), "Shape without an XShape?" );
+                    SAL_WARN_IF( !xShape.is(), "xmloff.chart", "Shape without an XShape?" );
                     if( ! xShape.is())
                         continue;
 
@@ -1748,7 +1735,7 @@
                 ++aColumnDescriptions_RangeIter;
             }
         }
-        OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd );
+        SAL_WARN_IF( !bHasOwnData && (aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd), "xmloff.chart", "bHasOwnData == false && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd" );
     } // closing row and header-rows elements
 
     // export value rows
@@ -1829,8 +1816,8 @@
     }
 
     // if range iterator was used it should have reached its end
-    OSL_ASSERT( bHasOwnData || (aDataRangeIter == aDataRangeEndIter) );
-    OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) );
+    SAL_WARN_IF( !bHasOwnData && (aDataRangeIter != aDataRangeEndIter), "xmloff.chart", "bHasOwnData == false && aDataRangeIter != aDataRangeEndIter" );
+    SAL_WARN_IF( !bHasOwnData && (aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd), "xmloff.chart", "bHasOwnData == false && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd" );
 }
 
 namespace
@@ -1891,7 +1878,7 @@
     sal_Bool bExportContent,
     sal_Bool bIncludeTable )
 {
-    DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
+    SAL_WARN_IF( !xDiagram.is(), "xmloff.chart", "Invalid XDiagram as parameter" );
     if( ! xDiagram.is())
         return;
 
@@ -1958,7 +1945,7 @@
                     }
                     catch( const beans::UnknownPropertyException & )
                     {
-                        SAL_WARN( "xmloff.chart", "Properties missing" );
+                        SAL_WARN("xmloff.chart", "Properties missing" );
                     }
                 }
             }
@@ -1986,7 +1973,7 @@
             {
 #ifdef DBG_UTIL
                 OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-                OSL_TRACE("chart:TableNumberList property caught: %s", aBStr.getStr());
+                SAL_INFO("xmloff.chart", "chart:TableNumberList property caught: " << aBStr );
 #else
                 (void)rEx; // avoid warning
 #endif
@@ -2022,7 +2009,7 @@
             {
 #ifdef DBG_UTIL
                 OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-                OSL_TRACE( "chart:exportPlotAreaException caught: %s", aBStr.getStr());
+                SAL_INFO("xmloff.chart", "chart:exportPlotAreaException caught: " << aBStr);
 #else
                 (void)rEx; // avoid warning
 #endif
@@ -2203,7 +2190,7 @@
         return;
 
     Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY );
-    DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" );
+    SAL_WARN_IF( !xDiaPos.is(), "xmloff.chart", "Invalid xDiaPos as parameter" );
     if( !xDiaPos.is() )
         return;
 
@@ -2435,7 +2422,7 @@
     const Reference< chart2::XDiagram > & xNewDiagram,
     sal_Bool bExportContent )
 {
-    DBG_ASSERT( xDiagram.is(), "Invalid XDiagram as parameter" );
+    SAL_WARN_IF( !xDiagram.is(), "xmloff.chart", "Invalid XDiagram as parameter" );
     if( ! xDiagram.is())
         return;
 
@@ -2498,7 +2485,7 @@
 
     if ( ! aDiagramProperties.GetProperties ())
     {
-        DBG_WARNING ("Required properties not found in Chart diagram");
+        SAL_INFO("xmloff.chart", "Required properties not found in Chart diagram");
     }
 
     Reference< chart2::XCoordinateSystem > xCooSys( lcl_getCooSys(xNewDiagram) );
@@ -2738,11 +2725,7 @@
                             catch( const uno::Exception & rEx )
                             {
                                 (void)rEx; // avoid warning for pro build
-                                OSL_TRACE(
-                                    OUStringToOString(
-                                        OUString( "Series not found or no XPropertySet: " ) +
-                                        rEx.Message,
-                                        RTL_TEXTENCODING_ASCII_US ).getStr());
+                                SAL_INFO("xmloff.chart", "Series not found or no XPropertySet: " << rEx.Message );
                                 continue;
                             }
                             if( xPropSet.is())
@@ -2765,11 +2748,7 @@
                                 catch( const beans::UnknownPropertyException & rEx )
                                 {
                                     (void)rEx; // avoid warning for pro build
-                                    OSL_TRACE(
-                                        OUStringToOString(
-                                            OUString( "Required property not found in DataRowProperties: " ) +
-                                            rEx.Message,
-                                            RTL_TEXTENCODING_ASCII_US ).getStr());
+                                    SAL_INFO("xmloff.chart", "Required property not found in DataRowProperties: " << rEx.Message );
                                 }
 
                                 const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
@@ -2902,8 +2881,7 @@
                         catch( const uno::Exception & rEx )
                         {
                             (void)rEx; // avoid warning for pro build
-                            OSL_TRACE( "Exception caught during Export of series - optional DataMeanValueProperties not available: %s",
-                                        OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                            SAL_INFO("xmloff.chart", "Exception caught during Export of series - optional DataMeanValueProperties not available: " << rEx.Message );
                         }
 
                         if( xStatProp.is() )
@@ -2972,8 +2950,7 @@
     catch( const uno::Exception & rEx )
     {
         (void)rEx; // avoid warning for pro build
-        OSL_TRACE( "Exception caught during Export of series - optional DataRegressionProperties not available: %s",
-                    OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+        SAL_INFO("xmloff.chart", "Exception caught during Export of series - optional DataRegressionProperties not available: " << rEx.Message );
     }
 
     if( xStatProp.is() )
@@ -3098,10 +3075,7 @@
         catch( const beans::UnknownPropertyException & rEx )
         {
             (void)rEx; // avoid warning for pro build
-            OSL_TRACE(
-                OUStringToOString(OUString("Required property not found in DataRowProperties: " ) +
-                    rEx.Message,
-                    RTL_TEXTENCODING_ASCII_US ).getStr());
+            SAL_INFO("xmloff.chart", "Required property not found in DataRowProperties: " << rEx.Message );
         }
 
         if( nErrorBarStyle != chart::ErrorBarStyle::NONE && (bNegative || bPositive))
@@ -3314,7 +3288,7 @@
 
 
         sal_Int32 nSize = aDataPointSeq.getLength();
-        DBG_ASSERT( nSize <= nSeriesLength, "Too many point attributes" );
+        SAL_WARN_IF( nSize > nSeriesLength, "xmloff.chart", "Too many point attributes" );
 
         const sal_Int32 * pPoints = aDataPointSeq.getConstArray();
         sal_Int32 nElement;
@@ -3351,8 +3325,7 @@
                     catch( const uno::Exception & rEx )
                     {
                         (void)rEx; // avoid warning for pro build
-                        OSL_TRACE( "Exception caught during Export of data point: %s",
-                                    OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                        SAL_INFO("xmloff.chart", "Exception caught during Export of data point: " << rEx.Message );
                     }
                 }
                 else
@@ -3361,7 +3334,7 @@
                     xPropSet.set( new ::xmloff::chart::ColorPropertySet(
                                         xColorScheme->getColorByIndex( nElement )));
                 }
-                DBG_ASSERT( xPropSet.is(), "Pie Segments should have properties" );
+                SAL_WARN_IF( !xPropSet.is(), "xmloff.chart", "Pie Segments should have properties" );
                 if( xPropSet.is())
                 {
                     const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
@@ -3377,7 +3350,7 @@
                         if( bExportContent )
                         {
                             // write data-point with style
-                            DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+                            SAL_WARN_IF( maAutoStyleNameQueue.empty(), "xmloff.chart", "Autostyle queue empty!" );
 
                             SchXMLDataPointStruct aPoint;
                             aPoint.maStyleName = maAutoStyleNameQueue.front();
@@ -3391,8 +3364,7 @@
                     }
                 }
             }
-            DBG_ASSERT( !bExportContent || (static_cast<sal_Int32>(aDataPointList.size()) == nSeriesLength),
-                        "not enough data points on content export" );
+            SAL_WARN_IF( bExportContent && (static_cast<sal_Int32>(aDataPointList.size()) != nSeriesLength), "xmloff.chart", "not enough data points on content export" );
         }
         else
         {
@@ -3423,8 +3395,7 @@
                 catch( const uno::Exception & rEx )
                 {
                     (void)rEx; // avoid warning for pro build
-                    OSL_TRACE( "Exception caught during Export of data point: %s",
-                                OUStringToOString( rEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
+                    SAL_INFO("xmloff.chart", "Exception caught during Export of data point: " << rEx.Message );
                 }
                 if( xPropSet.is())
                 {
@@ -3441,7 +3412,7 @@
                         if( bExportContent )
                         {
                             // write data-point with style
-                            DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+                            SAL_WARN_IF( maAutoStyleNameQueue.empty(), "xmloff.chart", "Autostyle queue empty!" );
                             SchXMLDataPointStruct aPoint;
                             aPoint.maStyleName = maAutoStyleNameQueue.front();
                             maAutoStyleNameQueue.pop();
@@ -3563,7 +3534,7 @@
 {
     awt::Size aSize( 8000, 7000 );
     uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY );
-    DBG_ASSERT( xVisualObject.is(),"need XVisualObject for page size" );
+    SAL_WARN_IF( !xVisualObject.is(), "xmloff.chart", "need XVisualObject for page size" );
     if( xVisualObject.is() )
         aSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
 
@@ -3580,7 +3551,7 @@
 {
     if( !aStates.empty() )
     {
-        DBG_ASSERT( ! maAutoStyleNameQueue.empty(), "Autostyle queue empty!" );
+        SAL_WARN_IF( maAutoStyleNameQueue.empty(), "xmloff.chart", "Autostyle queue empty!" );
 
         mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_STYLE_NAME,  maAutoStyleNameQueue.front() );
         maAutoStyleNameQueue.pop();
@@ -3634,7 +3605,7 @@
 void SchXMLExport::_ExportMasterStyles()
 {
     // not available in chart
-    DBG_WARNING( "Master Style Export requested. Not available for Chart" );
+    SAL_INFO("xmloff.chart", "Master Style Export requested. Not available for Chart" );
 }
 
 void SchXMLExport::_ExportAutoStyles()
@@ -3650,7 +3621,7 @@
         }
         else
         {
-            OSL_FAIL( "Couldn't export chart due to wrong XModel (must be XChartDocument)" );
+            SAL_WARN("xmloff.chart", "Couldn't export chart due to wrong XModel (must be XChartDocument)" );
         }
     }
 }
@@ -3706,7 +3677,7 @@
                         }
                         catch( const beans::UnknownPropertyException & )
                         {
-                            OSL_FAIL( "Property ChartRangeAddress not supported by ChartDocument" );
+                            SAL_WARN("xmloff.chart", "Property ChartRangeAddress not supported by ChartDocument" );
                         }
                     }
                 }
@@ -3716,7 +3687,7 @@
     }
     else
     {
-        OSL_FAIL( "Couldn't export chart due to wrong XModel" );
+        SAL_WARN("xmloff.chart", "Couldn't export chart due to wrong XModel" );
     }
 }
 
@@ -3731,7 +3702,7 @@
         try
         {
             Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() );
-            OSL_ENSURE( xDataProvider.is(), "No DataProvider" );
+            SAL_WARN_IF( !xDataProvider.is(), "xmloff.chart", "No DataProvider" );
             if( xDataProvider.is())
             {
                 Reference< chart2::data::XDataSource > xDataSource( lcl_pressUsedDataIntoRectangularFormat( xChartDoc, mbHasCategoryLabels ));
@@ -3777,11 +3748,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);
         }
 }
 

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

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