Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoder: Extend "keep-broken-res" to also ignore duplicate resources #1164

Merged
merged 1 commit into from Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -73,6 +73,8 @@ public void setApi(int api) {
public void decode() throws AndrolibException, IOException, DirectoryException {
File outDir = getOutDir();

AndrolibResources.sKeepBroken = mKeepBrokenResources;

if (!mForceDelete && outDir.exists()) {
throw new OutDirExistsException();
}
Expand Down Expand Up @@ -239,7 +241,6 @@ public ResTable getResTable() throws AndrolibException {
throw new AndrolibException(
"Apk doesn't contain either AndroidManifest.xml file or resources.arsc file");
}
AndrolibResources.sKeepBroken = mKeepBrokenResources;
mResTable = mAndrolib.getResTable(mApkFile, hasResources);
}
return mResTable;
Expand Down
Expand Up @@ -249,8 +249,18 @@ private void readEntry() throws IOException, AndrolibException {
}
ResResource res = new ResResource(mType, spec, value);

mType.addResource(res);
spec.addResource(res);
try {
mType.addResource(res);
spec.addResource(res);
} catch (AndrolibException e) {
if (mKeepBroken) {
mType.addResource(res, true);
spec.addResource(res, true);
System.err.println("ignoring exception: " + e);
} else {
throw e;
}
}
mPkg.addResource(res);
}

Expand Down