On Fri, 6 Jan 2023 22:38:13 GMT, Justin Lu <j...@openjdk.org> wrote:

> 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  _@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.

This pull request has now been integrated.

Changeset: 22c976a9
Author:    Justin Lu <j...@openjdk.org>
Committer: Naoto Sato <na...@openjdk.org>
URL:       
https://git.openjdk.org/jdk/commit/22c976a9b042b2d56e849ec8f9ef1dd3d146ca78
Stats:     19 lines in 2 files changed: 16 ins; 0 del; 3 mod

8177418: NPE is not apparent for methods in java.util.TimeZone API docs

Reviewed-by: lancea, naoto

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

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

Reply via email to