diff --git a/src/brut/androlib/res/ResSmaliUpdater.java b/src/brut/androlib/res/ResSmaliUpdater.java index c04bc2f1..9771b73d 100644 --- a/src/brut/androlib/res/ResSmaliUpdater.java +++ b/src/brut/androlib/res/ResSmaliUpdater.java @@ -18,7 +18,7 @@ package brut.androlib.res; import brut.androlib.AndrolibException; -import brut.androlib.err.UndefinedResourceSpec; +import brut.androlib.err.UndefinedResObject; import brut.androlib.res.data.ResResSpec; import brut.androlib.res.data.ResTable; import brut.directory.Directory; @@ -123,7 +123,7 @@ public class ResSmaliUpdater { ResResSpec spec = resTable.getResSpec(resID); out.println(String.format( RES_NAME_FORMAT, spec.getFullName())); - } catch (UndefinedResourceSpec ex) { + } catch (UndefinedResObject ex) { if (! R_FILE_PATTERN.matcher(fileName).matches()) { System.err.println(String.format( "warning: undefined resource spec in %s: 0x%08x" diff --git a/src/brut/androlib/res/data/ResConfig.java b/src/brut/androlib/res/data/ResConfig.java index e0d9d5a7..04f8236e 100644 --- a/src/brut/androlib/res/data/ResConfig.java +++ b/src/brut/androlib/res/data/ResConfig.java @@ -18,6 +18,7 @@ package brut.androlib.res.data; import brut.androlib.AndrolibException; +import brut.androlib.err.UndefinedResObject; import java.util.*; /** @@ -39,8 +40,8 @@ public class ResConfig { public ResResource getResource(ResResSpec spec) throws AndrolibException { ResResource res = mResources.get(spec); if (res == null) { - throw new AndrolibException(String.format( - "Undefined resource: spec=%s, config=%s", spec, this)); + throw new UndefinedResObject(String.format( + "resource: spec=%s, config=%s", spec, this)); } return res; } diff --git a/src/brut/androlib/res/data/ResPackage.java b/src/brut/androlib/res/data/ResPackage.java index 84e31298..f2d10081 100644 --- a/src/brut/androlib/res/data/ResPackage.java +++ b/src/brut/androlib/res/data/ResPackage.java @@ -17,7 +17,7 @@ package brut.androlib.res.data; -import brut.androlib.err.UndefinedResourceSpec; +import brut.androlib.err.UndefinedResObject; import brut.androlib.AndrolibException; import brut.androlib.res.data.value.ResFileValue; import brut.androlib.res.data.value.ResValue; @@ -59,10 +59,10 @@ public class ResPackage { return mResSpecs.containsKey(resID); } - public ResResSpec getResSpec(ResID resID) throws UndefinedResourceSpec { + public ResResSpec getResSpec(ResID resID) throws UndefinedResObject { ResResSpec spec = mResSpecs.get(resID); if (spec == null) { - throw new UndefinedResourceSpec(resID.toString()); + throw new UndefinedResObject("resource spec: " + resID.toString()); } return spec; } @@ -78,7 +78,7 @@ public class ResPackage { public ResConfig getConfig(ResConfigFlags flags) throws AndrolibException { ResConfig config = mConfigs.get(flags); if (config == null) { - throw new AndrolibException("Undefined config: " + flags); + throw new UndefinedResObject("config: " + flags); } return config; } @@ -94,7 +94,7 @@ public class ResPackage { public ResType getType(String typeName) throws AndrolibException { ResType type = mTypes.get(typeName); if (type == null) { - throw new AndrolibException("Undefined type: " + typeName); + throw new UndefinedResObject("type: " + typeName); } return type; } diff --git a/src/brut/androlib/res/data/ResResSpec.java b/src/brut/androlib/res/data/ResResSpec.java index ade038d9..69a60291 100644 --- a/src/brut/androlib/res/data/ResResSpec.java +++ b/src/brut/androlib/res/data/ResResSpec.java @@ -18,6 +18,7 @@ package brut.androlib.res.data; import brut.androlib.AndrolibException; +import brut.androlib.err.UndefinedResObject; import java.util.*; /** @@ -50,8 +51,8 @@ public class ResResSpec { throws AndrolibException { ResResource res = mResources.get(config); if (res == null) { - throw new AndrolibException(String.format( - "Undefined resource: spec=%s, config=%s", this, config)); + throw new UndefinedResObject(String.format( + "resource: spec=%s, config=%s", this, config)); } return res; } diff --git a/src/brut/androlib/res/data/ResTable.java b/src/brut/androlib/res/data/ResTable.java index 68ab4b0d..1d48e65d 100644 --- a/src/brut/androlib/res/data/ResTable.java +++ b/src/brut/androlib/res/data/ResTable.java @@ -18,12 +18,10 @@ package brut.androlib.res.data; import brut.androlib.AndrolibException; -import brut.androlib.res.data.value.ResAttr; +import brut.androlib.err.UndefinedResObject; import brut.androlib.res.data.value.ResValue; -import brut.androlib.res.data.value.ResValueFactory; import java.util.HashMap; import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; import java.util.Set; @@ -56,8 +54,8 @@ public class ResTable { public ResPackage getPackage(int id) throws AndrolibException { ResPackage pkg = mPackagesById.get(id); if (pkg == null) { - throw new AndrolibException(String.format( - "Undefined package: id=%d", id)); + throw new UndefinedResObject(String.format( + "package: id=%d", id)); } return pkg; } @@ -65,7 +63,7 @@ public class ResTable { public ResPackage getPackage(String name) throws AndrolibException { ResPackage pkg = mPackagesByName.get(name); if (pkg == null) { - throw new AndrolibException("Undefined package: name=" + name); + throw new UndefinedResObject("package: name=" + name); } return pkg; } diff --git a/src/brut/androlib/res/data/ResType.java b/src/brut/androlib/res/data/ResType.java index b71f5281..962b59c3 100644 --- a/src/brut/androlib/res/data/ResType.java +++ b/src/brut/androlib/res/data/ResType.java @@ -18,14 +18,8 @@ package brut.androlib.res.data; import brut.androlib.AndrolibException; -import brut.androlib.res.AndrolibResources; -import brut.androlib.res.decoder.ResFileDecoder; -import brut.androlib.res.decoder.ResXmlSerializer; -import brut.directory.Directory; -import brut.directory.DirectoryException; -import java.io.IOException; +import brut.androlib.err.UndefinedResObject; import java.util.*; -import java.util.Map.Entry; /** * @author Ryszard Wiśniewski @@ -57,8 +51,8 @@ public final class ResType { public ResResSpec getResSpec(String name) throws AndrolibException { ResResSpec spec = mResSpecs.get(name); if (spec == null) { - throw new AndrolibException(String.format( - "Undefined resource spec: %s/%s", getName(), name)); + throw new UndefinedResObject(String.format( + "resource spec: %s/%s", getName(), name)); } return spec; }