Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5dd0ab9 authored by William Escande's avatar William Escande
Browse files

ErrorProne: Enforce & fix StringCharset

See https://errorprone.info/bugpattern/CatchFail

Bug: 344658662
Test: m BluetoothInstrumentationTests
Flag: Exempt Build and test only
Change-Id: Ice9aa37abe6f16e4ceddb71f472dc13f92d6db6c
parent d73fbee8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ java_defaults {
            "-Xep:EmptyCatch:ERROR",
            "-Xep:InvalidInlineTag:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:StringCharset:ERROR",
            "-Xep:UnnecessaryAssignment:ERROR",
            "-Xep:UnnecessaryAsync:ERROR",
            "-Xep:UnusedMethod:ERROR",
+2 −6
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import org.junit.runner.RunWith;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

/** A test suite for the BipImageProperties class */
@RunWith(AndroidJUnit4.class)
@@ -108,11 +108,7 @@ public class BipImagePropertiesTest {
    private static final String IMAGE_PROPERTIES_END = "</image-properties>";

    private InputStream toUtf8Stream(String s) {
        try {
            return new ByteArrayInputStream(s.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            return null;
        }
        return new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8));
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ java_sdk_library {
            "-Xep:EmptyCatch:ERROR",
            "-Xep:InvalidInlineTag:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:StringCharset:ERROR",
            "-Xep:UnnecessaryAssignment:ERROR",
            "-Xep:UnnecessaryAsync:ERROR",

+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ java_defaults {
            "-Xep:InvalidInlineTag:ERROR",
            "-Xep:NonApiType:ERROR",
            "-Xep:ReferenceEquality:ERROR",
            "-Xep:StringCharset:ERROR",
            "-Xep:UnnecessaryAssignment:ERROR",
            "-Xep:UnnecessaryAsync:ERROR",
            "-Xep:UnusedMethod:ERROR",