1 | /* |
2 | * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, |
3 | * and the EPL 1.0 (http://h2database.com/html/license.html). |
4 | * Initial Developer: H2 Group |
5 | */ |
6 | package org.h2.jdbc; |
7 | |
8 | import java.io.PrintStream; |
9 | import java.io.PrintWriter; |
10 | import java.sql.BatchUpdateException; |
11 | import java.sql.SQLException; |
12 | |
13 | /** |
14 | * Represents a batch update database exception. |
15 | */ |
16 | public class JdbcBatchUpdateException extends BatchUpdateException { |
17 | |
18 | private static final long serialVersionUID = 1L; |
19 | |
20 | /** |
21 | * INTERNAL |
22 | */ |
23 | JdbcBatchUpdateException(SQLException next, int[] updateCounts) { |
24 | super(next.getMessage(), next.getSQLState(), next.getErrorCode(), updateCounts); |
25 | setNextException(next); |
26 | } |
27 | |
28 | /** |
29 | * INTERNAL |
30 | */ |
31 | @Override |
32 | public void printStackTrace() { |
33 | // The default implementation already does that, |
34 | // but we do it again to avoid problems. |
35 | // If it is not implemented, somebody might implement it |
36 | // later on which would be a problem if done in the wrong way. |
37 | printStackTrace(System.err); |
38 | } |
39 | |
40 | /** |
41 | * INTERNAL |
42 | */ |
43 | @Override |
44 | public void printStackTrace(PrintWriter s) { |
45 | if (s != null) { |
46 | super.printStackTrace(s); |
47 | if (getNextException() != null) { |
48 | getNextException().printStackTrace(s); |
49 | } |
50 | } |
51 | } |
52 | |
53 | /** |
54 | * INTERNAL |
55 | */ |
56 | @Override |
57 | public void printStackTrace(PrintStream s) { |
58 | if (s != null) { |
59 | super.printStackTrace(s); |
60 | if (getNextException() != null) { |
61 | getNextException().printStackTrace(s); |
62 | } |
63 | } |
64 | } |
65 | |
66 | } |