mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-05 08:14:26 +02:00
refactor: use specific exceptions when decoding raw xml
This commit is contained in:
parent
c1f50a2810
commit
45152c269a
@ -18,6 +18,7 @@ package brut.androlib.res.decoder;
|
|||||||
|
|
||||||
import brut.androlib.AndrolibException;
|
import brut.androlib.AndrolibException;
|
||||||
import brut.androlib.err.CantFind9PatchChunk;
|
import brut.androlib.err.CantFind9PatchChunk;
|
||||||
|
import brut.androlib.err.RawXmlEncounteredException;
|
||||||
import brut.androlib.res.data.ResResource;
|
import brut.androlib.res.data.ResResource;
|
||||||
import brut.androlib.res.data.value.ResBoolValue;
|
import brut.androlib.res.data.value.ResBoolValue;
|
||||||
import brut.androlib.res.data.value.ResFileValue;
|
import brut.androlib.res.data.value.ResFileValue;
|
||||||
@ -118,15 +119,12 @@ public class ResFileDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
decode(inDir, inFileName, outDir, outFileName, "xml");
|
decode(inDir, inFileName, outDir, outFileName, "xml");
|
||||||
} catch (AndrolibException ex) {
|
} catch (RawXmlEncounteredException ex) {
|
||||||
// If we got an error to decode XML, lets assume the file is in raw format.
|
// If we got an error to decode XML, lets assume the file is in raw format.
|
||||||
// This is a large assumption, that might increase runtime, but will save us for situations where
|
// This is a large assumption, that might increase runtime, but will save us for situations where
|
||||||
// XSD files are AXML`d on aapt1, but left in plaintext in aapt2.
|
// XSD files are AXML`d on aapt1, but left in plaintext in aapt2.
|
||||||
if (ex.getMessage().equalsIgnoreCase("Could not decode XML")) {
|
decode(inDir, inFileName, outDir, outFileName, "raw");
|
||||||
decode(inDir, inFileName, outDir, outFileName, "raw");
|
} catch (AndrolibException ex) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.log(Level.SEVERE, String.format(
|
LOGGER.log(Level.SEVERE, String.format(
|
||||||
"Could not decode file, replacing by FALSE value: %s",
|
"Could not decode file, replacing by FALSE value: %s",
|
||||||
inFileName), ex);
|
inFileName), ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user