android: Cleanup classes
- Use final modifer wherever possible - Use try-with-resources for input/output streams Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
committed by
Jason A. Donenfeld
parent
4986d92f3d
commit
4671f59c67
@@ -75,7 +75,8 @@ public class LogExporterPreference extends Preference {
|
||||
throw new Exception(errors.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// noinspection ResultOfMethodCallIgnored
|
||||
file.delete();
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,9 @@ public class VersionPreference extends Preference {
|
||||
versionSummary = getContext().getString(R.string.version_userspace_summary, GoBackend.getVersion());
|
||||
} else if (Application.getComponent().getBackendType() == WgQuickBackend.class) {
|
||||
Application.getComponent().getToolsInstaller().getVersion().whenComplete((version, exception) -> {
|
||||
if (exception == null)
|
||||
versionSummary = getContext().getString(R.string.version_kernel_summary, version);
|
||||
else
|
||||
versionSummary = getContext().getString(R.string.version_kernel_unknown_summary);
|
||||
versionSummary = exception == null
|
||||
? getContext().getString(R.string.version_kernel_summary, version)
|
||||
: getContext().getString(R.string.version_kernel_unknown_summary);
|
||||
notifyChanged();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,8 +81,7 @@ public class ZipExporterPreference extends Preference {
|
||||
toString().getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
zip.closeEntry();
|
||||
zip.close();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// noinspection ResultOfMethodCallIgnored
|
||||
file.delete();
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user