mirror of
https://github.com/iBotPeaches/Apktool.git
synced 2024-11-23 12:39:43 +00:00
Fix: add missing stream closing on manifest disassemble (#3634)
* add missing stream closing * replace custom close with apache
This commit is contained in:
parent
71748d6fd4
commit
1542fd0387
@ -28,6 +28,7 @@ import brut.androlib.res.xml.ResXmlPatcher;
|
||||
import brut.directory.Directory;
|
||||
import brut.directory.DirectoryException;
|
||||
import brut.directory.FileDirectory;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import java.io.*;
|
||||
@ -77,6 +78,8 @@ public class ResourcesDecoder {
|
||||
XmlPullStreamDecoder fileDecoder = new XmlPullStreamDecoder(axmlParser, getResXmlSerializer());
|
||||
|
||||
Directory inApk, out;
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
inApk = mApkInfo.getApkFile().getDirectory();
|
||||
out = new FileDirectory(outDir);
|
||||
@ -86,12 +89,15 @@ public class ResourcesDecoder {
|
||||
} else {
|
||||
LOGGER.info("Decoding AndroidManifest.xml with only framework resources...");
|
||||
}
|
||||
InputStream inputStream = inApk.getFileInput("AndroidManifest.xml");
|
||||
OutputStream outputStream = out.getFileOutput("AndroidManifest.xml");
|
||||
inputStream = inApk.getFileInput("AndroidManifest.xml");
|
||||
outputStream = out.getFileOutput("AndroidManifest.xml");
|
||||
fileDecoder.decodeManifest(inputStream, outputStream);
|
||||
|
||||
} catch (DirectoryException ex) {
|
||||
throw new AndrolibException(ex);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
IOUtils.closeQuietly(outputStream);
|
||||
}
|
||||
|
||||
if (mApkInfo.hasResources()) {
|
||||
|
Loading…
Reference in New Issue
Block a user