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

Commit 1597e054 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Tron logging - Fix isValidValue to match its name, allow nulls."

parents d20a0fd3 2d89c243
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class LogMaker {
     * @return
     */
    public LogMaker addTaggedData(int tag, Object value) {
        if (isValidValue(value)) {
        if (!isValidValue(value)) {
            throw new IllegalArgumentException(
                    "Value must be loggable type - int, long, float, String");
        }
@@ -119,10 +119,14 @@ public class LogMaker {
    }

    public boolean isValidValue(Object value) {
        return !(value instanceof Integer ||
        if (value == null) {
            Log.i("LogBuilder", "Logging a null value.");
            return true;
        }
        return value instanceof Integer ||
            value instanceof String ||
            value instanceof Long ||
            value instanceof Float);
            value instanceof Float;
    }

    public Object getTaggedData(int tag) {
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public class LogMakerTest extends TestCase {
        builder.addTaggedData(2, 123);
        builder.addTaggedData(3, 123L);
        builder.addTaggedData(4, 123.0F);
        builder.addTaggedData(5, null);
        Object[] out = builder.serialize();
        assertEquals("onetwothree", out[1]);
        assertEquals(123, out[3]);