Hi Kay,

Kay Ramme - Sun Germany - Hamburg wrote:

Just some (selected :-) examples:

        case PROPERTY_ID_REFVALUE :
147             OSL_VERIFY( _rValue >>= m_sReferenceValue );
148             calcValueExchangeType();
149             break;
150
151         case PROPERTY_ID_UNCHECKED_REFVALUE:
152 OSL_ENSURE( m_bSupportSecondRefValue, "OReferenceValueComponent::setFastPropertyValue_NoBroadcast: not this supported!" );
153             OSL_VERIFY( _rValue >>= m_sNoCheckReferenceValue );
154             break;
155
156                 case PROPERTY_ID_DEFAULTCHECKED :
157                         OSL_VERIFY( _rValue >>= m_nDefaultChecked );
158                         resetNoBroadcast();
159                         break;
160


Whether this use of OSL_VERIFY is correct or not depends on the context.

IIRC we have some helper classes that provide XPropertySet semantics using the template method pattern. That is, the helper class provides the external entry points and calls back (using virtual functions) to the derived class for some primitive operations.

If that class implements the follwing (simplified) protocol to set property values

  1. check (and possibly convert) value types using PropertySetInfo data
  2. validate values (and call veto listeners)
  3. really update data with the (now guaranteed correct) values
  4. notify change listeners

and the code above is ín the virtual 'callback' called during step 3, then this code is entitled to assume that the value passed in is of the correct type for the property being set. Probably that function is even required to assume that (i.e. its interface does not provide for signaling an 'invalid value' error).

If that is the case, then using OSL_VERIFY here is legitimate. If that assertion triggers it indicates a severe breakdown of invariants, which could be caused by a new bug in the helper class or by a mismatch of PropertySetInfo metadata and actual data type.

In either case this should trigger an assertion while testing and not just 'recover' from the error - which might actually cover it up.


Ciao, Joerg

--
Joerg Barfurth              Sun Microsystems - Desktop - Hamburg
>>>>>>>>>>>>>>>>>> using std::disclaimer <<<<<<<<<<<<<<<<<<<<<<<
Software Engineer                         [EMAIL PROTECTED]
OpenOffice.org Configuration          http://util.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to