diff --git a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java index c8a8f3999..055786a6e 100644 --- a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java @@ -5,12 +5,14 @@ import java.io.FileFilter; import java.io.FileInputStream; import java.util.Arrays; import java.util.List; +import java.util.logging.Level; import java.util.regex.Matcher; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.MetadataCollection; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainerFactory; @@ -85,6 +87,11 @@ public class DirectoryDiscoverer implements ITypeDiscoverer modParser = new ASMModParser(fis); fis.close(); } + catch (LoaderException e) + { + FMLLog.log(Level.SEVERE, e, "There was a problem reading the file %s - probably this is a corrupt file", file.getPath()); + throw e; + } catch (Exception e) { Throwables.propagate(e); diff --git a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java index a8bcd7cd6..7d021fc83 100644 --- a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java @@ -10,6 +10,7 @@ import java.util.zip.ZipFile; import com.google.common.collect.Lists; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.MetadataCollection; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainerFactory; @@ -44,7 +45,16 @@ public class JarDiscoverer implements ITypeDiscoverer Matcher match = classFile.matcher(ze.getName()); if (match.matches()) { - ASMModParser modParser = new ASMModParser(jar.getInputStream(ze)); + ASMModParser modParser; + try + { + modParser = new ASMModParser(jar.getInputStream(ze)); + } + catch (LoaderException e) + { + FMLLog.log(Level.SEVERE, e, "There was a problem reading the entry %s in the jar %s - probably a corrupt zip", ze.getName(), candidate.getModContainer().getPath()); + throw e; + } modParser.validate(); modParser.sendToTable(table, candidate); ModContainer container = ModContainerFactory.instance().build(modParser, candidate.getModContainer(), candidate); diff --git a/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java b/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java index 02058276a..03254c3f3 100644 --- a/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java +++ b/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java @@ -3,6 +3,7 @@ package cpw.mods.fml.common.discovery.asm; import java.io.IOException; import java.io.InputStream; import java.util.LinkedList; +import java.util.logging.Level; import net.minecraft.src.BaseMod; @@ -12,6 +13,8 @@ import org.objectweb.asm.Type; import com.google.common.base.Objects; import com.google.common.collect.Lists; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ModCandidate; @@ -31,8 +34,16 @@ public class ASMModParser public ASMModParser(InputStream stream) throws IOException { - ClassReader reader = new ClassReader(stream); - reader.accept(new ModClassVisitor(this), 0); + try + { + ClassReader reader = new ClassReader(stream); + reader.accept(new ModClassVisitor(this), 0); + } + catch (Exception ex) + { + FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly"); + throw new LoaderException(ex); + } } public void beginNewTypeName(String typeQName, int classVersion, String superClassQName) @@ -132,13 +143,13 @@ public class ASMModParser public void addAnnotationEnumProperty(String name, String desc, String value) { annotations.getFirst().addEnumProperty(name, desc, value); - + } public void endArray() { annotations.getFirst().endArray(); - + } public void addSubAnnotation(String name, String desc)