Throw a NoClassesDexException for an apk/jar/zip with no classes.dex

This commit is contained in:
Ben Gruver 2013-04-07 20:29:30 -07:00
parent e6d10fc788
commit 4cf7845ea4

View File

@ -59,7 +59,7 @@ public final class DexFileFactory {
ZipEntry zipEntry = zipFile.getEntry("classes.dex");
if (zipEntry == null) {
throw new ExceptionWithContext("zip file %s does not contain a classes.dex file", dexFile.getName());
throw new NoClassesDexException("zip file %s does not contain a classes.dex file", dexFile.getName());
}
long fileLength = zipEntry.getSize();
if (fileLength < 40) {
@ -110,4 +110,18 @@ public final class DexFileFactory {
}
private DexFileFactory() {}
public static class NoClassesDexException extends ExceptionWithContext {
public NoClassesDexException(Throwable cause) {
super(cause);
}
public NoClassesDexException(Throwable cause, String message, Object... formatArgs) {
super(cause, message, formatArgs);
}
public NoClassesDexException(String message, Object... formatArgs) {
super(message, formatArgs);
}
}
}