Kaydet (Commit) a7e184e8 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#706514 Uncaught exception

also
coverity#706515
coverity#706516
coverity#706517
coverity#706528
coverity#706529

Change-Id: I5beb753d5cc8ed976b3c11319cc36415adebd1e6
üst 120a04d6
......@@ -85,7 +85,7 @@ namespace pcr
PropertyState SAL_CALL ButtonNavigationHandler::getPropertyState( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
PropertyState eState = PropertyState_DIRECT_VALUE;
switch ( nPropId )
{
......@@ -114,7 +114,7 @@ namespace pcr
Any SAL_CALL ButtonNavigationHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
Any aReturn;
switch ( nPropId )
......@@ -145,7 +145,7 @@ namespace pcr
void SAL_CALL ButtonNavigationHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
switch ( nPropId )
{
case PROPERTY_ID_BUTTONTYPE:
......@@ -208,7 +208,7 @@ namespace pcr
InteractiveSelectionResult SAL_CALL ButtonNavigationHandler::onInteractivePropertySelection( const OUString& _rPropertyName, sal_Bool _bPrimary, Any& _rData, const Reference< XObjectInspectorUI >& _rxInspectorUI ) throw (UnknownPropertyException, NullPointerException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
InteractiveSelectionResult eReturn( InteractiveSelectionResult_Cancelled );
......@@ -229,7 +229,7 @@ namespace pcr
void SAL_CALL ButtonNavigationHandler::actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const Any& /*_rNewValue*/, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool /*_bFirstTimeInit*/ ) throw (NullPointerException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
switch ( nPropId )
{
case PROPERTY_ID_BUTTONTYPE:
......@@ -255,7 +255,7 @@ namespace pcr
LineDescriptor SAL_CALL ButtonNavigationHandler::describePropertyLine( const OUString& _rPropertyName, const Reference< XPropertyControlFactory >& _rxControlFactory ) throw (UnknownPropertyException, NullPointerException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
LineDescriptor aReturn;
......
......@@ -103,9 +103,9 @@ namespace pcr
void SAL_CALL CellBindingPropertyHandler::actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const Any& _rNewValue, const Any& /*_rOldValue*/, const Reference< XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (NullPointerException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
OSL_PRECOND( m_pHelper.get(), "CellBindingPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwRuntime, we should have a helper, since no helper implies no properties
OSL_PRECOND( _rxInspectorUI.is(), "FormComponentPropertyHandler::actuatingPropertyChanged: no access to the UI!" );
if ( !_rxInspectorUI.is() )
......@@ -231,10 +231,10 @@ namespace pcr
Any SAL_CALL CellBindingPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::getPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
Any aReturn;
switch ( nPropId )
......@@ -277,10 +277,10 @@ namespace pcr
void SAL_CALL CellBindingPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "CellBindingPropertyHandler::setPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
try
{
......
......@@ -79,7 +79,7 @@ namespace pcr
Any SAL_CALL EditPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
Any aReturn;
try
......@@ -135,7 +135,7 @@ namespace pcr
void SAL_CALL EditPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
try
{
......@@ -264,7 +264,7 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
switch ( nActuatingPropId )
{
case PROPERTY_ID_TEXTTYPE:
......
......@@ -96,10 +96,10 @@ namespace pcr
Any SAL_CALL EFormsPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::getPropertyValue: we don't have any SupportedProperties!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
Any aReturn;
try
......@@ -159,10 +159,10 @@ namespace pcr
void SAL_CALL EFormsPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "EFormsPropertyHandler::setPropertyValue: we don't have any SupportedProperties!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
try
{
......@@ -418,7 +418,7 @@ namespace pcr
LineDescriptor aDescriptor;
sal_Int16 nControlType = PropertyControlType::TextField;
::std::vector< OUString > aListEntries;
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
switch ( nPropId )
{
case PROPERTY_ID_LIST_BINDING:
......@@ -482,7 +482,7 @@ namespace pcr
if ( !m_pHelper.get() )
return InteractiveSelectionResult_Cancelled;
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
(void)nPropId;
OSL_ENSURE( ( PROPERTY_ID_BINDING_NAME == nPropId )
|| ( PROPERTY_ID_BIND_EXPRESSION == nPropId )
......@@ -555,9 +555,9 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
OSL_PRECOND( m_pHelper.get(), "EFormsPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwRuntime, we should have a helper, since no helper implies no properties
DBG_ASSERT( _rxInspectorUI.is(), "EFormsPropertyHandler::actuatingPropertyChanged: invalid callback!" );
if ( !_rxInspectorUI.is() )
......
......@@ -244,7 +244,7 @@ namespace pcr
Any FormComponentPropertyHandler::impl_getPropertyValue_throw( const OUString& _rPropertyName ) const
{
const PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
const PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) );
......@@ -322,7 +322,7 @@ namespace pcr
}
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) ); // check if property is known by the handler
Reference< graphic::XGraphicObject > xGrfObj;
if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
......@@ -492,7 +492,7 @@ namespace pcr
Any SAL_CALL FormComponentPropertyHandler::convertToPropertyValue( const OUString& _rPropertyName, const Any& _rControlValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
Any aPropertyValue( _rControlValue );
......@@ -968,7 +968,7 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
Property aProperty( impl_getPropertyFromId_throw( nPropId ) );
......@@ -1418,7 +1418,7 @@ namespace pcr
throw NullPointerException();
::osl::ClearableMutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
InteractiveSelectionResult eResult = InteractiveSelectionResult_Cancelled;
switch ( nPropId )
......
......@@ -330,7 +330,7 @@ namespace pcr
Any SAL_CALL FormGeometryHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this );
ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: no shape properties!", *this );
......@@ -379,7 +379,7 @@ namespace pcr
void SAL_CALL FormGeometryHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
ENSURE_OR_THROW2( m_xAssociatedShape.is(), "internal error: properties, but no shape!", *this );
ENSURE_OR_THROW2( m_xShapeProperties.is(), "internal error: properties, but no shape!", *this );
......@@ -447,7 +447,7 @@ namespace pcr
throw (UnknownPropertyException, NullPointerException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
LineDescriptor aLineDesc( PropertyHandler::describePropertyLine( _rPropertyName, _rxControlFactory ) );
try
......
......@@ -185,7 +185,7 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
const Property& rProperty( impl_getPropertyFromId_throw( nPropId ) );
LineDescriptor aDescriptor;
......@@ -312,7 +312,7 @@ namespace pcr
return PropertyHandlerHelper::getDialogParentWindow( m_xContext );
}
PropertyId PropertyHandler::impl_getPropertyId_throw( const OUString& _rPropertyName ) const
PropertyId PropertyHandler::impl_getPropertyId_throwUnknownProperty( const OUString& _rPropertyName ) const
{
PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
if ( nPropId == -1 )
......@@ -320,6 +320,14 @@ namespace pcr
return nPropId;
}
PropertyId PropertyHandler::impl_getPropertyId_throwRuntime( const OUString& _rPropertyName ) const
{
PropertyId nPropId = m_pInfoService->getPropertyId( _rPropertyName );
if ( nPropId == -1 )
throw RuntimeException();
return nPropId;
}
PropertyId PropertyHandler::impl_getPropertyId_nothrow( const OUString& _rPropertyName ) const
{
return m_pInfoService->getPropertyId( _rPropertyName );
......
......@@ -144,7 +144,14 @@ namespace pcr
@throw com::sun::star::beans::UnknownPropertyException
if the property name is not known to our ->m_pInfoService
*/
PropertyId impl_getPropertyId_throw( const OUString& _rPropertyName ) const;
PropertyId impl_getPropertyId_throwUnknownProperty( const OUString& _rPropertyName ) const;
/** retrieves the property id for a given property name
@throw com::sun::star::uno::RuntimeException
if the property name is not known to our ->m_pInfoService
*/
PropertyId impl_getPropertyId_throwRuntime( const OUString& _rPropertyName ) const;
/** retrieves the property id for a given property name
@returns -1
......
......@@ -121,10 +121,10 @@ namespace pcr
Any SAL_CALL SubmissionPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::getPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
Any aReturn;
try
......@@ -170,10 +170,10 @@ namespace pcr
void SAL_CALL SubmissionPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "SubmissionPropertyHandler::setPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
try
{
......@@ -288,7 +288,7 @@ namespace pcr
RuntimeException();
::std::vector< OUString > aListEntries;
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
switch ( nPropId )
{
case PROPERTY_ID_SUBMISSION_ID:
......@@ -324,9 +324,9 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
OSL_PRECOND( m_pHelper.get(), "SubmissionPropertyHandler::actuatingPropertyChanged: inconsistentcy!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwRuntime, we should have a helper, since no helper implies no properties
switch ( nActuatingPropId )
{
......
......@@ -102,10 +102,10 @@ namespace pcr
Any SAL_CALL XSDValidationPropertyHandler::getPropertyValue( const OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "XSDValidationPropertyHandler::getPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
Any aReturn;
::rtl::Reference< XSDDataType > pType = m_pHelper->getValidatingDataType();
......@@ -132,10 +132,10 @@ namespace pcr
void SAL_CALL XSDValidationPropertyHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) throw (UnknownPropertyException, RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
OSL_ENSURE( m_pHelper.get(), "XSDValidationPropertyHandler::getPropertyValue: inconsistency!" );
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwUnknownProperty, we should have a helper, since no helper implies no properties
if ( PROPERTY_ID_XSD_DATA_TYPE == nPropId )
{
......@@ -300,7 +300,7 @@ namespace pcr
if ( !m_pHelper.get() )
throw RuntimeException();
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
LineDescriptor aDescriptor;
if ( nPropId != PROPERTY_ID_XSD_DATA_TYPE )
......@@ -436,7 +436,7 @@ namespace pcr
if ( !m_pHelper.get() )
return InteractiveSelectionResult_Cancelled;
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) );
PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) );
switch ( nPropId )
{
......@@ -569,10 +569,10 @@ namespace pcr
throw NullPointerException();
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nActuatingPropId( impl_getPropertyId_throw( _rActuatingPropertyName ) );
PropertyId nActuatingPropId( impl_getPropertyId_throwRuntime( _rActuatingPropertyName ) );
if ( !m_pHelper.get() )
throw RuntimeException();
// if we survived impl_getPropertyId_throw, we should have a helper, since no helper implies no properties
// if we survived impl_getPropertyId_throwRuntime, we should have a helper, since no helper implies no properties
switch ( nActuatingPropId )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment