mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-06 08:44:30 +02:00
style: re-org exceptions to have suffix (#2400)
* style: re-org exceptions to have suffix * fix: add missing exception for ResResSpec
This commit is contained in:
parent
22fdee4d2e
commit
35a4bd6718
@ -18,7 +18,7 @@ package brut.androlib;
|
|||||||
|
|
||||||
import brut.androlib.err.InFileNotFoundException;
|
import brut.androlib.err.InFileNotFoundException;
|
||||||
import brut.androlib.err.OutDirExistsException;
|
import brut.androlib.err.OutDirExistsException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import brut.androlib.meta.MetaInfo;
|
import brut.androlib.meta.MetaInfo;
|
||||||
import brut.androlib.meta.PackageInfo;
|
import brut.androlib.meta.PackageInfo;
|
||||||
import brut.androlib.meta.UsesFramework;
|
import brut.androlib.meta.UsesFramework;
|
||||||
@ -416,7 +416,7 @@ public class ApkDecoder {
|
|||||||
int id = getResTable().getPackageId();
|
int id = getResTable().getPackageId();
|
||||||
try {
|
try {
|
||||||
id = getResTable().getPackage(renamed).getId();
|
id = getResTable().getPackage(renamed).getId();
|
||||||
} catch (UndefinedResObject ignored) {}
|
} catch (UndefinedResObjectException ignored) {}
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(original)) {
|
if (Strings.isNullOrEmpty(original)) {
|
||||||
return;
|
return;
|
||||||
|
@ -19,19 +19,7 @@ package brut.androlib.err;
|
|||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
|
|
||||||
public class AXmlDecodingException extends AndrolibException {
|
public class AXmlDecodingException extends AndrolibException {
|
||||||
|
|
||||||
public AXmlDecodingException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AXmlDecodingException(String message, Throwable cause) {
|
public AXmlDecodingException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AXmlDecodingException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AXmlDecodingException() {
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -21,19 +21,8 @@ import brut.androlib.AndrolibException;
|
|||||||
/**
|
/**
|
||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class UndefinedResObject extends AndrolibException {
|
public class CantFind9PatchChunkException extends AndrolibException {
|
||||||
public UndefinedResObject(Throwable cause) {
|
public CantFind9PatchChunkException(String message, Throwable cause) {
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UndefinedResObject(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UndefinedResObject(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UndefinedResObject() {
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -22,12 +22,6 @@ import brut.androlib.AndrolibException;
|
|||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class CantFindFrameworkResException extends AndrolibException {
|
public class CantFindFrameworkResException extends AndrolibException {
|
||||||
|
|
||||||
public CantFindFrameworkResException(Throwable cause, int id) {
|
|
||||||
super(cause);
|
|
||||||
mPkgId = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CantFindFrameworkResException(int id) {
|
public CantFindFrameworkResException(int id) {
|
||||||
mPkgId = id;
|
mPkgId = id;
|
||||||
}
|
}
|
||||||
|
@ -22,19 +22,6 @@ import brut.androlib.AndrolibException;
|
|||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class InFileNotFoundException extends AndrolibException {
|
public class InFileNotFoundException extends AndrolibException {
|
||||||
|
|
||||||
public InFileNotFoundException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InFileNotFoundException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InFileNotFoundException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InFileNotFoundException() {
|
public InFileNotFoundException() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,19 +22,6 @@ import brut.androlib.AndrolibException;
|
|||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class OutDirExistsException extends AndrolibException {
|
public class OutDirExistsException extends AndrolibException {
|
||||||
|
|
||||||
public OutDirExistsException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutDirExistsException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutDirExistsException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutDirExistsException() {
|
public OutDirExistsException() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,19 +19,7 @@ package brut.androlib.err;
|
|||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
|
|
||||||
public class RawXmlEncounteredException extends AndrolibException {
|
public class RawXmlEncounteredException extends AndrolibException {
|
||||||
|
|
||||||
public RawXmlEncounteredException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RawXmlEncounteredException(String message, Throwable cause) {
|
public RawXmlEncounteredException(String message, Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RawXmlEncounteredException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RawXmlEncounteredException() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,20 +21,8 @@ import brut.androlib.AndrolibException;
|
|||||||
/**
|
/**
|
||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
*/
|
*/
|
||||||
public class CantFind9PatchChunk extends AndrolibException {
|
public class UndefinedResObjectException extends AndrolibException {
|
||||||
|
public UndefinedResObjectException(String message) {
|
||||||
public CantFind9PatchChunk(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CantFind9PatchChunk(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CantFind9PatchChunk(String message) {
|
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CantFind9PatchChunk() {
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import brut.androlib.res.data.value.ResFileValue;
|
import brut.androlib.res.data.value.ResFileValue;
|
||||||
import brut.androlib.res.data.value.ResValueFactory;
|
import brut.androlib.res.data.value.ResValueFactory;
|
||||||
import brut.androlib.res.xml.ResValuesXmlSerializable;
|
import brut.androlib.res.xml.ResValuesXmlSerializable;
|
||||||
@ -53,10 +53,10 @@ public class ResPackage {
|
|||||||
return mResSpecs.containsKey(resID);
|
return mResSpecs.containsKey(resID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResResSpec getResSpec(ResID resID) throws UndefinedResObject {
|
public ResResSpec getResSpec(ResID resID) throws UndefinedResObjectException {
|
||||||
ResResSpec spec = mResSpecs.get(resID);
|
ResResSpec spec = mResSpecs.get(resID);
|
||||||
if (spec == null) {
|
if (spec == null) {
|
||||||
throw new UndefinedResObject("resource spec: " + resID.toString());
|
throw new UndefinedResObjectException("resource spec: " + resID.toString());
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ public class ResPackage {
|
|||||||
public ResType getConfig(ResConfigFlags flags) throws AndrolibException {
|
public ResType getConfig(ResConfigFlags flags) throws AndrolibException {
|
||||||
ResType config = mConfigs.get(flags);
|
ResType config = mConfigs.get(flags);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw new UndefinedResObject("config: " + flags);
|
throw new UndefinedResObjectException("config: " + flags);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ public class ResPackage {
|
|||||||
public ResTypeSpec getType(String typeName) throws AndrolibException {
|
public ResTypeSpec getType(String typeName) throws AndrolibException {
|
||||||
ResTypeSpec type = mTypes.get(typeName);
|
ResTypeSpec type = mTypes.get(typeName);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new UndefinedResObject("type: " + typeName);
|
throw new UndefinedResObjectException("type: " + typeName);
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class ResResSpec {
|
|||||||
public ResResource getResource(ResConfigFlags config) throws AndrolibException {
|
public ResResource getResource(ResConfigFlags config) throws AndrolibException {
|
||||||
ResResource res = mResources.get(config);
|
ResResource res = mResources.get(config);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new UndefinedResObject(String.format("resource: spec=%s, config=%s", this, config));
|
throw new UndefinedResObjectException(String.format("resource: spec=%s, config=%s", this, config));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import brut.androlib.meta.VersionInfo;
|
import brut.androlib.meta.VersionInfo;
|
||||||
import brut.androlib.res.AndrolibResources;
|
import brut.androlib.res.AndrolibResources;
|
||||||
import brut.androlib.res.data.value.ResValue;
|
import brut.androlib.res.data.value.ResValue;
|
||||||
@ -83,7 +83,7 @@ public class ResTable {
|
|||||||
if (mAndRes != null) {
|
if (mAndRes != null) {
|
||||||
return mAndRes.loadFrameworkPkg(this, id, mAndRes.apkOptions.frameworkTag);
|
return mAndRes.loadFrameworkPkg(this, id, mAndRes.apkOptions.frameworkTag);
|
||||||
}
|
}
|
||||||
throw new UndefinedResObject(String.format("package: id=%d", id));
|
throw new UndefinedResObjectException(String.format("package: id=%d", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResPackage getHighestSpecPackage() throws AndrolibException {
|
public ResPackage getHighestSpecPackage() throws AndrolibException {
|
||||||
@ -115,7 +115,7 @@ public class ResTable {
|
|||||||
public ResPackage getPackage(String name) throws AndrolibException {
|
public ResPackage getPackage(String name) throws AndrolibException {
|
||||||
ResPackage pkg = mPackagesByName.get(name);
|
ResPackage pkg = mPackagesByName.get(name);
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
throw new UndefinedResObject("package: name=" + name);
|
throw new UndefinedResObjectException("package: name=" + name);
|
||||||
}
|
}
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +38,7 @@ public class ResType {
|
|||||||
public ResResource getResource(ResResSpec spec) throws AndrolibException {
|
public ResResource getResource(ResResSpec spec) throws AndrolibException {
|
||||||
ResResource res = mResources.get(spec);
|
ResResource res = mResources.get(spec);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new UndefinedResObject(String.format("resource: spec=%s, config=%s", spec, this));
|
throw new UndefinedResObjectException(String.format("resource: spec=%s, config=%s", spec, this));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +70,7 @@ public final class ResTypeSpec {
|
|||||||
public ResResSpec getResSpec(String name) throws AndrolibException {
|
public ResResSpec getResSpec(String name) throws AndrolibException {
|
||||||
ResResSpec spec = getResSpecUnsafe(name);
|
ResResSpec spec = getResSpecUnsafe(name);
|
||||||
if (spec == null) {
|
if (spec == null) {
|
||||||
throw new UndefinedResObject(String.format("resource spec: %s/%s", getName(), name));
|
throw new UndefinedResObjectException(String.format("resource spec: %s/%s", getName(), name));
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.data.value;
|
package brut.androlib.res.data.value;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import brut.androlib.res.data.ResPackage;
|
import brut.androlib.res.data.ResPackage;
|
||||||
import brut.androlib.res.data.ResResSpec;
|
import brut.androlib.res.data.ResResSpec;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ public class ResReferenceValue extends ResIntValue {
|
|||||||
public ResResSpec getReferent() throws AndrolibException {
|
public ResResSpec getReferent() throws AndrolibException {
|
||||||
try {
|
try {
|
||||||
return mPackage.getResTable().getResSpec(getValue());
|
return mPackage.getResTable().getResSpec(getValue());
|
||||||
} catch (UndefinedResObject ex) {
|
} catch (UndefinedResObjectException ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,13 @@
|
|||||||
package brut.androlib.res.decoder;
|
package brut.androlib.res.decoder;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.CantFind9PatchChunk;
|
import brut.androlib.err.CantFind9PatchChunkException;
|
||||||
import brut.util.ExtDataInput;
|
import brut.util.ExtDataInput;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.Raster;
|
import java.awt.image.Raster;
|
||||||
import java.awt.image.WritableRaster;
|
import java.awt.image.WritableRaster;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
@ -110,7 +109,7 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
|||||||
int y = h - i;
|
int y = h - i;
|
||||||
im2.setRGB(w + 1, y, OI_COLOR);
|
im2.setRGB(w + 1, y, OI_COLOR);
|
||||||
}
|
}
|
||||||
} catch (CantFind9PatchChunk t) {
|
} catch (CantFind9PatchChunkException t) {
|
||||||
// This chunk might not exist
|
// This chunk might not exist
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +146,7 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
|||||||
try {
|
try {
|
||||||
size = di.readInt();
|
size = di.readInt();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new CantFind9PatchChunk("Cant find nine patch chunk", ex);
|
throw new CantFind9PatchChunkException("Cant find nine patch chunk", ex);
|
||||||
}
|
}
|
||||||
if (di.readInt() == magic) {
|
if (di.readInt() == magic) {
|
||||||
return;
|
return;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.decoder;
|
package brut.androlib.res.decoder;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.UndefinedResObject;
|
import brut.androlib.err.UndefinedResObjectException;
|
||||||
import brut.androlib.res.data.ResPackage;
|
import brut.androlib.res.data.ResPackage;
|
||||||
import brut.androlib.res.data.ResResSpec;
|
import brut.androlib.res.data.ResResSpec;
|
||||||
import brut.androlib.res.data.value.ResAttr;
|
import brut.androlib.res.data.value.ResAttr;
|
||||||
@ -39,7 +39,7 @@ public class ResAttrDecoder {
|
|||||||
.getResSpec(attrResId).getDefaultResource().getValue();
|
.getResSpec(attrResId).getDefaultResource().getValue();
|
||||||
|
|
||||||
decoded = attr.convertToResXmlFormat(resValue);
|
decoded = attr.convertToResXmlFormat(resValue);
|
||||||
} catch (UndefinedResObject | ClassCastException ex) {
|
} catch (UndefinedResObjectException | ClassCastException ex) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package brut.androlib.res.decoder;
|
package brut.androlib.res.decoder;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.CantFind9PatchChunk;
|
import brut.androlib.err.CantFind9PatchChunkException;
|
||||||
import brut.androlib.err.RawXmlEncounteredException;
|
import brut.androlib.err.RawXmlEncounteredException;
|
||||||
import brut.androlib.res.data.ResResource;
|
import brut.androlib.res.data.ResResource;
|
||||||
import brut.androlib.res.data.value.ResBoolValue;
|
import brut.androlib.res.data.value.ResBoolValue;
|
||||||
@ -93,7 +93,7 @@ public class ResFileDecoder {
|
|||||||
try {
|
try {
|
||||||
decode(inDir, inFileName, outDir, outFileName, "9patch");
|
decode(inDir, inFileName, outDir, outFileName, "9patch");
|
||||||
return;
|
return;
|
||||||
} catch (CantFind9PatchChunk ex) {
|
} catch (CantFind9PatchChunkException ex) {
|
||||||
LOGGER.log(
|
LOGGER.log(
|
||||||
Level.WARNING,
|
Level.WARNING,
|
||||||
String.format(
|
String.format(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user