-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GsAmqpBytes class>>fromStringEncodeAsUtf8: #8
Comments
Ok, I would argue, that this is a bug in Gemstone/S. You may strip it down to: | cByteArray sourceString | sourceString := 'grüne' . |
I made a bug request at GemtalkSystems |
Ok, after getting an answer from GemtalkSystem, the method mentioned above should coded in that way. Notice the usage of #sizeForEncodeAsUTF8 and consider instances of MultiByteString. The original error message is - by the way - a bug. They check for the size of the CByteArray and in an error case they throw an exception, but the false one. So here is the corrected method: GsAmqpBytes>>fromStringEncodeAsUtf8: byteObj |
This method is a helper method and only called by methods in AmqpFieldValue. In my code I had instances of Unicode16 and they are delivered to this method (via byteObj) and the method crashes. This may happen, when you build a dictionary in your code and then you want to build an instance of GsAmqpTableEntryArray from a dictionary.
fromStringEncodeAsUtf8: byteObj
^(byteObj size == 0) "Handle both empty byteObj and nil"
ifTrue: [self emptyBytes]
ifFalse:
[| cba res |GsAmqpFieldValue
byteObj _validateClasses: { String . MultiByteString } . "Prevent assertion failure in slow builds where byteObj class == Utf8 "
cba := CByteArray gcMalloc: byteObj size.
cba encodeUTF8From: byteObj into: 0 allowCodePointZero: false.
(res := self new) setBytes: cba .
res]
Here a
GsAmqpBytes fromStringEncodeAsUtf8: '0061_vallée_de_l-ernz_az_en_gm_zs-ddxml'
The text was updated successfully, but these errors were encountered: