Skip to content
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

readArrayBegin in org.msgpack.template.builder.ScalaBuildContext#buildReadMethodBody #15

Open
andypetrella opened this issue Feb 6, 2014 · 1 comment
Labels

Comments

@andypetrella
Copy link

It might not be an issue but part of my misunderstanding of the problem.

Let me explain it before I comment the title.

I'm trying to read into a class A which has 2 fields, let's say

class A {
  var a:String
  var b:String
}

I've written a serialization of such event in a file, that I'll try to read like this:

    val openStream: InputStream = new URL("file:///temp/test").openStream()
    var events = ScalaMessagePack.read[Event](openStream)

    println(events)

And here is what I got:

Expected array, but got map value
org.msgpack.MessageTypeException: Expected array, but got map value
    at org.msgpack.unpacker.Accept.acceptMap(Accept.java:93)
    at org.msgpack.unpacker.MessagePackUnpacker.readOneWithoutStack(MessagePackUnpacker.java:132)
    at org.msgpack.unpacker.MessagePackUnpacker.readOne(MessagePackUnpacker.java:73)

This happen because the method referred in the title is always calling readArrayBegin at the start of the read. However, it look like the binary file I've written based on write is not writing an array but a map.
However, if I readAsValue the file, it will work by resulting a MapValue...

Is there something I miss, or is it a bug (which I don't believe).

Thanks for you help

@takezoux2
Copy link
Member

MsgpackScala doesn't support FieldName-Value map type class mapping now.
Only field aligned array mapping is supported.

@xerial xerial added the 0.6.x label Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants