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
3 changed files with 13 additions and 6 deletions

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()) {