KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > icu > impl > Assert


1 /*
2 *******************************************************************************
3 * Copyright (C) 2005-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 */

7 package com.ibm.icu.impl;
8
9 // 1.3 compatibility layer
10
public class Assert {
11     public static void fail(Exception JavaDoc e) {
12         fail(e.toString()); // can't wrap exceptions in jdk 1.3
13
}
14     public static void fail(String JavaDoc msg) {
15         throw new IllegalStateException JavaDoc("failure '" + msg + "'");
16     }
17     public static void assrt(boolean val) {
18         if (!val) throw new IllegalStateException JavaDoc("assert failed");
19     }
20     public static void assrt(String JavaDoc msg, boolean val) {
21         if (!val) throw new IllegalStateException JavaDoc("assert '" + msg + "' failed");
22     }
23 }
24
Popular Tags