[BUG] Sixx: SixxReadStream

Masashi Umezawa umejava at mars.dti.ne.jp
Fri Feb 28 14:29:59 UTC 2003


Hi,

> If Sixx wants to open an empty file it crashes but adding a guard close
> prevents this.
> It's currently in the SPrevayler changeset so it would be kind if you
> tell me when somebody fixed it in the sixx package.
>
> SixxReadStream>>initialize
>
>     (stream size = 0) ifTrue: [position_0. limit_0. ^self.]. "Guarding
> clause"
>     contextDictionary := IdentityDictionary new.
>     position := 0.
>     sixxElements := self parseStream: stream.
>     limit := sixxElements isNil
>                 ifTrue: [0]
>                 ifFalse: [sixxElements size].
>     cachedObjects := Dictionary new
>

Thanks for finding the bug.
But I prefer to change SixxReadStream>>parseStream:
instead of SixxReadStream>>initialize, because it already has a guard
clause.

So the #parseStream: will be:
parseStream: aStream
     | root |
     (aStream isNil or: [aStream size = 0]) "OLD: aStream isNil"
           ifTrue: [^ nil].
     root := SixxXmlUtil parseXml: aStream.
     self checkSixxElement: root.
     ^ SixxXmlUtil elementsFrom: root

I will apply this fix and release the repackaged version soon.

Cheers,
---
[:masashi | ^umezawa]




More information about the Squeak-dev mailing list