Use multiple catch, try-with-resources, replace system.out and e.printStackTrace

This commit is contained in:
mezz committed 2017-06-27 22:57:10 -07:00
1 parent 10ca404e9e
commit 93025510ae
27 files changed
+62 -132

No files matched your search

@@ -34,6 +34,8 @@ import net.minecraftforge.event.CommandEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.FMLLog;
import static net.minecraft.util.text.TextFormatting.*;
/**
@@ -109,7 +111,7 @@ public class ClientCommandHandler extends CommandHandler
catch (Throwable t)
{
sender.sendMessage(format(RED, "commands.generic.exception"));
t.printStackTrace();
FMLLog.log.error("Command '{}' threw an exception:", message, t);
}
return -1;
@@ -575,12 +575,7 @@ public class ModelBlockAnimation
//String json = mbaGson.toJson(mba);
return mba;
}
catch(IOException e)
{
FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation;
}
catch(JsonParseException e)
catch(IOException | JsonParseException e)
{
FMLLog.log.error("Exception loading vanilla model animation {}, skipping", armatureLocation, e);
return defaultModelBlockAnimation;
@@ -182,11 +182,7 @@ public enum KeyModifier {
{
return valueOf(stringValue);
}
catch (NullPointerException ignored)
{
return NONE;
}
catch (IllegalArgumentException ignored)
catch (NullPointerException | IllegalArgumentException ignored)
{
return NONE;
}