misc lint fixes

fdroid/fdroidclient!543
This commit is contained in:
Hans-Christoph Steiner 2018-08-08 12:09:04 +02:00
parent 32296910df
commit 8fb43b29b2
4 changed files with 17 additions and 21 deletions

View File

@ -73,12 +73,12 @@ public final class Languages {
return singleton; return singleton;
} }
@TargetApi(17)
/** /**
* Handles setting the language if it is different than the current language, * Handles setting the language if it is different than the current language,
* or different than the current system-wide locale. The preference is cleared * or different than the current system-wide locale. The preference is cleared
* if the language matches the system-wide locale or "System Default" is chosen. * if the language matches the system-wide locale or "System Default" is chosen.
*/ */
@TargetApi(17)
public static void setLanguage(final ContextWrapper contextWrapper) { public static void setLanguage(final ContextWrapper contextWrapper) {
if (Build.VERSION.SDK_INT >= 24) { if (Build.VERSION.SDK_INT >= 24) {
Utils.debugLog(TAG, "Languages.setLanguage() ignored on >= android-24"); Utils.debugLog(TAG, "Languages.setLanguage() ignored on >= android-24");

View File

@ -10,9 +10,6 @@ import org.acra.collections.ImmutableSet;
import org.acra.collector.CrashReportData; import org.acra.collector.CrashReportData;
import org.acra.config.ACRAConfiguration; import org.acra.config.ACRAConfiguration;
import org.acra.sender.ReportSender; import org.acra.sender.ReportSender;
import org.acra.sender.ReportSenderException;
import java.util.Iterator;
public class CrashReportSender implements ReportSender { public class CrashReportSender implements ReportSender {
@ -24,7 +21,7 @@ public class CrashReportSender implements ReportSender {
public void send(@NonNull Context context, @NonNull CrashReportData errorContent) { public void send(@NonNull Context context, @NonNull CrashReportData errorContent) {
Intent emailIntent = new Intent("android.intent.action.SENDTO"); Intent emailIntent = new Intent("android.intent.action.SENDTO");
emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), (String) null)); emailIntent.setData(Uri.fromParts("mailto", this.config.mailTo(), null));
emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
String[] subjectBody = this.buildSubjectBody(context, errorContent); String[] subjectBody = this.buildSubjectBody(context, errorContent);
emailIntent.putExtra("android.intent.extra.SUBJECT", subjectBody[0]); emailIntent.putExtra("android.intent.extra.SUBJECT", subjectBody[0]);
@ -33,17 +30,14 @@ public class CrashReportSender implements ReportSender {
} }
private String[] buildSubjectBody(Context context, CrashReportData errorContent) { private String[] buildSubjectBody(Context context, CrashReportData errorContent) {
ImmutableSet fields = this.config.getReportFields(); ImmutableSet<ReportField> fields = this.config.getReportFields();
if (fields.isEmpty()) { if (fields.isEmpty()) {
return new String[]{"No ACRA Report Fields found."}; return new String[]{"No ACRA Report Fields found."};
} }
String subject = context.getPackageName() + " Crash Report"; String subject = context.getPackageName() + " Crash Report";
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
Iterator var4 = fields.iterator(); for (ReportField field : fields) {
while (var4.hasNext()) {
ReportField field = (ReportField) var4.next();
builder.append(field.toString()).append('='); builder.append(field.toString()).append('=');
builder.append(errorContent.get(field)); builder.append(errorContent.get(field));
builder.append('\n'); builder.append('\n');

View File

@ -462,12 +462,14 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
} }
@JsonProperty("uses-permission") @JsonProperty("uses-permission")
private void setUsesPermission(Object[][] permissions) { // NOPMD @SuppressWarnings("unused")
private void setUsesPermission(Object[][] permissions) {
setRequestedPermissions(permissions, 0); setRequestedPermissions(permissions, 0);
} }
@JsonProperty("uses-permission-sdk-23") @JsonProperty("uses-permission-sdk-23")
private void setUsesPermissionSdk23(Object[][] permissions) { // NOPMD @SuppressWarnings("unused")
private void setUsesPermissionSdk23(Object[][] permissions) {
setRequestedPermissions(permissions, 23); setRequestedPermissions(permissions, 23);
} }

View File

@ -42,16 +42,16 @@ public class SanitizedFile extends File {
* the path to an installed .apk on disk. In such situations, we can't meaningfully * the path to an installed .apk on disk. In such situations, we can't meaningfully
* sanitize it, but will still need to pass to a function which only allows SanitizedFile's * sanitize it, but will still need to pass to a function which only allows SanitizedFile's
* as arguments (because they interact with, e.g. shells). * as arguments (because they interact with, e.g. shells).
* * <p>
* To illustrate, imagine perfectly valid file path: "/tmp/../secret/file.txt", * To illustrate, imagine perfectly valid file path: "/tmp/../secret/file.txt",
* one cannot distinguish between: * one cannot distinguish between:
* * <p>
* "/tmp/" (known safe directory) + "../secret/file.txt" (suspicious looking file name) * "/tmp/" (known safe directory) + "../secret/file.txt" (suspicious looking file name)
* * <p>
* and * and
* * <p>
* "/tmp/../secret/" (known safe directory) + "file.txt" (known safe file name) * "/tmp/../secret/" (known safe directory) + "file.txt" (known safe file name)
* * <p>
* I guess the best this method offers us is the ability to uniquely trace the different * I guess the best this method offers us is the ability to uniquely trace the different
* ways in which files are created and handled. It should make it easier to find and * ways in which files are created and handled. It should make it easier to find and
* prevent suspect usages of methods which only expect SanitizedFile's, but are given * prevent suspect usages of methods which only expect SanitizedFile's, but are given
@ -62,7 +62,7 @@ public class SanitizedFile extends File {
} }
/** /**
* @see {@link org.fdroid.fdroid.data.SanitizedFile#knownSanitized(String)} * @see org.fdroid.fdroid.data.SanitizedFile#knownSanitized(String)
*/ */
public static SanitizedFile knownSanitized(File file) { public static SanitizedFile knownSanitized(File file) {
return new SanitizedFile(file); return new SanitizedFile(file);