Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334922 - CharOperation#match does not work as expected when isCaseSensitive is passed as false
Summary: CharOperation#match does not work as expected when isCaseSensitive is passed ...
Status: RESOLVED FIXED
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: 3.2.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Ian Tewksbury CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks: 333901 333903
  Show dependency tree
 
Reported: 2011-01-20 11:35 EST by Ian Tewksbury CLA
Modified: 2011-01-27 13:05 EST (History)
1 user (show)

See Also:
david_williams: pmc_approved+
thatnitind: pmc_approved? (raghunathan.srinivasan)
thatnitind: pmc_approved? (naci.dai)
thatnitind: pmc_approved? (deboer)
thatnitind: pmc_approved? (neil.hauge)
thatnitind: pmc_approved? (kaloyan)
thatnitind: review+


Attachments
fix patch (1.30 KB, patch)
2011-01-20 11:39 EST, Ian Tewksbury CLA
no flags Details | Diff
unit tests (1.77 KB, patch)
2011-01-26 21:13 EST, Nitin Dahyabhai CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Tewksbury CLA 2011-01-20 11:35:09 EST
When using the CharOperation#match method and isCaseSensitive the results are not always what you expect.  If you pass the same string for both the pattern and the path and thouse identical strings contain one capital letter match will return FALSE when TRUE would be epxected.

This is because in #match there is a bit of logic that says if isCaseSensitive is false then lowercase the character from the path but NOT the character from the pattern.

This needs to be updated so that if isCaseSensitive is set to false then both characters are lower cased.
Comment 1 Ian Tewksbury CLA 2011-01-20 11:39:01 EST
Created attachment 187210 [details]
fix patch

Needed fix.
Comment 2 Nitin Dahyabhai CLA 2011-01-26 21:13:58 EST
Created attachment 187706 [details]
unit tests
Comment 3 Nitin Dahyabhai CLA 2011-01-26 21:15:39 EST
* 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. 

This utility matching method doesn't correctly handle case insensitivity. As it is used when applying inclusion/exclusion filters to our project Include Path, it can cause us to index and process files not as intended.

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

No workaround.  Exclusion patterns and file paths could fail the match test incorrectly, affecting search results and indexing operations.

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

JUnit attached.

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

Corrects the logic in the test so that case insensitivity actually does what it should.

* What is the risk associated with this fix? 

Far-reaching, but low.
Comment 4 David Williams CLA 2011-01-27 00:26:42 EST
I'm fine with this fix, sounds better than it was. But ... I will remind you of all the nice ICU case checking methods that will automatically handle locale sensitive case differences for you (you know, like that lower/uppercase Turkish "i" problem :) Not sure if this is locale sensitive data (or, if already does call icu deep in the scanner code?) ... just reminding you. 

And, thanks for including a test case!
Comment 5 Nitin Dahyabhai CLA 2011-01-27 00:59:24 EST
Released.