Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263711

SimpleDateFormat toInstant() lower time unit overflow into a higher one

    XMLWordPrintable

    Details

    • Subcomponent:
    • Verification:
      Not verified

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows, 1.8.0_281, 11.0.10

      A DESCRIPTION OF THE PROBLEM :
      Unparsable dates throw ParseException in java 8, but parsed without exception into an unexpected date in java 11-15
      Example class:
      class Main {
      public static void main(String[] args) throws java.text.ParseException {
      System.out.println(new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").parse("2000-13-40T100:100:100.1001Z").toInstant());
      }
      }

      Java 8:
      java.text.ParseException: Unparseable date: "2000-13-40T100:100:100.1001Z"

      Java 11+:
      2001-02-13T05:41:41.001Z


        Attachments

          Activity

            People

            Assignee:
            naoto Naoto Sato
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: