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

Return null for JsonObject.mapFrom(null) #370

Closed
mnuss opened this issue May 15, 2018 · 3 comments
Closed

Return null for JsonObject.mapFrom(null) #370

mnuss opened this issue May 15, 2018 · 3 comments
Milestone

Comments

@mnuss
Copy link

@mnuss mnuss commented May 15, 2018

Snippet:

// from EventBus handler: Message message
Object r = null;
message.reply(JsonObject.mapFrom(r));

This results in the following exception on the receiving service:

18-May-15 08:02:28:086 ERROR vert.x-eventloop-thread-1 i.v.c.i.ContextImpl:162 - Unhandled exception
io.vertx.core.json.DecodeException: Failed to decode:null
at io.vertx.core.json.Json.decodeValue(Json.java:167)
at io.vertx.core.json.JsonObject.fromBuffer(JsonObject.java:952)
at io.vertx.core.json.JsonObject.(JsonObject.java:72)
at io.vertx.core.eventbus.impl.codecs.JsonObjectMessageCodec.decodeFromWire(JsonObjectMessageCodec.java:34)
at io.vertx.core.eventbus.impl.codecs.JsonObjectMessageCodec.decodeFromWire(JsonObjectMessageCodec.java:21)
at io.vertx.core.eventbus.impl.clustered.ClusteredMessage.decodeBody(ClusteredMessage.java:181)
at io.vertx.core.eventbus.impl.clustered.ClusteredMessage.body(ClusteredMessage.java:88)
at io.vertx.core.eventbus.impl.EventBusImpl.lambda$convertHandler$1(EventBusImpl.java:339)
at io.vertx.core.eventbus.impl.HandlerRegistration.deliver(HandlerRegistration.java:223)
at io.vertx.core.eventbus.impl.HandlerRegistration.handle(HandlerRegistration.java:200)
at io.vertx.core.eventbus.impl.EventBusImpl.lambda$deliverToHandler$3(EventBusImpl.java:533)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.EOFException: null
at io.netty.buffer.ByteBufInputStream.readByte(ByteBufInputStream.java:206)
at io.netty.buffer.ByteBufInputStream.readUnsignedByte(ByteBufInputStream.java:292)
at com.fasterxml.jackson.core.json.UTF8DataInputJsonParser._matchToken(UTF8DataInputJsonParser.java:2156)
at com.fasterxml.jackson.core.json.UTF8DataInputJsonParser._nextTokenNotInObject(UTF8DataInputJsonParser.java:690)
at com.fasterxml.jackson.core.json.UTF8DataInputJsonParser.nextToken(UTF8DataInputJsonParser.java:606)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3850)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3799)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2989)
at io.vertx.core.json.Json.decodeValue(Json.java:165)
... 17 common frames omitted

@vietj
Copy link

@vietj vietj commented May 15, 2018

@mnuss
Copy link
Author

@mnuss mnuss commented May 15, 2018

Seems to be happening any time the JsonObjectMessageCodec is trying to decode from wire where the payload is mapped from a null object.

@vietj vietj changed the title JsonObject.mapFrom(null) results in Json DecodeError on EventBus message.reply() return null for JsonObject.mapFrom(null) May 15, 2018
@vietj vietj changed the title return null for JsonObject.mapFrom(null) Return null for JsonObject.mapFrom(null) May 15, 2018
@vietj
Copy link

@vietj vietj commented May 15, 2018

@vietj vietj closed this May 15, 2018
@vietj vietj added this to the 3.6.0 milestone May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.