Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003574 [Squeak] Collections major always 05-09-06 07:08 04-18-10 22:05
Reporter johnmci View Status public  
Assigned To andreas
Priority normal Resolution fixed  
Status closed   Product Version 3.9
Summary 0003574: String>>findFirstInString:inSet:startingAt: does not work if character of interest is last character in String, also WideString
Description IN the XMLWriter class try

String findFirstInString: ' "' inSet: XMLTranslationMap startingAt: 1.

This should return 2, because " is an entry in the XMLTranslationMap, however it return 0, because the code does not consider the last character in the string could be a character we are interested in.

Perhaps code should look like

String>>findFirstInString: aString inSet: inclusionMap startingAt: start
    "Trivial, non-primitive version"
    | i stringSize ascii more |
    inclusionMap size ~= 256 ifTrue: [^ 0].
    stringSize _ aString size.
    more _ true.
    i _ start - 1.
    [more and: [i + 1 <= stringSize]] whileTrue: [
        i _ i + 1.
        ascii _ (aString at: i) asciiValue.
        more _ ascii < 256 ifTrue: [(inclusionMap at: ascii + 1) = 0] ifFalse: [true].
    ].
    (more not and: [i = stringSize]) ifTrue: [^i].
    i + 1 > stringSize ifTrue: [^ 0].
    ^ i

Also see WideString which is also I think is broken.
Additional Information
Attached Files  Collection-String-IndexOf-Patch.1.cs [^] (612 bytes) 05-09-06 20:17
 Collection-String-IndexOf-Test.1.cs [^] (1,559 bytes) 05-09-06 20:27
 Collection-String-IndexOf-Patch.2.cs [^] (8,528 bytes) 05-10-06 00:27
 Collection-String-IndexOf-Test.2.cs [^] (1,987 bytes) 05-10-06 00:27
 Collection-String-IndexOf-Patch.3.cs [^] (8,536 bytes) 03-15-07 20:04
 Collection-String-IndexOf-Test.3.cs [^] (2,165 bytes) 03-15-07 20:05
 WideCharacterSet-M3574-Patch.1.cs [^] (469 bytes) 09-25-07 19:06
 WideCharacterSet-M3574-nice-hashPatch.1.cs [^] (832 bytes) 11-15-07 20:26
 WideCharacterSet-M3574-nice-newFrom.1.cs [^] (552 bytes) 11-15-07 21:34
 WideCharacterSet-M3574-nice-Test.1.cs [^] (3,501 bytes) 11-19-07 22:32
 WideCharacterSet-copy-Test-M3574-nice.1.cs [^] (646 bytes) 11-19-07 23:50
 WideCharacterSet-copy-Patch-M3574-nice.1.cs [^] (729 bytes) 11-19-07 23:50

- Relationships

SYSTEM WARNING: Creating default object from empty value

related to 0006366closed andreas [BUG] WideString findString:startingAt: and other matchTable problems 
related to 0005331closed andreas 'abc' beginsWith: 'ab' asWideString (returns wrong result) 

- Notes
(0004895 - 201 - 222 - 222 - 222 - 222 - 222)
nicolas cellier
05-09-06 20:20

[FIX] provided in attachment.

With this patch, we can now search for ordinary characters (asciiValue < 256) in WideString.
This patch still does not handle searching the index of wide characters...
 
(0004896 - 277 - 319 - 319 - 319 - 319 - 319)
nicolas cellier
05-10-06 00:26
edited on: 05-10-06 00:58

[FIX] second fix and test in attachment

Now, there is a WideCharacterSet transparentely handling Wide Characters (thanks to CharacterSet>>become:).

We can search wide Characters in ByteString (use existing primitive with byte character subsets), and also in WideString.

 
(0005946 - 13 - 13 - 13 - 13 - 13 - 13)
MarcusDenker
07-15-06 18:03

test is added
 
(0008793 - 133 - 133 - 133 - 133 - 133 - 133)
black
01-02-07 22:24

This fix was posted 7 months ago. Unless there is reason to believe that it is defective, isn't it time to include it in the image?
 
(0008828 - 179 - 233 - 233 - 233 - 233 - 233)
Keith_Hodges
01-05-07 09:25

