RFR: 8177418: NPE is not apparent for methods in java.util.TimeZone API docs [v8]

Justin Lu jlu at openjdk.org
Wed Jan 25 20:21:11 UTC 2023


> When their input is null, the following methods in java.util.TimeZone throw a NullPointerException:
> 
> _TimeZone.getTimeZone(String ID)
> TimeZone.setID(String ID)
> TimeZone.inDaylightTime(Date date)_
> 
> For example, 
> 
> 
> String someID = null;
> TimeZone tz1 = TimeZone.getTimeZone(someID);
> ``` 
> 
> throws a `NullPointerException`
> 
> 
> This PR adds the missing  _ at throws:_ for the mentioned methods. The wording and specification is also adjusted for the overridable methods in TZ to use "_may throw_" over "_will throw_" because of the possibility of external sub-classes that may override the method.

Justin Lu has updated the pull request incrementally with one additional commit since the last revision:

  STZ.inDT can also be overriden

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/11888/files
  - new: https://git.openjdk.org/jdk/pull/11888/files/106624a0..7d6fc6e9

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11888&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11888&range=06-07

  Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11888.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11888/head:pull/11888

PR: https://git.openjdk.org/jdk/pull/11888


More information about the core-libs-dev mailing list