Properly acquire JUnit 4, drop json-simple

This commit is contained in:
Kenzie Togami 2019-07-15 15:25:17 -07:00
parent bcea78c701
commit e98b99edcd
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81
3 changed files with 13 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.external.javadoc.CoreJavadocOptions
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByName
import org.gradle.kotlin.dsl.named
@ -38,6 +39,10 @@ fun Project.applyPlatformAndCoreConfiguration() {
toolVersion = "7.6.1"
}
dependencies {
"testImplementation"("junit:junit:4.12")
}
// Java 8 turns on doclint which we fail
tasks.withType<Javadoc>().configureEach {
(options as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet")

View File

@ -20,7 +20,6 @@ dependencies {
"compile"("com.google.guava:guava:21.0")
"compile"("com.google.code.findbugs:jsr305:1.3.9")
"compile"("com.google.code.gson:gson:2.8.0")
"compile"("com.googlecode.json-simple:json-simple:1.1.1")
"compile"("org.slf4j:slf4j-api:1.7.26")
"compileOnly"(project(":worldedit-libs:core:ap"))

View File

@ -19,8 +19,9 @@
package com.sk89q.worldedit.util.paste;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.util.net.HttpRequest;
import org.json.simple.JSONValue;
import java.io.IOException;
import java.net.URL;
@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster {
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
private static final Gson GSON = new Gson();
@Override
public Callable<URL> paste(String content) {
return new PasteTask(content);
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
.returnContent()
.asString("UTF-8").trim();
Object object = JSONValue.parse(result);
if (object instanceof Map) {
@SuppressWarnings("unchecked")
String urlString = String.valueOf(((Map<Object, Object>) object).get("url"));
Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
}.getType());
if (object != null) {
String urlString = String.valueOf(object.get("url"));
Matcher m = URL_PATTERN.matcher(urlString);
if (m.matches()) {