davethomas11 / MoshiPack

MessagePack implementation built on Moshi & OKIO -- msgpack.org[Kotlin]
Apache License 2.0
45 stars 10 forks source link

I got IllegalStateException when try to unpack ByteArray #8

Open steam0111 opened 6 years ago

steam0111 commented 6 years ago

Expected behaviour

Unpack without problems

Actual behaviour

When I try to unpack message from my socket using moshiPack sometime I got this throwable java.lang.IllegalStateException: Current tag 0x70 is not a map tag.

Steps to reproduce behaviour

//Simple example data class Message(var action : String)

private fun unPackData(data: ByteArray) { try { val unpackMessage : Message = moshiPack.unpack(data) Log.d(TAG, "Socket data" + unpackMessage.toString()) } catch (e: Throwable) { Log.d(TAG, "Throwable" + e.toString()) //java.lang.IllegalStateException: Current tag 0x70 is not a //map tag. } }

mateuszkj commented 6 years ago

Can you provide input bytes (as HEX) and stacktrace?

jcstange commented 1 year ago

I have a similar problem returning:

9630CD043580D920636F6D2E73706F746966792E7375706572626972642E766F6963652E646174619082AA73657373696F6E5F6964BC323032322D31312D31315431315F31335F30332E3939355A2E6F6767AA766F6963655F64617461C501924F67675300020000000000000000B04E27230000000052B4EAAD01134F7075734865616401016800803E00000000004F67675300008007000000000000B04E272301000000A396EFCF033E77904F707573546167730F0000006C69626F70757320756E6B6E6F776E010000001B000000454E434F4445523D53706F74696679207653444B20312E342E3739488049AC106F682EB8F3C986A612AA739129F90F2F3A63F6A534D9F345F240C37B1B334CBCD746A8FB6D6288762DCD5670F56387679FA4889C8BB36B2A33A44B8D49F3D96862F285B47771593721635246B2E1DDE2AD27EA52A918C4C65A66644516B09F6D747635FABB2FB8CE75A75C01F54A1DC6BCA04886D2D3BC6C3F1A7B8EA76E58AB619DE0CE1ED94615724E38695A5FED2D4D9618C6E3B001CEB53A6551C5AD098379CBAD506ECB4FB46C1B72B8A0E1F005F11B124FD7BA6B792569E1BD786216BDBC0131283F98A438DF02ED6C39CEE42B21AE928A08810937DC7711154308906EC585787DF70E366467165F553EFA14B90500B183FB88B0A259CE14250AA53F016754

Suppose to decode as: [ 48, 1077, {}, "com.spotify.superbird.voice.data", [], { "session_id": "2022-11-11T11_13_03.995Z.ogg", "voice_data": "" } ]

But is java.lang.IllegalStateException: Msgpack format tag not yet supported: 0xC5

Is there any problem with encoding/decoding binaries?