Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » [Neon] Change DateUtility.parse(String, String) not to parse dates leniently
[Neon] Change DateUtility.parse(String, String) not to parse dates leniently [message #1719468] Fri, 08 January 2016 03:51 Go to next message
Eclipse UserFriend
Currently the org.eclipse.scout.rt.platform.util.date.DateUtility.parse(String, String) method does not change the default lenient setting of SimpleDateFormat. The default setting of SimpleDateFormat however is lenient = true.

With this setting the parse method returns a best guess which date corresponds to the given String. Only if it is not possible to guess the date an exception is thrown.

For example the following parse operations result in the commented dates:

DateUtility.parse("942.790.2016", "dd.MM.yyyy"); // Sat Apr 29 00:00:00 CEST 2084
DateUtility.parse("13.13.2015", "dd.MM.yyyy"); // Wed Jan 13 00:00:00 CET 2016
DateUtility.parse("05.13.2015", "dd.MM.yyyy"); // Tue Jan 05 00:00:00 CET 2016
DateUtility.parse("29.02.2015", "dd.MM.yyyy"); // Sun Mar 01 00:00:00 CET 2015
DateUtility.parse("29.02.2016", "dd.MM.yyyy"); // Mon Feb 29 00:00:00 CET 2016


In my opinion this must not be the case (only the last line returns the date I would expect). I would propose to change this method to use lenient = false for future Scout releases. DateUtilityTest does not fail after this change.

Would you agree? Are there any other opinions?

[Updated on: Tue, 12 January 2016 00:23] by Moderator

Re: Change DateUtility.parse(String, String) not to parse dates leniently [message #1719787 is a reply to message #1719468] Tue, 12 January 2016 00:23 Go to previous messageGo to next message
Eclipse UserFriend
If there are no objections, I will include this change for the Neon release.

Proposed change: https://git.eclipse.org/r/#/c/64094

[Updated on: Tue, 12 January 2016 00:30] by Moderator

Re: Change DateUtility.parse(String, String) not to parse dates leniently [message #1719806 is a reply to message #1719787] Tue, 12 January 2016 03:30 Go to previous message
Eclipse UserFriend
Thank you for bringing this topic here. I never encountered the problem and I agree with you: if nobody complains, it means that it is OK (and anyone is free to continue the discussion).

I have written some comments on Gerrit.
Previous Topic:[Mars] [HowTO] Row-Level Granting
Next Topic:Problem with the @Replace annotation
Goto Forum:
  


Current Time: Mon Jul 14 22:13:51 EDT 2025

Powered by FUDForum. Page generated in 0.07345 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top