Strip dependencies on Apache Commons Codec

This commit is contained in:
Mike Primm 2021-12-19 15:23:40 -06:00
parent a7ee1213c9
commit 2d2fe02a81
9 changed files with 24 additions and 25 deletions

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -73,8 +75,6 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dynmap.ConfigurationNode; import org.dynmap.ConfigurationNode;
@ -1159,7 +1159,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -76,8 +78,6 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.dynmap.ConfigurationNode; import org.dynmap.ConfigurationNode;
@ -1165,7 +1165,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -86,8 +88,6 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1112,7 +1112,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -85,8 +87,6 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1140,7 +1140,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -86,8 +88,6 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1141,7 +1141,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -89,8 +91,6 @@ import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1149,7 +1149,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -5,8 +5,10 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -76,8 +78,6 @@ import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1127,7 +1127,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }

View File

@ -33,7 +33,6 @@ project.archivesBaseName = "${project.archivesBaseName}-forge-1.18"
dependencies { dependencies {
implementation project(path: ":DynmapCore", configuration: "shadow") implementation project(path: ":DynmapCore", configuration: "shadow")
implementation project(path: ':DynmapCoreAPI') implementation project(path: ':DynmapCoreAPI')
implementation "commons-codec:commons-codec:1.15"
minecraft 'net.minecraftforge:forge:1.18-38.0.12' minecraft 'net.minecraftforge:forge:1.18-38.0.12'
} }

View File

@ -4,8 +4,10 @@ import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -75,8 +77,6 @@ import net.minecraftforge.fml.loading.LoadingModList;
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo; import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
import org.apache.commons.codec.Charsets;
import org.apache.commons.codec.binary.Base64;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.ArtifactVersion;
@ -1121,7 +1121,7 @@ public class DynmapPlugin
if (textureProperty != null) { if (textureProperty != null) {
TexturesPayload result = null; TexturesPayload result = null;
try { try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8); String json = new String(Base64.getDecoder().decode(textureProperty.getValue()), StandardCharsets.UTF_8);
result = gson.fromJson(json, TexturesPayload.class); result = gson.fromJson(json, TexturesPayload.class);
} catch (JsonParseException e) { } catch (JsonParseException e) {
} }