Timestamp.valueOf(LocalDateTime) should throw when conversion is not possible

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8u25
    • Component/s: core-libs
    • x86_64
    • linux_ubuntu

      FULL PRODUCT VERSION :
      java version "1.8.0_25"
      Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      Timestamp.valueOf(LocalDateTime) argument may represent dateTime that couldn't be converted to Timestamp.

      Timestamp.valueOf(LocalDateTime.MIN)
      gives 169087565-03-15 04:51:43.0.
      - should throw IllegalArgumentException.

      Timestamp.valueOf(LocalDateTime.MAX)
      gives 169104628-12-10 19:08:15.999999999
      - should throw IllegalArgumentException.

      Please fix javadoc too.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      new Timestamp(LocalDateTime.MIN.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());

      new Timestamp(LocalDateTime.MAX.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());


            Assignee:
            Lance Andersen
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: