Bug 264817

Summary: [search] <char> + * returns 'null' from SearchPattern.getMatchingRegions(String, String, int)
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: philippe_mulet
Version: 3.5   
Target Milestone: 3.5 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Proposed patch+tests
none
New proposed patch none

Description Dani Megert CLA 2009-02-13 04:25:36 EST
N20090212-2000.

<char> + * returns 'null' from SearchPattern.getMatchingRegions(String, String, int)
Comment 1 Frederic Fusier CLA 2009-02-13 06:32:12 EST
This problem comes from a bug in the original method: CharOperation.match(...).
When case is insensitive, only the name case is lowered, not the pattern one.
That means "ARRAY" matches the pattern "*rr*" (existing test in UtilTest), but "array" wrongly does not match the "*RR*" pattern...
Comment 2 Frederic Fusier CLA 2009-02-13 07:35:59 EST
Created attachment 125627 [details]
Proposed patch
Comment 3 Frederic Fusier CLA 2009-02-13 08:01:03 EST
Created attachment 125632 [details]
Proposed patch+tests

It also seems that I forgot to add tests I wrote in previous patch...
Comment 4 Frederic Fusier CLA 2009-02-13 09:04:55 EST
(In reply to comment #1)
> This problem comes from a bug in the original method: CharOperation.match(...).
> When case is insensitive, only the name case is lowered, not the pattern one.
> That means "ARRAY" matches the pattern "*rr*" (existing test in UtilTest), but
> "array" wrongly does not match the "*RR*" pattern...
> 
In fact this was not a problem but specified to work like this:
 * When not case sensitive, the pattern is assumed to already be lowercased, the
 * name will be lowercased character per character as comparing.

So, I'll fix this only in the StringOperation class...
Comment 5 Frederic Fusier CLA 2009-02-13 09:09:27 EST
Created attachment 125638 [details]
New proposed patch
Comment 6 Frederic Fusier CLA 2009-02-13 09:09:48 EST
Released for 3.5M6 in HEAD stream.
Comment 7 Frederic Fusier CLA 2009-02-13 09:10:19 EST
When verifying this bug fix, please note that it won't be possible to reproduce
the exception using any I-build as the problem has been fixed before the new
functionality was present in such a build...

The only build exhibiting this issue would be the N20090212-2000 build, but I'm
not sure it will be available.
Comment 8 Frederic Fusier CLA 2009-02-13 09:23:17 EST
*** Bug 264822 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2009-02-13 10:33:54 EST
Verified in HEAD.