"fix begin"
Installer mantis bug: 3574 fix: 'Collection-String-IndexOf-Patch.2.cs'.
"fix test"
Installer mantis bug: 3574 fix: 'Collection-String-IndexOf-Test.2.cs'.
"fix end"
 
(0010444 - 315 - 782 - 782 - 782 - 782 - 782)
johnmci
03-15-07 00:14

findFirstInString: aString inCharacterSet: aCharacterSet startingAt: start
    "Trivial, non-primitive version"
    
    1
        to: aString size
        do: [:i | (aCharacterSet
                    includes: (aString at: i))
                ifTrue: [^ i]].
    ^ 0


This changed method does not consider 'start', thus apparently does the wrong thing.
 
(0010445 - 233 - 305 - 305 - 305 - 305 - 305)
nicolas cellier
03-15-07 20:04

Oops... well found!
Obviously a lack of testing !

"fix begin"
Installer mantis bug: 3574 fix: 'Collection-String-IndexOf-Patch.3.cs'.
"fix test"
Installer mantis bug: 3574 fix: 'Collection-String-IndexOf-Test.3.cs'.
"fix end"
 
(0010481 - 98 - 104 - 104 - 104 - 104 - 104)
edgardec
03-30-07 13:46

This now is 7071StringFindFirstInStringinSetstartingAt.cs and was in the 3.10 updates.
Thanks all
 
(0011206 - 224 - 242 - 242 - 242 - 242 - 242)
nicolas cellier
09-25-07 19:05

Gasp! in 3.10 image, i browsed the senders of self, and WideCharacterSet is, the classical bug of omitting the period at the end of previous sentence!

So I reopen the bug.
Please upload WideCharacterSet-M3574-Patch.1.cs
 
(0011438 - 373 - 409 - 621 - 621 - 621 - 621)
nicolas cellier
11-15-07 20:29

Following http://lists.squeakfoundation.org/pipermail/squeak-dev/2007-November/122292.html, [^]

hash is bugged. it sends an unimplemented message (due to some untested refactoring).

moreover, since WideCharacterSet can equal ordinary CharacterSet, hash has to care of it, what it did not.

WideCharacterSet-M3574-nice-hashPatch.1.cs is a patch correcting this behavior.
 
(0011440 - 113 - 125 - 125 - 125 - 125 - 125)
nicolas cellier
11-15-07 21:35

A convenient #newFrom: instance creation method was missing.

WideCharacterSet-M3574-nice-newFrom.1.cs adds it.
 
(0011446 - 88 - 88 - 88 - 88 - 88 - 88)
nicolas cellier
11-19-07 22:33

WideCharacterSet-M3574-nice-Test.1.cs now adds a few tests to WideCharacterSet itself...
 
(0011449 - 69 - 75 - 75 - 163 - 163 - 163)
nicolas cellier
11-19-07 23:55

copy is bugged also (see 0006777).
Please find test and patch again...
 
(0011570 - 631 - 733 - 733 - 733 - 733 - 733)
Keith_Hodges
12-17-07 17:46
edited on: 01-18-08 09:42

"fix begin"
Installer mantis bug: 3574 fix:'Collection-String-IndexOf-Test.3.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-M3574-Patch.1.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-M3574-nice-hashPatch.1.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-M3574-nice-newFrom.1.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-copy-Patch-M3574-nice.1.cs'.
"fix test"
Installer mantis bug: 3574 fix:'Collection-String-IndexOf-Test.3.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-M3574-nice-Test.1.cs'.
Installer mantis bug: 3574 fix:'WideCharacterSet-copy-Test-M3574-nice.1.cs'.
"fix end"

 
(0012328 - 14 - 14 - 14 - 14 - 14 - 14)
ducasse
07-03-08 20:30

in pharo 10049
 
(0013307 - 190 - 208 - 536 - 536 - 536 - 536)
nicolas cellier
09-14-09 23:27

main bug fixed in 3.10
colateral bugs introduced in 3.10 later fixed in
http://source.squeak.org/trunk/Collections-nice.132.mcz [^]
http://source.squeak.org/trunk/CollectionsTests-nice.95.mcz [^]
 

