Clean up uses of deprecated library functions (#4130)

Avoid catching and rethrowing runtime exceptions
Append error messages to exceptions instead of the log
This commit is contained in:
Ben Staddon authored and mezz committed 2017-07-12 21:50:28 -07:00
1 parent ead0e81025
commit 0fde64ac38
44 files changed
+118 -232

No files matched your search

@@ -664,12 +664,10 @@ public class FMLClientHandler implements IFMLSidedHandler
catch (NoSuchMethodException e)
{
FMLLog.log.error("The container {} (type {}) returned an invalid class for it's resource pack.", container.getName(), container.getClass().getName());
return;
}
catch (Exception e)
{
FMLLog.log.error("An unexpected exception occurred constructing the custom resource pack for {}", container.getName(), e);
throw Throwables.propagate(e);
throw new RuntimeException("An unexpected exception occurred constructing the custom resource pack for " + container.getName(), e);
}
}
}
@@ -23,6 +23,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.apache.logging.log4j.LogManager;
@@ -32,8 +33,6 @@ import net.minecraft.client.resources.FileResourcePack;
import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.ModContainer;
import com.google.common.base.Charsets;
public class FMLFileResourcePack extends FileResourcePack implements FMLContainerHolder {
private ModContainer container;
@@ -66,7 +65,7 @@ public class FMLFileResourcePack extends FileResourcePack implements FMLContaine
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
" \"pack_format\": 2\n"+
"}\n" +
"}").getBytes(Charsets.UTF_8));
"}").getBytes(StandardCharsets.UTF_8));
}
else throw ioe;
}
@@ -23,6 +23,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.apache.logging.log4j.LogManager;
@@ -32,8 +33,6 @@ import net.minecraft.client.resources.FolderResourcePack;
import net.minecraftforge.fml.common.FMLContainerHolder;
import net.minecraftforge.fml.common.ModContainer;
import com.google.common.base.Charsets;
public class FMLFolderResourcePack extends FolderResourcePack implements FMLContainerHolder {
private ModContainer container;
@@ -71,7 +70,7 @@ public class FMLFolderResourcePack extends FolderResourcePack implements FMLCont
" \"description\": \"dummy FML pack for "+container.getName()+"\",\n"+
" \"pack_format\": 2\n"+
"}\n" +
"}").getBytes(Charsets.UTF_8));
"}").getBytes(StandardCharsets.UTF_8));
}
else throw ioe;
}