Bug 264817 - [search] <char> + * returns 'null' from SearchPattern.getMatchingRegions(String, String, int)
Summary: [search] <char> + * returns 'null' from SearchPattern.getMatchingRegions(Stri...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 264822 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-13 04:25 EST by Dani Megert CLA
Modified: 2009-02-13 10:33 EST (History)
1 user (show)

See Also:


Attachments
Proposed patch (4.77 KB, patch)
2009-02-13 07:35 EST, Frederic Fusier CLA
no flags Details | Diff
Proposed patch+tests (4.77 KB, patch)
2009-02-13 08:01 EST, Frederic Fusier CLA
no flags Details | Diff
New proposed patch (1.94 KB, patch)
2009-02-13 09:09 EST, Frederic Fusier CLA
no flags Details | Diff

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