- Issue History
Date Modified Username Field Change
05-09-06 07:08 johnmci New Issue
05-09-06 07:08 johnmci Status new => assigned
05-09-06 07:08 johnmci Assigned To  => KenCausey
05-09-06 18:40 KenCausey Assigned To KenCausey =>
05-09-06 18:40 KenCausey Status assigned => new
05-09-06 18:40 KenCausey Category Any => Collections
05-09-06 20:17 nicolas cellier File Added: Collection-String-IndexOf-Patch.1.cs
05-09-06 20:20 nicolas cellier Note Added: 0004895
05-09-06 20:27 nicolas cellier File Added: Collection-String-IndexOf-Test.1.cs
05-10-06 00:26 nicolas cellier Note Added: 0004896
05-10-06 00:27 nicolas cellier File Added: Collection-String-IndexOf-Patch.2.cs
05-10-06 00:27 nicolas cellier File Added: Collection-String-IndexOf-Test.2.cs
05-10-06 00:58 nicolas cellier Note Edited: 0004896
07-15-06 18:03 MarcusDenker Note Added: 0005946
01-02-07 22:24 black Note Added: 0008793
01-05-07 09:25 Keith_Hodges Note Added: 0008828
03-15-07 00:14 johnmci Note Added: 0010444
03-15-07 20:04 nicolas cellier Note Added: 0010445
03-15-07 20:04 nicolas cellier File Added: Collection-String-IndexOf-Patch.3.cs
03-15-07 20:05 nicolas cellier File Added: Collection-String-IndexOf-Test.3.cs
03-30-07 13:46 edgardec Note Added: 0010481
09-25-07 19:05 nicolas cellier Note Added: 0011206
09-25-07 19:06 nicolas cellier File Added: WideCharacterSet-M3574-Patch.1.cs
09-25-07 19:07 nicolas cellier Issue Monitored: nicolas cellier
11-15-07 20:26 nicolas cellier File Added: WideCharacterSet-M3574-nice-hashPatch.1.cs
11-15-07 20:29 nicolas cellier Note Added: 0011438
11-15-07 21:34 nicolas cellier File Added: WideCharacterSet-M3574-nice-newFrom.1.cs
11-15-07 21:35 nicolas cellier Note Added: 0011440
11-19-07 22:32 nicolas cellier File Added: WideCharacterSet-M3574-nice-Test.1.cs
11-19-07 22:33 nicolas cellier Note Added: 0011446
11-19-07 23:50 nicolas cellier File Added: WideCharacterSet-copy-Test-M3574-nice.1.cs
11-19-07 23:50 nicolas cellier File Added: WideCharacterSet-copy-Patch-M3574-nice.1.cs
11-19-07 23:55 nicolas cellier Note Added: 0011449
12-03-07 21:18 nicolas cellier Issue End Monitor: nicolas cellier
12-17-07 17:46 Keith_Hodges Note Added: 0011570
01-18-08 09:42 Keith_Hodges Note Edited: 0011570
07-03-08 20:30 ducasse Note Added: 0012328
12-17-08 04:31 Keith_Hodges Status new => acknowledged
01-10-09 00:00 Keith_Hodges Status acknowledged => testing
01-10-09 03:39 Keith_Hodges Status testing => resolved
01-10-09 03:39 Keith_Hodges Fixed in Version  => 3.11
01-10-09 03:39 Keith_Hodges Resolution open => fixed
01-10-09 03:39 Keith_Hodges Assigned To  => Keith_Hodges
01-10-09 03:41 Keith_Hodges Status resolved => testing
09-14-09 23:27 nicolas cellier Note Added: 0013307
10-03-09 19:24 nicolas cellier Relationship added related to 0006366
10-03-09 19:33 Keith_Hodges Status testing => assigned
10-03-09 19:33 Keith_Hodges Assigned To Keith_Hodges => andreas
10-03-09 19:46 nicolas cellier Relationship added related to 0005331
10-03-09 20:00 nicolas cellier Status assigned => resolved
10-03-09 20:00 nicolas cellier Fixed in Version 3.11 => trunk
04-18-10 22:05 andreas Status resolved => closed


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
160 total queries executed.
74 unique queries executed.
Powered by Mantis Bugtracker