|
I’m getting a walkback while attempting to look at the prior versions of certain methods. It happens on some methods, but not all.
I think the the issue may be related to having characters in the method body that are represented as multi-byte sequences in UTF-8.
The error is 'Illegal leading byte for utf-8 encoding’ from ZnUTF8Encoder
Here are the top few stack frames:
ZnUTF8Encoder>>error:
ZnUTF8Encoder>>errorIllegalLeadingByte
ZnUTF8Encoder>>nextCodePointFromStream:
ZnUTF8Encoder(ZnCharacterEncoder)>>nextFromStream:
ZnCharacterReadStream>>nextElement
ZnCharacterReadStream(ZnEncodedReadStream)>>peek
SourceFile>>peek
ChunkReadStream(DecoratorStream)>>peek
ChunkReadStream>>skipSeparators
ChunkReadStream>>basicNextChunk
ChunkReadStream>>next
SourceFileArray>>readOnlyDo:
BlockClosure>>ensure:
SourceFileArray>>readOnlyDo:
SourceFileArray>>changeRecordsFrom:className:isMeta:do:
SourceFileArray>>changeRecordsFrom:className:isMeta:
VersionBrowser>>buildChangeList
VersionBrowser>>buildBrowser
VersionBrowser>>browseVersionsOf:
Everything looks reasonable. The underlying ZnBufferedReadStream is at position 2, and the first few bytes are
159 166 34 39 46
or, in hex:
9F A6 22 27 2E
That first byte, 9F or 10011111, is not valid as the first byte in a UTF-8 sequence (it’s a valid continuing byte) — which presumably is why ZnUTF8Encoder is complaining.
So, why is the VersionBrowser starting to look at that particular place in the source file?
VersionBrowser >> buildChangeList looks like this:
buildChangeList
rgMethod sourcePointer ifNil:[ ^ #() ].
^ (SourceFiles
changeRecordsFrom: rgMethod sourcePointer
className: rgMethod instanceSideParentName
isMeta: rgMethod isMetaSide)
collectWithIndex: [ :c :i | | rg |
rg := c asRingDefinition.
rg annotationNamed: #versionIndex put: i ]
and rgMethod sourcePointer is the value of the sourcePointer attribute in the attributes dictionary in rgMehod.
What can be done to fix this?
Andrew
|