Skip to main content

AbstractBean JavaDoc

1 reply [Last post]

If you look at the class JavaDoc for AbstractBean, it correctly points
out that if a listener fires a veto exception the property should not
change. However, the example code provided changes the value before the
listeners have a chance to throw an exception. My understanding is that
to update a constrained property value, a bean uses the following three
phase approach:

1. Notify all vetoable change listeners of the intent to change the
property value.
2. If none of the vetoable change listeners has thrown a
PropertyVetoException, then update the value of the property.
3. Notify the property change listeners to confirm that a change has

So I would have written the setFoo method to look something like this:

public void setFoo(String newFoo) throws PropertyVetoException {
String oldFoo = getFoo();
fireVetoableChange("foo", oldFoo, newFoo); // give listeners a chance
to throw a PropertyVetoException = newFoo; // update the value
firePropertyChange("foo", oldFoo, getFoo()); // notify listeners the
value has changed

Should the JavaDoc be corrected?


To unsubscribe, e-mail:
For additional commands, e-mail:

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Bruce Alspaugh schrieb:
> Should the JavaDoc be corrected?

yes - it's a semi-secret open issue

could you please file an issue (preferably with a patch)?


To unsubscribe, e-mail:
For additional commands, e-mail: