Drop JsonSimpleJsonParser and JSON simple dependency

Closes gh-13471
pull/13507/head
Stephane Nicoll 7 years ago
parent fa7da40640
commit 0c4176f596

@ -148,7 +148,6 @@
<selenium-htmlunit.version>2.29.3</selenium-htmlunit.version> <selenium-htmlunit.version>2.29.3</selenium-htmlunit.version>
<sendgrid.version>4.1.2</sendgrid.version> <sendgrid.version>4.1.2</sendgrid.version>
<servlet-api.version>3.1.0</servlet-api.version> <servlet-api.version>3.1.0</servlet-api.version>
<simple-json.version>1.1.1</simple-json.version>
<slf4j.version>1.7.25</slf4j.version> <slf4j.version>1.7.25</slf4j.version>
<snakeyaml.version>1.19</snakeyaml.version> <snakeyaml.version>1.19</snakeyaml.version>
<solr.version>7.2.1</solr.version> <solr.version>7.2.1</solr.version>
@ -623,17 +622,6 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>${gson.version}</version> <version>${gson.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${simple-json.version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>

@ -131,11 +131,6 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>com.hazelcast</groupId> <groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId> <artifactId>hazelcast</artifactId>

@ -56,11 +56,6 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>com.samskivert</groupId> <groupId>com.samskivert</groupId>
<artifactId>jmustache</artifactId> <artifactId>jmustache</artifactId>

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,15 +25,13 @@ import org.springframework.util.ClassUtils;
* @see JacksonJsonParser * @see JacksonJsonParser
* @see GsonJsonParser * @see GsonJsonParser
* @see YamlJsonParser * @see YamlJsonParser
* @see JsonSimpleJsonParser
* @see BasicJsonParser * @see BasicJsonParser
*/ */
public abstract class JsonParserFactory { public abstract class JsonParserFactory {
/** /**
* Static factory for the "best" JSON parser available on the classpath. Tries Jackson * Static factory for the "best" JSON parser available on the classpath. Tries
* 2, then Gson, Snake YAML, Simple JSON, JSON (from eclipse), and then falls back to * Jackson, then Gson, Snake YAML,and then falls back to the {@link BasicJsonParser}.
* the {@link BasicJsonParser}.
* @return a {@link JsonParser} * @return a {@link JsonParser}
*/ */
public static JsonParser getJsonParser() { public static JsonParser getJsonParser() {
@ -46,9 +44,6 @@ public abstract class JsonParserFactory {
if (ClassUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) { if (ClassUtils.isPresent("org.yaml.snakeyaml.Yaml", null)) {
return new YamlJsonParser(); return new YamlJsonParser();
} }
if (ClassUtils.isPresent("org.json.simple.JSONObject", null)) {
return new JsonSimpleJsonParser();
}
return new BasicJsonParser(); return new BasicJsonParser();
} }

@ -1,49 +0,0 @@
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.json;
import java.util.List;
import java.util.Map;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
/**
* Thin wrapper to adapt {@link org.json.simple.JSONObject} to a {@link JsonParser}.
*
* @author Dave Syer
* @author Jean de Klerk
* @since 1.2.0
* @see JsonParserFactory
*/
public class JsonSimpleJsonParser extends AbstractJsonParser {
@Override
@SuppressWarnings("unchecked")
public Map<String, Object> parseMap(String json) {
return (Map<String, Object>) tryParse(() -> new JSONParser().parse(json),
ParseException.class);
}
@Override
@SuppressWarnings("unchecked")
public List<Object> parseList(String json) {
return (List<Object>) tryParse(() -> new JSONParser().parse(json),
ParseException.class);
}
}

@ -1,31 +0,0 @@
/*
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.json;
/**
* Tests for {@link JsonSimpleJsonParser}.
*
* @author Dave Syer
*/
public class JsonSimpleJsonParserTests extends AbstractJsonParserTests {
@Override
protected JsonParser getParser() {
return new JsonSimpleJsonParser();
}
}
Loading…
Cancel
Save