diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-09-21 05:27:30 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2016-09-21 05:27:30 +0200 |
commit | 7ecd33724fcfff08db1cfd963c68cd0ed83f98c2 (patch) | |
tree | 19cc39e99cedec64517873b194f332a158a6f54d /sc/source/filter/oox/pivotcachebuffer.cxx | |
parent | 0b5c4d382185c781ee5161b36bbe21be3db94a47 (diff) |
Improve warnings in pivot table code
Change-Id: I5230bcb4abbc720cc2177e26f8fa5b8969039624
Diffstat (limited to 'sc/source/filter/oox/pivotcachebuffer.cxx')
-rw-r--r-- | sc/source/filter/oox/pivotcachebuffer.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index 7de3dbb6d7d2..467b02d8edc2 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -833,8 +833,8 @@ OUString PivotCacheField::createDateGroupField( const Reference< XDataPilotField OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotField >& rxBaseDPField, const PivotCacheField& rBaseCacheField, PivotCacheGroupItemVector& orItemNames ) const { - OSL_ENSURE( hasGroupItems() && !maDiscreteItems.empty(), "PivotCacheField::createParentGroupField - not a group field" ); - OSL_ENSURE( maDiscreteItems.size() == orItemNames.size(), "PivotCacheField::createParentGroupField - number of item names does not match grouping info" ); + SAL_WARN_IF( !hasGroupItems() || maDiscreteItems.empty(), "sc", "PivotCacheField::createParentGroupField - not a group field" ); + SAL_WARN_IF( maDiscreteItems.size() != orItemNames.size(), "sc", "PivotCacheField::createParentGroupField - number of item names does not match grouping info" ); Reference< XDataPilotFieldGrouping > xDPGrouping( rxBaseDPField, UNO_QUERY ); if( !xDPGrouping.is() ) return OUString(); @@ -860,7 +860,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie Reference< XDataPilotField > xDPGroupField; for( GroupItemMap::iterator aBeg = aItemMap.begin(), aIt = aBeg, aEnd = aItemMap.end(); aIt != aEnd; ++aIt ) { - OSL_ENSURE( !aIt->empty(), "PivotCacheField::createParentGroupField - item/group should not be empty" ); + SAL_WARN_IF( aIt->empty(), "sc", "PivotCacheField::createParentGroupField - item/group should not be empty" ); if( !aIt->empty() ) { /* Insert the names of the items that are part of this group. Calc @@ -882,7 +882,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie { // only the first call of createNameGroup() returns the new field Reference< XDataPilotField > xDPNewField = xDPGrouping->createNameGroup( ContainerHelper::vectorToSequence( aMembers ) ); - OSL_ENSURE( xDPGroupField.is() != xDPNewField.is(), "PivotCacheField::createParentGroupField - missing group field" ); + SAL_WARN_IF( xDPGroupField.is() == xDPNewField.is(), "sc", "PivotCacheField::createParentGroupField - missing group field" ); if( !xDPGroupField.is() ) xDPGroupField = xDPNewField; @@ -918,14 +918,15 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie } catch( Exception& ) { + SAL_WARN("sc", "PivotCacheField::createParentGroupField - exception was thrown" ); } - OSL_ENSURE( !aAutoName.isEmpty(), "PivotCacheField::createParentGroupField - cannot find auto-generated group name" ); + SAL_WARN_IF( aAutoName.isEmpty(), "sc", "PivotCacheField::createParentGroupField - cannot find auto-generated group name" ); // get the real group name from the list of group items OUString aGroupName; if( const PivotCacheItem* pGroupItem = maGroupItems.getCacheItem( static_cast< sal_Int32 >( aIt - aBeg ) ) ) aGroupName = pGroupItem->getName(); - OSL_ENSURE( !aGroupName.isEmpty(), "PivotCacheField::createParentGroupField - cannot find group name" ); + SAL_WARN_IF( aGroupName.isEmpty(), "sc", "PivotCacheField::createParentGroupField - cannot find group name" ); if( aGroupName.isEmpty() ) aGroupName = aAutoName; @@ -945,6 +946,7 @@ OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotFie } catch( Exception& ) { + SAL_WARN("sc", "PivotCacheField::createParentGroupField - exception was thrown" ); } } } |