mobile/android/base/Assert.java

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 package org.mozilla.gecko;
     3 public class Assert
     4 {
     5     private Assert() {}
     7     public static void equals(Object a, Object b)
     8     {
     9         equals(a, b, null);
    10     }
    12     public static void equals(Object a, Object b, String message)
    13     {
    14         Assert.isTrue(a.equals(b), message);
    15     }
    17     public static void isTrue(boolean a)
    18     {
    19         isTrue(a, null);
    20     }
    22     public static void isTrue(boolean a, String message)
    23     {
    24         if (!AppConstants.DEBUG_BUILD) {
    25             return;
    26         }
    28         if (!a) {
    29             throw new AssertException(message);
    30         }
    31     }
    33     public static class AssertException extends RuntimeException
    34     {
    35         private static final long serialVersionUID = 0L;
    37         public AssertException(String message) {
    38             super(message);
    39         }
    40     }
    41 }

mercurial