[Pharo-project] ZipWriteStream error when closing it twice. Normal?
Mariano Martinez Peck
marianopeck at gmail.com
Tue Jan 24 10:30:11 CET 2012
Hi guys. I found that GZipWriteStream throws an error when closing it
| aStream zipStream |
aStream := ByteArray new writeStream binary.
zipStream := GZipWriteStream on: aStream.
All the streams I know do not throw an error in that case. And moreoever,
it gets things complicated when using #on:do:. For example:
do: [ :stream |
on: stream binary
do: [ :gzipStream |
FLSerializer newDefault serialize: anObject on:
gzipStream ] ].
In thise case, FLSerializer closes the stream at the end. No matter whether
Fuel should do that or not, the thing is that in this I have the mentioned
So...my question is, is this a bug? if it is, do you have a better idea
that changing #close to this:
ZipWriteStream >> close
literals isNil ifTrue: [
"#initialize sets this instVar to a specific value. #release puts
it in nil, and #release is called from #flushBlock: which is called from
#close:. Therefore, if it is nil, it means the stream has already been
closed. If we try to close it twice, #flushBlock will throw an error
because its instance variables are with nil"
self flushBlock: true.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-project