Skip to content

Commit

Permalink
Vert.x 3.x Json supports RFC-7493, however the JSON encoder/decoder f…
Browse files Browse the repository at this point in the history
…ormat was incorrect. Users who needed to interop with Vert.x 3.x applications should have set the system property vertx.json.base64 to legacy.

This system property and mode is removed in Vert.x 5
  • Loading branch information
vietj committed Jan 9, 2024
1 parent e62af26 commit 80136e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
5 changes: 0 additions & 5 deletions src/main/java/io/vertx/core/impl/SysProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

public enum SysProps {

/**
* Defines a mode for base64 JSON conversions that is compatible with Vert.x 3
*/
JSON_BASE_64("vertx.json.base64"),

/**
* Cluster manager to use class FQN.
*
Expand Down
20 changes: 2 additions & 18 deletions src/main/java/io/vertx/core/json/impl/JsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package io.vertx.core.json.impl;

import io.vertx.core.buffer.Buffer;
import io.vertx.core.impl.SysProps;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.core.shareddata.Shareable;
Expand All @@ -32,23 +31,8 @@
*/
public final class JsonUtil {

public static final Base64.Encoder BASE64_ENCODER;
public static final Base64.Decoder BASE64_DECODER;

static {
/*
* Vert.x 3.x Json supports RFC-7493, however the JSON encoder/decoder format was incorrect.
* Users who might need to interop with Vert.x 3.x applications should set the system property
* {@code vertx.json.base64} to {@code legacy}.
*/
if ("legacy".equalsIgnoreCase(SysProps.JSON_BASE_64.get())) {
BASE64_ENCODER = Base64.getEncoder();
BASE64_DECODER = Base64.getDecoder();
} else {
BASE64_ENCODER = Base64.getUrlEncoder().withoutPadding();
BASE64_DECODER = Base64.getUrlDecoder();
}
}
public static final Base64.Encoder BASE64_ENCODER = Base64.getUrlEncoder().withoutPadding();
public static final Base64.Decoder BASE64_DECODER = Base64.getUrlDecoder();

/**
* Wraps well known java types to adhere to the Json expected types.
Expand Down

0 comments on commit 80136e4

Please sign in to comment.