mirror of
https://github.com/revanced/jadb.git
synced 2025-05-29 13:00:11 +02:00
Fix: Try-with-resources should be used (squid:S2093)
This commit is contained in:
parent
9cd5f509ae
commit
b9a86b85fa
@ -22,10 +22,8 @@ public class PackageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Package> getPackages() throws IOException, JadbException {
|
public List<Package> getPackages() throws IOException, JadbException {
|
||||||
ArrayList<Package> result = new ArrayList<>();
|
try (BufferedReader input = new BufferedReader(new InputStreamReader(device.executeShell("pm", "list", "packages"), StandardCharsets.UTF_8))) {
|
||||||
BufferedReader input = null;
|
ArrayList<Package> result = new ArrayList<>();
|
||||||
try {
|
|
||||||
input = new BufferedReader(new InputStreamReader(device.executeShell("pm", "list", "packages"), StandardCharsets.UTF_8));
|
|
||||||
String line;
|
String line;
|
||||||
while ((line = input.readLine()) != null) {
|
while ((line = input.readLine()) != null) {
|
||||||
final String prefix = "package:";
|
final String prefix = "package:";
|
||||||
@ -33,10 +31,8 @@ public class PackageManager {
|
|||||||
result.add(new Package(line.substring(prefix.length())));
|
result.add(new Package(line.substring(prefix.length())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
return result;
|
||||||
if (input != null) input.close();
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getErrorMessage(String operation, String target, String errorMessage) {
|
private String getErrorMessage(String operation, String target, String errorMessage) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user