Skip to content

[BUG][JAVA] RFC3339DateFormat.clone raises NullPointerException #11704

@chriswhite199

Description

@chriswhite199
Description

The generated RFC3339DateFormat.clone() method defers to super.clone(), but the numberFormat field has not been initialized in the RFC3339DateFormat constructor, and so DateFormat.clone() raises a NullPointerException.

Full comment on #11311 (comment)

openapi-generator version

5.4.0

Suggest a fix

Amend modules/openapi-generator/src/main/resources/Java/RFC3339DateFormat.mustache constructor to:

  public RFC3339DateFormat() {
    this.calendar = new GregorianCalendar();
    this.numberFormat = new DecimalFormat();
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions