mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-05 02:22:55 +01:00
+ UndefinedResObject
This commit is contained in:
parent
f65ded9c7c
commit
8c0a1a0c98
@ -18,7 +18,7 @@
|
|||||||
package brut.androlib.res;
|
package brut.androlib.res;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
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.ResResSpec;
|
||||||
import brut.androlib.res.data.ResTable;
|
import brut.androlib.res.data.ResTable;
|
||||||
import brut.directory.Directory;
|
import brut.directory.Directory;
|
||||||
@ -123,7 +123,7 @@ public class ResSmaliUpdater {
|
|||||||
ResResSpec spec = resTable.getResSpec(resID);
|
ResResSpec spec = resTable.getResSpec(resID);
|
||||||
out.println(String.format(
|
out.println(String.format(
|
||||||
RES_NAME_FORMAT, spec.getFullName()));
|
RES_NAME_FORMAT, spec.getFullName()));
|
||||||
} catch (UndefinedResourceSpec ex) {
|
} catch (UndefinedResObject ex) {
|
||||||
if (! R_FILE_PATTERN.matcher(fileName).matches()) {
|
if (! R_FILE_PATTERN.matcher(fileName).matches()) {
|
||||||
System.err.println(String.format(
|
System.err.println(String.format(
|
||||||
"warning: undefined resource spec in %s: 0x%08x"
|
"warning: undefined resource spec in %s: 0x%08x"
|
||||||
|
@ -18,6 +18,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 java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,8 +40,8 @@ public class ResConfig {
|
|||||||
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 AndrolibException(String.format(
|
throw new UndefinedResObject(String.format(
|
||||||
"Undefined resource: spec=%s, config=%s", spec, this));
|
"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.err.UndefinedResourceSpec;
|
import brut.androlib.err.UndefinedResObject;
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.res.data.value.ResFileValue;
|
import brut.androlib.res.data.value.ResFileValue;
|
||||||
import brut.androlib.res.data.value.ResValue;
|
import brut.androlib.res.data.value.ResValue;
|
||||||
@ -59,10 +59,10 @@ public class ResPackage {
|
|||||||
return mResSpecs.containsKey(resID);
|
return mResSpecs.containsKey(resID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResResSpec getResSpec(ResID resID) throws UndefinedResourceSpec {
|
public ResResSpec getResSpec(ResID resID) throws UndefinedResObject {
|
||||||
ResResSpec spec = mResSpecs.get(resID);
|
ResResSpec spec = mResSpecs.get(resID);
|
||||||
if (spec == null) {
|
if (spec == null) {
|
||||||
throw new UndefinedResourceSpec(resID.toString());
|
throw new UndefinedResObject("resource spec: " + resID.toString());
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public class ResPackage {
|
|||||||
public ResConfig getConfig(ResConfigFlags flags) throws AndrolibException {
|
public ResConfig getConfig(ResConfigFlags flags) throws AndrolibException {
|
||||||
ResConfig config = mConfigs.get(flags);
|
ResConfig config = mConfigs.get(flags);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw new AndrolibException("Undefined config: " + flags);
|
throw new UndefinedResObject("config: " + flags);
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ public class ResPackage {
|
|||||||
public ResType getType(String typeName) throws AndrolibException {
|
public ResType getType(String typeName) throws AndrolibException {
|
||||||
ResType type = mTypes.get(typeName);
|
ResType type = mTypes.get(typeName);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new AndrolibException("Undefined type: " + typeName);
|
throw new UndefinedResObject("type: " + typeName);
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,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 java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,8 +51,8 @@ public class ResResSpec {
|
|||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
ResResource res = mResources.get(config);
|
ResResource res = mResources.get(config);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
throw new AndrolibException(String.format(
|
throw new UndefinedResObject(String.format(
|
||||||
"Undefined resource: spec=%s, config=%s", this, config));
|
"resource: spec=%s, config=%s", this, config));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,10 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
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.ResValue;
|
||||||
import brut.androlib.res.data.value.ResValueFactory;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -56,8 +54,8 @@ public class ResTable {
|
|||||||
public ResPackage getPackage(int id) throws AndrolibException {
|
public ResPackage getPackage(int id) throws AndrolibException {
|
||||||
ResPackage pkg = mPackagesById.get(id);
|
ResPackage pkg = mPackagesById.get(id);
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
throw new AndrolibException(String.format(
|
throw new UndefinedResObject(String.format(
|
||||||
"Undefined package: id=%d", id));
|
"package: id=%d", id));
|
||||||
}
|
}
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
@ -65,7 +63,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 AndrolibException("Undefined package: name=" + name);
|
throw new UndefinedResObject("package: name=" + name);
|
||||||
}
|
}
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,8 @@
|
|||||||
package brut.androlib.res.data;
|
package brut.androlib.res.data;
|
||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.res.AndrolibResources;
|
import brut.androlib.err.UndefinedResObject;
|
||||||
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 java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||||
@ -57,8 +51,8 @@ public final class ResType {
|
|||||||
public ResResSpec getResSpec(String name) throws AndrolibException {
|
public ResResSpec getResSpec(String name) throws AndrolibException {
|
||||||
ResResSpec spec = mResSpecs.get(name);
|
ResResSpec spec = mResSpecs.get(name);
|
||||||
if (spec == null) {
|
if (spec == null) {
|
||||||
throw new AndrolibException(String.format(
|
throw new UndefinedResObject(String.format(
|
||||||
"Undefined resource spec: %s/%s", getName(), name));
|
"resource spec: %s/%s", getName(), name));
|
||||||
}
|
}
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user