修复stream未关闭,导致rename file失败的问题

This commit is contained in:
Windy 2020-02-09 16:48:32 +08:00
parent 863739ea27
commit cc1ba504e7
1 changed files with 10 additions and 1 deletions

View File

@ -25,8 +25,9 @@ public class ManifestParser {
System.out.println(" manifest file not exist!!! filePath -> " + filePath);
return null;
}
FileInputStream inputStream = null;
try {
FileInputStream inputStream = new FileInputStream(file);
inputStream = new FileInputStream(file);
parser.open(inputStream);
@ -65,6 +66,14 @@ public class ManifestParser {
} catch (XmlPullParserException | IOException e) {
e.printStackTrace();
System.out.println("parseManifestFile failed, reason --> " + e.getMessage());
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return new Pair(packageName, applicationName);
}