01: /**********************************************************************************
02:
03: Feedzeo!
04: A free and open source RSS/Atom/RDF feed aggregator
05:
06: Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
07:
08: This library is free software; you can redistribute it and/or
09: modify it under the terms of the GNU Lesser General Public
10: License as published by the Free Software Foundation; either
11: version 2.1 of the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21:
22: ************************************************************************************/package util;
23:
24: /**
25: *
26: * @author Anand Rao
27: */
28: public class ExceptionUtil {
29: static boolean ExceptionOccured = false;
30:
31: public static void reportException(Exception e) {
32: ExceptionOccured = true;
33: System.out.println("***Exception:");
34: System.out.println(e.getMessage());
35: e.printStackTrace();
36: /*
37: *TODO: log exceptions to a file
38: */
39: }
40:
41: public static boolean checkException() {
42: return ExceptionOccured;
43: }
44:
45: public static boolean checkAndClearException() {
46: if (ExceptionOccured) {
47: ExceptionOccured = false;
48: return true;
49: }
50: return false;
51: }
52:
53: }
|