-
Bug
-
Resolution: Fixed
-
Normal
-
3.6.4, 5.0.11
-
Not environment dependent.
Once you set the displayed TimeZones property of a Datebox you can empty it no more.
Internal list in component is set to null:
if (dtzones != null && dtzones.isEmpty()) dtzones = null;
Then its size is retrieved:
for (int i = 0; i < _dtzones.size(); i++) {
And that ends with a NullPointerException.
org.zkoss.zul.Datebox.setDisplayedTimeZones()
/** * Sets a list of the time zones that will be displayed at the * client and allow user to select. * <p>If the {@link #getTimeZone()} is null, * the first time zone in the list is assumed. * @param dtzones a list of the time zones to display. * If empty, it assumed to be null. * @since 3.6.3 */ public void setDisplayedTimeZones(List dtzones) { if (dtzones != null && dtzones.isEmpty()) dtzones = null; if (_dtzones != dtzones) { _dtzones = dtzones; StringBuffer sb = new StringBuffer(); // FIXME NPE assured if you empty the list for (int i = 0; i < _dtzones.size(); i++) { if(i != 0) sb.append(","); TimeZone tz = (TimeZone)_dtzones.get(i); sb.append(tz.getID()); } smartUpdate("displayedTimeZones", sb.toString()); if (_tzone == null && _dtzones != null && _dtzones.get(0) != null) _tzone = (TimeZone)_dtzones.get(0); } }