01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package javacard.framework;
28:
29: /**
30: * <code>TransactionException</code> represents an exception in the
31: * transaction subsystem.
32: */
33:
34: public class TransactionException extends CardRuntimeException {
35:
36: // constants
37: /**
38: * This reason code is used by the <code>beginTransaction</code>
39: * method to indicate
40: * a transaction is already in progress.
41: */
42: // beginTransaction called when already in progress
43: public final static short IN_PROGRESS = 1;
44:
45: /**
46: * This reason code is used by the <code>abortTransaction</code>
47: * and <code>commitTransaction</code> methods
48: * when a transaction is not in progress.
49: */
50: // commit/abortTransaction called when not in progress
51: public final static short NOT_IN_PROGRESS = 2;
52:
53: /**
54: * This reason code is used during a transaction to indicate that
55: * the commit buffer is full.
56: */
57: // commit buffer is full
58: public final static short BUFFER_FULL = 3;
59:
60: /**
61: * This reason code is used during a transaction to indicate
62: * an internal JCRE problem (fatal error).
63: */
64: // internal JCRE problem (fatal error)
65: public final static short INTERNAL_FAILURE = 4;
66:
67: /**
68: * Constructs a <code>TransactionException</code> with the specified reason.
69: * @param reason the internal code indicating the cause of the
70: * error detected
71: */
72: public TransactionException(short reason) {
73: super (reason);
74: }
75:
76: /**
77: * Throws an instance of <code>TransactionException</code> with
78: * the specified reason.
79: * @exception TransactionException always
80: * @param reason the internal code indicating the cause of the
81: * error detected
82: */
83: public static void throwIt(short reason) {
84: throw new TransactionException(reason);
85: }
86: }
|