package org.ccci.gto.android.common.util;

import android.support.annotation.Nullable;

public class NumberUtils {
    @Nullable
    public static Integer toInteger(@Nullable final String raw, @Nullable final Integer defaultValue) {
        if (raw != null) {
            try {
                return Integer.valueOf(raw);
            } catch (final NumberFormatException ignored) {
            }
        }

        return defaultValue;
    }
}

@@ -401,16 +401,333 @@
      %7D%0A%0A
+        return defaultValue;%0A    %7D%0A%0A    @Nullable%0A    public static Long toLong(@Nullable final String raw, @Nullable final Long defaultValue) %7B%0A        if (raw != null) %7B%0A            try %7B%0A                return Long.valueOf(raw);%0A            %7D catch (final NumberFormatException ignored) %7B%0A            %7D%0A        %7D%0A%0A
         

add a toLong method that safely parses a long value with a fallback option