• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved.
2  *
3  * This program and the accompanying materials are made available under
4  * the terms of the Common Public License v1.0 which accompanies this distribution,
5  * and is available at http://www.eclipse.org/legal/cpl-v10.html
6  *
7  * $Id: Exceptions.java,v 1.1.1.1 2004/05/09 16:57:58 vlad_r Exp $
8  */
9 package com.vladium.util.exception;
10 
11 // ----------------------------------------------------------------------------
12 /**
13  * @author Vlad Roubtsov, (C) 2002
14  */
15 public
16 abstract class Exceptions
17 {
18     // public: ................................................................
19 
unexpectedFailure(final Throwable t, final Class [] expected)20     public static boolean unexpectedFailure (final Throwable t, final Class [] expected)
21     {
22         if (t == null) return false;
23         if (expected == null) return true;
24 
25         final Class reClass = t.getClass ();
26 
27         for (int e = 0; e < expected.length; ++ e)
28         {
29             if (expected [e] == null) continue;
30             if (expected [e].isAssignableFrom (reClass))
31                 return false;
32         }
33 
34         return true;
35     }
36 
37     // protected: .............................................................
38 
39     // package: ...............................................................
40 
41     // private: ...............................................................
42 
43 
Exceptions()44     private Exceptions () {} // this class is not extendible
45 
46 } // end of class
47 // ----------------------------------------------------------------------------