remove javax.json and replace with FasterXML (#11554)

remove javax.json and replace with FasterXML to be consistent with the rest of the project.

Closes #11544
This commit is contained in:
Erich Bremer 2022-08-25 02:49:22 -04:00 committed by GitHub
parent af0d97e534
commit c98a760beb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 18 deletions

View file

@ -124,7 +124,6 @@
<jetty94.version>9.4.40.v20210413</jetty94.version>
<woodstox.version>6.0.3</woodstox.version>
<xmlsec.version>2.2.3</xmlsec.version>
<glassfish.json.version>1.1.6</glassfish.json.version>
<wildfly.common.version>1.6.0.Final</wildfly.common.version>
<nashorn.version>15.3</nashorn.version>
<ua-parser.version>1.5.2</ua-parser.version>
@ -613,11 +612,6 @@
<version>${wildfly.version}</version>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
<version>${glassfish.json.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>

View file

@ -59,10 +59,6 @@
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.json</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-common</artifactId>

View file

@ -12,8 +12,6 @@ import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.json.Json;
import javax.json.JsonObjectBuilder;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
@ -47,6 +45,7 @@ import org.keycloak.theme.FreeMarkerUtil;
import org.keycloak.theme.Theme;
import org.keycloak.theme.beans.MessageFormatterMethod;
import org.keycloak.urls.UrlType;
import org.keycloak.util.JsonSerialization;
import org.keycloak.utils.MediaType;
import org.keycloak.utils.StringUtil;
@ -166,13 +165,15 @@ public class AccountConsole {
private String messagesToJsonString(Properties props) {
if (props == null) return "";
JsonObjectBuilder json = Json.createObjectBuilder();
for (String prop : props.stringPropertyNames()) {
json.add(prop, convertPropValue(props.getProperty(prop)));
Properties newProps = new Properties();
for (String prop: props.stringPropertyNames()) {
newProps.put(prop, convertPropValue(props.getProperty(prop)));
}
try {
return JsonSerialization.writeValueAsString(newProps);
} catch (IOException e) {
throw new RuntimeException(e);
}
return json.build().toString();
}
private String convertPropValue(String propertyValue) {