diff options
author | Radu Ioan <ioan.radu.g@gmail.com> | 2013-04-21 18:49:52 +0300 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-22 08:16:49 +0000 |
commit | 671b73789b2b09384e278efa0b989560b6606e4f (patch) | |
tree | 538d1edeea02ca9e1271a9fcc217b5b250782437 | |
parent | ff4464659ec54732c45729ace964d60e77d19eb2 (diff) |
fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT
- replaced osl_trace with sal_info
- replaced dbg_* with sal_*
Change-Id: I4db4a2db0f4f2e9913826f428ba129099b1ac8a8
Reviewed-on: https://gerrit.libreoffice.org/3526
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r-- | xmloff/source/chart/SchXMLImport.cxx | 22 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLLegendContext.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLPlotAreaContext.cxx | 32 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLSeries2Context.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLSeriesHelper.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 30 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.cxx | 31 | ||||
-rw-r--r-- | xmloff/source/chart/contexts.cxx | 16 |
8 files changed, 60 insertions, 121 deletions
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 6f758c880339..91ba2825a44f 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -165,7 +165,7 @@ SvXMLImportContext* SchXMLImportHelper::CreateChartContext( } 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 @@ void SchXMLImportHelper::DeleteDataSeries( } 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 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries( } 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 @@ void SAL_CALL SchXMLImport::setTargetDocument( const uno::Reference< lang::XComp } 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 ba44bf3184ff..73b651fb0ffd 100644 --- a/xmloff/source/chart/SchXMLLegendContext.cxx +++ b/xmloff/source/chart/SchXMLLegendContext.cxx @@ -105,7 +105,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu } catch(const beans::UnknownPropertyException&) { - OSL_TRACE( "Property HasLegend not found" ); + SAL_INFO("xmloff.chart", "Property HasLegend not found" ); } } @@ -113,7 +113,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu 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 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu } 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 8fef27b02dbc..a8663f5437a4 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -121,12 +121,8 @@ void SchXML3DSceneAttributesHelper::getCameraDefaultFromDiagram( const uno::Refe } 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 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( 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 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( } 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 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri } catch( const beans::UnknownPropertyException & ) { - SAL_WARN( "xmloff.chart", "Properties missing" ); + SAL_WARN("xmloff.chart", "Properties missing" ); } } } @@ -415,12 +411,8 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri } 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 @@ void SchXMLPlotAreaContext::EndElement() } 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 @@ void SchXMLPlotAreaContext::EndElement() } 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 @@ void SchXMLEquationContext::StartElement( const uno::Reference< xml::sax::XAttri 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 527bbd51c436..148b7352c68f 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -282,7 +282,7 @@ SchXMLSeries2Context::SchXMLSeries2Context( 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 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib 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 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib } 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 @@ void SchXMLSeries2Context::setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDe } 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 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles // 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 @@ void SchXMLSeries2Context::setStylesToStatisticsObjects( SeriesDefaultsAndStyles } 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 @@ void SchXMLSeries2Context::setStylesToDataPoints( SeriesDefaultsAndStyles& rSeri } 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 b6b7a6656721..61f7ee1c241a 100644 --- a/xmloff/source/chart/SchXMLSeriesHelper.cxx +++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx @@ -65,11 +65,7 @@ using ::com::sun::star::uno::Sequence; } 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 @@ uno::Reference< chart2::XChartType > lcl_getChartTypeOfSeries( //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 @@ uno::Reference< chart2::XChartType > lcl_getChartTypeOfSeries( //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 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPISeriesProp } 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 @@ uno::Reference< beans::XPropertySet > SchXMLSeriesHelper::createOldAPIDataPointP } 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 2c2ca93babee..206e5e839227 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -125,7 +125,7 @@ void lcl_fillRangeMapping( { 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 @@ void lcl_fillRangeMapping( { 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 @@ void SchXMLTableContext::EndElement() { 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 @@ void SchXMLTableContext::EndElement() 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 @@ void SchXMLTableContext::EndElement() // 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 @@ void SchXMLTableContext::EndElement() 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 @@ void SchXMLTableContext::EndElement() // 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 @@ void SchXMLTableHelper::applyTableToInternalDataProvider( 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 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( } 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 482f4f525bb3..cc6a796b340f 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -309,7 +309,7 @@ XMLTokenEnum getTokenByChartType( 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 @@ Reference< chart2::data::XDataSequence > CreateDataSequence( 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 @@ Reference< chart2::data::XDataSequence > CreateDataSequence( } catch( const lang::IllegalArgumentException & ) { - OSL_FAIL( "could not create data sequence" ); + SAL_WARN("xmloff.chart", "could not create data sequence" ); } } @@ -416,7 +416,7 @@ Reference< chart2::data::XDataSequence > CreateDataSequence( } 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 @@ void CreateCategories( 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 @@ void CreateCategories( } 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 @@ void CreateCategories( } catch( uno::Exception & ) { - OSL_FAIL( "Exception caught while creating Categories" ); + SAL_WARN("xmloff.chart", "Exception caught while creating Categories" ); } } @@ -655,10 +652,7 @@ void setXMLRangePropertyAtDataSequence( } 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 @@ bool getXMLRangePropertyFromDataSequence( } 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 @@ void copyProperties( } 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 8f5f9e245b34..80dd860f9a02 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -80,12 +80,11 @@ SchXMLDocContext::SchXMLDocContext( SchXMLImportHelper& rImpHelper, 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 @@ SchXMLBodyContext::SchXMLBodyContext( SchXMLImportHelper& rImpHelper, 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() |