7072645: Toolkit.addPropertyChangeListener(name, pcl) throws NPE for null name

Reviewed-by: art
This commit is contained in:
Denis Fokin 2011-08-23 17:56:14 +04:00
parent c1db9a4de0
commit 2e4089a2c2
2 changed files with 8 additions and 0 deletions

View File

@ -1532,6 +1532,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
}
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
if (name == null) {
// See JavaDoc for the Toolkit.addPropertyChangeListener() method
return;
}
initXSettingsIfNeeded(name);
super.addPropertyChangeListener(name, pcl);
}

View File

@ -879,6 +879,10 @@ public class WToolkit extends SunToolkit implements Runnable {
}
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
if (name == null) {
// See JavaDoc for the Toolkit.addPropertyChangeListener() method
return;
}
if ( WDesktopProperties.isWindowsProperty(name)
|| name.startsWith(awtPrefix)
|| name.startsWith(dndPrefix))