24
24
import java .beans .PropertyVetoException ;
25
25
import java .beans .VetoableChangeListener ;
26
26
import java .beans .VetoableChangeSupport ;
27
+ import java .util .logging .Logger ;
27
28
28
29
/**
29
30
* <p>
130
131
*/
131
132
public abstract class AbstractBean {
132
133
134
+ private static final Logger LOG = Logger .getLogger (AbstractBean .class .getName ());
135
+
133
136
/**
134
137
* Helper class that manages all the property change notification machinery.
135
138
* PropertyChangeSupport cannot be extended directly because it requires
@@ -146,6 +149,7 @@ public abstract class AbstractBean {
146
149
/** Creates a new instance of AbstractBean */
147
150
protected AbstractBean () {
148
151
pcs = new PropertyChangeSupport (this );
152
+ // LOG.finest("this:"+this+" pcs=[" + pcs + "]");
149
153
vcs = new VetoableChangeSupport (this );
150
154
}
151
155
@@ -294,6 +298,12 @@ public final PropertyChangeListener[] getPropertyChangeListeners(String property
294
298
* @param newValue The new value of the property.
295
299
*/
296
300
protected final void firePropertyChange (String propertyName , Object oldValue , Object newValue ) {
301
+ // in some cases pcs is null, then we do nothing
302
+ // see org.jdesktop.swingx.painter.AbstractPainterTest with DummyPainter
303
+ if (pcs ==null ) {
304
+ LOG .warning ("Cannot fire PropertyChange for " +propertyName + " because PropertyChangeSupport instance is null." );
305
+ return ;
306
+ }
297
307
pcs .firePropertyChange (propertyName , oldValue , newValue );
298
308
}
299
309
0 commit comments