Bug 331770 - org.eclipse.jdt.core.tests.model.JavaSearchBugsTests.testBug323514a() is failing in N20101202-2000
Summary: org.eclipse.jdt.core.tests.model.JavaSearchBugsTests.testBug323514a() is fail...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-03 09:31 EST by Olivier Thomann CLA
Modified: 2010-12-07 00:29 EST (History)
3 users (show)

See Also:


Attachments
proposed fix (895 bytes, patch)
2010-12-06 04:39 EST, Ayushman Jain CLA
no flags Details | Diff
proposed fix extended to both tests (1.20 KB, patch)
2010-12-06 04:47 EST, Ayushman Jain CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.