~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to src/org/hibernate/bytecode/javassist/BulkAccessorException.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hibernate.bytecode.javassist;
 
2
 
 
3
/**
 
4
 * An exception thrown while generating a bulk accessor.
 
5
 * 
 
6
 * @author Muga Nishizawa
 
7
 * @author modified by Shigeru Chiba
 
8
 */
 
9
public class BulkAccessorException extends RuntimeException {
 
10
    private Throwable myCause;
 
11
 
 
12
    /**
 
13
     * Gets the cause of this throwable.
 
14
     * It is for JDK 1.3 compatibility.
 
15
     */
 
16
    public Throwable getCause() {
 
17
        return (myCause == this ? null : myCause);
 
18
    }
 
19
 
 
20
    /**
 
21
     * Initializes the cause of this throwable.
 
22
     * It is for JDK 1.3 compatibility.
 
23
     */
 
24
    public synchronized Throwable initCause(Throwable cause) {
 
25
        myCause = cause;
 
26
        return this;
 
27
    }
 
28
 
 
29
    private int index;
 
30
 
 
31
    /**
 
32
     * Constructs an exception.
 
33
     */
 
34
    public BulkAccessorException(String message) {
 
35
        super(message);
 
36
        index = -1;
 
37
        initCause(null);
 
38
    }
 
39
 
 
40
    /**
 
41
     * Constructs an exception.
 
42
     *
 
43
     * @param index     the index of the property that causes an exception.
 
44
     */
 
45
    public BulkAccessorException(String message, int index) {
 
46
        this(message + ": " + index);
 
47
        this.index = index;
 
48
    }
 
49
 
 
50
    /**
 
51
     * Constructs an exception.
 
52
     */
 
53
    public BulkAccessorException(String message, Throwable cause) {
 
54
        super(message);
 
55
        index = -1;
 
56
        initCause(cause);
 
57
    }
 
58
 
 
59
    /**
 
60
     * Constructs an exception.
 
61
     *
 
62
     * @param index     the index of the property that causes an exception.
 
63
     */
 
64
    public BulkAccessorException(Throwable cause, int index) {
 
65
        this("Property " + index);
 
66
        this.index = index;
 
67
        initCause(cause);
 
68
    }
 
69
 
 
70
    /**
 
71
     * Returns the index of the property that causes this exception.
 
72
     *
 
73
     * @return -1 if the index is not specified.
 
74
     */
 
75
    public int getIndex() {
 
76
        return this.index;
 
77
    }
 
78
}