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

Bug 316750

Summary: [misc] Compiler Util#isExcluded does not work when given path is file system absolute
Product: [WebTools] JSDT Reporter: Ian Tewksbury <itewksbu>
Component: GeneralAssignee: Ian Tewksbury <itewksbu>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun, neil.hauge
Version: 3.2Flags: cmjaun: pmc_approved? (david_williams)
cmjaun: pmc_approved? (raghunathan.srinivasan)
cmjaun: pmc_approved? (naci.dai)
cmjaun: pmc_approved? (deboer)
neil.hauge: pmc_approved+
cmjaun: pmc_approved? (kaloyan)
cmjaun: review+
thatnitind: review+
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard: PMC_approved
Attachments:
Description Flags
Fix Patch with JUnits
none
Fix Patch with JUnits - Update 1 none

Description Ian Tewksbury CLA 2010-06-14 08:25:06 EDT
org.eclipse.wst.jsdt.internal.compiler.util.Util#isExcluded does not work if given a path that is absolute to the file system as apposed to absolute or relative to the workspace.  This is because the matching paths are absolute or relative to the workspace path and the charicter path matching doesnt realize that 'C:\myworkspace\project1\file1.js' is the same as '\project1\file1.js'.  The user symptoms caused by this is that js files in un-opened library's get referenced by file system absolute path and then because of this issues come up when trying to calculate the documentation for a referenced library file.
Comment 1 Ian Tewksbury CLA 2010-06-14 08:44:27 EDT
Created attachment 171821 [details]
Fix Patch with JUnits

My fix is to add in a pathMatch method in the Util class that first verifies that both the path and the path matching pattern are either both workspace relative/absolute or file system absolute paths.  If they are not then the one that is not absolute to the file system gets converted to be.

I have also included 58 comprehensive JUnits to test all of the different permutations of paths that could be passed to Util#isExcluded.
Comment 2 Chris Jaun CLA 2010-06-21 14:26:41 EDT
Fix patch to use inclusion pattern.
Comment 3 Ian Tewksbury CLA 2010-06-21 14:50:29 EDT
Created attachment 172357 [details]
Fix Patch with JUnits - Update 1

Good eye.  Thanks Chris. All fixed.
Comment 4 Chris Jaun CLA 2010-07-02 15:08:35 EDT
    * Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 

It prevents hover help documentation from displaying in some circumstances where the doc is stored in a library.

    * Is there a work-around? If so, why do you believe the work-around is insufficient? 

No.

    * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 

Ian include many new junit test cases in his patch.

    * Give a brief technical overview. Who has reviewed this fix? 

The problem was the comparing of file paths to determine if certain hover help should be displayed. In some cases relatives paths were being returned and in some absolute paths were being returned. The current implementation did not correctly compare relative and absolute paths. Comment #1 by Ian explains the fix in more detail. It has been reviewed by Nitin and myself.

    * What is the risk associated with this fix? 

This fix is contained to displaying the hover help, so there is little risk to JSDT as a hole.
Comment 5 Chris Jaun CLA 2010-07-02 16:34:19 EDT
Patch checked in.