mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-07 10:35:52 +01:00
ResFileDecoder: moved exception catching to outer decode() method, so it can handle decoders exceptions.
This commit is contained in:
parent
28186f8d22
commit
604b15c1cc
@ -54,23 +54,29 @@ public class ResFileDecoder {
|
|||||||
outFileName = outResName + ext;
|
outFileName = outResName + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeName.equals("raw")) {
|
try {
|
||||||
decode(inDir, inFileName, outDir, outFileName, "raw");
|
if (typeName.equals("raw")) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (typeName.equals("drawable")) {
|
|
||||||
if (inFileName.toLowerCase().endsWith(".9.png")) {
|
|
||||||
outFileName = outResName + ".9" + ext;
|
|
||||||
decode(inDir, inFileName, outDir, outFileName, "9patch");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (! ext.equals(".xml")) {
|
|
||||||
decode(inDir, inFileName, outDir, outFileName, "raw");
|
decode(inDir, inFileName, outDir, outFileName, "raw");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (typeName.equals("drawable")) {
|
||||||
|
if (inFileName.toLowerCase().endsWith(".9.png")) {
|
||||||
|
outFileName = outResName + ".9" + ext;
|
||||||
|
decode(inDir, inFileName, outDir, outFileName, "9patch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (! ext.equals(".xml")) {
|
||||||
|
decode(inDir, inFileName, outDir, outFileName, "raw");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
decode(inDir, inFileName, outDir, outFileName, "xml");
|
decode(inDir, inFileName, outDir, outFileName, "xml");
|
||||||
|
} catch (AndrolibException ex) {
|
||||||
|
LOGGER.log(Level.SEVERE, String.format(
|
||||||
|
"Could not decode file \"%s\" to \"%s\"",
|
||||||
|
inFileName, outFileName), ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decode(Directory inDir, String inFileName, Directory outDir,
|
public void decode(Directory inDir, String inFileName, Directory outDir,
|
||||||
@ -81,18 +87,10 @@ public class ResFileDecoder {
|
|||||||
mDecoders.decode(in, out, decoder);
|
mDecoders.decode(in, out, decoder);
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
} catch (AndrolibException ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, String.format(
|
|
||||||
"Could not decode file \"%s\" to \"%s\"",
|
|
||||||
inFileName, outFileName), ex);
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LOGGER.log(Level.SEVERE, String.format(
|
throw new AndrolibException(ex);
|
||||||
"Could not decode file \"%s\" to \"%s\"",
|
|
||||||
inFileName, outFileName), ex);
|
|
||||||
} catch (DirectoryException ex) {
|
} catch (DirectoryException ex) {
|
||||||
LOGGER.log(Level.SEVERE, String.format(
|
throw new AndrolibException(ex);
|
||||||
"Could not decode file \"%s\" to \"%s\"",
|
|
||||||
inFileName, outFileName), ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user