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

Possible regression on JsonObject in version 3.5.1 #66

Closed
lecogiteur opened this issue Mar 12, 2018 · 4 comments
Closed

Possible regression on JsonObject in version 3.5.1 #66

lecogiteur opened this issue Mar 12, 2018 · 4 comments

Comments

@lecogiteur
Copy link

Hi,

When I do

val aJson = new JsonObject("{\"key\": [\"value\"]}")
aJson.copy()

I have this error (only in version 3.5.1). Need to deploy before at least a verticle (JsonInit is call in VerticleExecutionContext)

java.lang.IllegalStateException: Illegal type in JsonObject: class scala.collection.immutable.$colon$colon
        at io.vertx.core.json.Json.checkAndCopy(Json.java:210)
        at io.vertx.core.json.JsonObject.copy(JsonObject.java:796)
        at io.vertx.core.impl.DeploymentManager.doDeploy(DeploymentManager.java:461)
        at io.vertx.core.impl.DeploymentManager.lambda$doDeployVerticle$2(DeploymentManager.java:203)
        at io.vertx.core.impl.FutureImpl.setHandler(FutureImpl.java:76)
        at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:171)
        at io.vertx.core.impl.DeploymentManager.doDeployVerticle(DeploymentManager.java:143)
        at io.vertx.core.impl.DeploymentManager.deployVerticle(DeploymentManager.java:131)
        at io.vertx.core.impl.VertxImpl.deployVerticle(VertxImpl.java:665)
        at io.vertx.scala.core.Vertx.deployVerticleFuture(Vertx.scala:566)

It's due to we register now with io.vertx.lang.scala.JsonInit the scala module in ObjectMapper. So now array is sequence and not an java.util.ArrayList.

I have found a workaround

import scala.collection.JavaConverters._
val newJson = Json.obj(aJson.getMap.asScala.toSeq: _*)
newJson.copy()

But I think It's a regression because there is lots of code in Java which produce JsonObject from String perhaps need to override and extends JsonObject with a scala object (or implicit conversion).

With version 3.5.0 there is no problem:
This works

val aJson = new JsonObject("{\"key\": [\"value\"]}")
aJson.copy()
@codepitbull
Copy link
Contributor

Fix will be part of 3.5.2

@blueberrynotblue
Copy link

@codepitbull Will the fat-jar size problem be solved in 3.5.2?

@codepitbull
Copy link
Contributor

@blueberrynotblue I can't find the issue for that in vertx-lang-scala. Did you open it against one of the other vert.x projects?

@codepitbull
Copy link
Contributor

I opened a new issue (#68). This won't make it into 3.5.2 as it isn't really a bug and needs more testing. Current master reduced size by almost 50%.

codepitbull pushed a commit that referenced this issue May 4, 2018
vietj pushed a commit that referenced this issue May 7, 2018
willisjtc added a commit to willisjtc/vertx-lang-scala that referenced this issue Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants