Bug 331770

Summary: org.eclipse.jdt.core.tests.model.JavaSearchBugsTests.testBug323514a() is failing in N20101202-2000
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, satyam.kandula, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7 M4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
proposed fix
none
proposed fix extended to both tests none

Description Olivier Thomann CLA 2010-12-03 09:31:30 EST
It looks like for some reason the jar file was not deleted or its index not flushed.

I cannot reproduce locally.
Comment 1 Satyam Kandula CLA 2010-12-03 23:37:03 EST
(In reply to comment #0)
> It looks like for some reason the jar file was not deleted or its index not
> flushed.
> 
> I cannot reproduce locally.
This failed only on Mac. 
One possible reason: There is no change in the timestamp for the new jar.
Comment 2 Ayushman Jain CLA 2010-12-06 04:27:36 EST
This seems to happen because of a file system limitation. Mac's filesystem doesnt support millisecond timestamps, and because of this sometimes when the updation of the jar file happens within milliseconds, the File.lastModified() returns the same timestamp. Making the thread to sleep for atleast a second solves this issue.

http://stackoverflow.com/questions/2717936/file-createnewfile-creates-files-with-last-modified-time-before-actual-creation
Comment 3 Ayushman Jain CLA 2010-12-06 04:39:43 EST
Created attachment 184578 [details]
proposed fix
Comment 4 Satyam Kandula CLA 2010-12-06 04:42:16 EST
(In reply to comment #3)
> Created an attachment (id=184578) [details]
> proposed fix
The change looks good for me. +1 for the patch.
Comment 5 Ayushman Jain CLA 2010-12-06 04:47:21 EST
Created attachment 184579 [details]
proposed fix extended to both tests

Putting the sleep in test b as well, for precaution.

Thanks for the help Satyam.
Comment 6 Ayushman Jain CLA 2010-12-06 04:58:27 EST
Released in HEAD for 3.7M4
Comment 7 Srikanth Sankaran CLA 2010-12-07 00:29:31 EST
Verified for 3.7M4 by code inspection.