Skip to content

packer.writePayload(msg) results in NullPointerException #391

Description

@dbrgn

Hi

Is this a bug or intended behavior?

import org.msgpack.core.MessageBufferPacker;
import org.msgpack.core.MessagePack;

import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        final MessageBufferPacker packer = new MessagePack.PackerConfig()
                    .newBufferPacker();
        byte[] msg = new byte[] {
                    -127, -92, 116, 121, 112, 101, -92, 112, 105, 110, 103};
        try {
            packer.writePayload(msg);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("Done.");
    }
}

This results in:

Exception in thread "main" java.lang.NullPointerException
    at org.msgpack.core.MessagePacker.writePayload(MessagePacker.java:733)
    at org.msgpack.core.MessagePacker.writePayload(MessagePacker.java:717)
    at Main.main(Main.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

I simply want to write raw msgpack bytes to a packer, without any previous header. The bytes already contain the map header.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions