Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361767

Summary: TypeCastException is not thrown for some invalid assignments of strings to dates.
Product: z_Archived Reporter: Tom B <tmbarans>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Tom B CLA 2011-10-23 23:23:28 EDT
Build Identifier: EGL Development Tools (EDT)	0.7.0.v201110232102

I have noticed that in some cases the TypeCastException is not thrown when I assign a string to a date.

For example, i can do this:
invalidDate date = "40-40-2011";

No exception is thrown, even though the date is invalid

is this because the string is in the correct format (xx-xx-xxxx) even though it does not represent a valid date?

I've noticed that these don't throw exceptions either

invalidDate date = "1 3 4"; date is printed out as 0004-01-02
invalidDate date = "1&3&4";
invalidDate date = "12-34-5678";
invalidDate date = "12345678";
invalidDate date = "123456789";


Reproducible: Always

Steps to Reproduce:
1. Generate EDate009.egl for Java testing. The file can be found in
org.eclipse.edt.eunit.test/api.eglx_lang

2. Run the generated java program. The output shows that the expected error is not thrown when assigning dates from some strings that represent invalid dates
Comment 1 Jeff Douglas CLA 2011-10-25 08:45:32 EDT
fixed
Comment 2 Tom B CLA 2011-10-31 01:58:47 EDT
This still has not been fixed:

invalidDate date = "1&3&4";

everything else seems ok
Comment 3 Jeff Douglas CLA 2011-10-31 08:28:14 EDT
It is my opinion that the testcase is wrong. Any character can be used as the separator character, and in this case you are using &. This means that the date being accepted is valid as 01/03/0004.
Comment 4 Lisa Lasher CLA 2011-11-11 18:09:13 EST
closing the defect