RFR: 8327007: javax/swing/JSpinner/8008657/bug8008657.java fails [v2]

Prasanta Sadhukhan psadhukhan at openjdk.org
Mon Mar 4 05:19:02 UTC 2024


> Test failed with the exception java.lang.IllegalArgumentException: (start <= value <= end) with no history of failing till date.
> Investigation shows SpinnerDateModel constructor condition is not satisfied because
> It seems it's a leap year problem that is being manifested..
> 
> As per test,
> initDate Thu Feb 29 13:49:08 IST 2024 [ obtained by calendar.getTime();]
> earliestDate Tue Feb 28 13:49:08 IST 2023 [obtained by calendar.add(Calendar.YEAR, -1);]
> latestDate Wed Feb 28 13:49:08 IST 2024 [obtained by calendar.add(Calendar.YEAR, 1);]
> 
> Now, as per SpinnerDateModel constructor
> earliestDate <= initDate condition is satisfied
> but
> latestDate >= initDate is not
> so [start <= value <= end](https://github.com/openjdk/jdk/blob/998d0baab0fd051c38d9fd6021628eb863b80554/src/java.desktop/share/classes/javax/swing/SpinnerDateModel.java#L185) condition fails
> 
> Not sure it anything can be done in Calendar class for this but fix is done in test taking leapyear into account so that we add a day if it's a leapyear when we consecutively do Calendar.add(YEAR, -1) and Calendar.add(YEAR,1) on leapyear date of 29Feb

Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:

  Increment DAY_OF_MONTH to circumvent leapyear issue

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18054/files
  - new: https://git.openjdk.org/jdk/pull/18054/files/e285b4c1..20d888dd

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18054&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18054&range=00-01

  Stats: 13 lines in 1 file changed: 0 ins; 11 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/18054.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18054/head:pull/18054

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


More information about the client-libs-dev mailing list