+ UndefinedResObject

This commit is contained in:
Ryszard Wiśniewski 2010-03-13 12:40:47 +01:00
parent f65ded9c7c
commit 8c0a1a0c98
6 changed files with 20 additions and 26 deletions

View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 <brut.alll@gmail.com>
@ -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;
}