Better exception handling.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1638111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2014-11-11 14:06:58 +00:00
parent a6e69b2a5e
commit 957295aceb
1 changed files with 3 additions and 3 deletions

View File

@ -222,8 +222,8 @@ public class CSVPrinterTest {
public void testJdbcPrinter() throws IOException, ClassNotFoundException, SQLException { public void testJdbcPrinter() throws IOException, ClassNotFoundException, SQLException {
final StringWriter sw = new StringWriter(); final StringWriter sw = new StringWriter();
final Connection connection = geH2Connection(); final Connection connection = geH2Connection();
setUpTable(connection);
try { try {
setUpTable(connection);
final Statement stmt = connection.createStatement(); final Statement stmt = connection.createStatement();
final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT); final CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);
printer.printRecords(stmt.executeQuery("select ID, NAME from TEST")); printer.printRecords(stmt.executeQuery("select ID, NAME from TEST"));
@ -239,8 +239,8 @@ public class CSVPrinterTest {
final StringWriter sw = new StringWriter(); final StringWriter sw = new StringWriter();
Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
final Connection connection = geH2Connection(); final Connection connection = geH2Connection();
setUpTable(connection);
try { try {
setUpTable(connection);
@SuppressWarnings("resource") @SuppressWarnings("resource")
// Closed when the connection is closed. // Closed when the connection is closed.
final Statement stmt = connection.createStatement(); final Statement stmt = connection.createStatement();
@ -262,8 +262,8 @@ public class CSVPrinterTest {
final StringWriter sw = new StringWriter(); final StringWriter sw = new StringWriter();
Class.forName("org.h2.Driver"); Class.forName("org.h2.Driver");
final Connection connection = geH2Connection(); final Connection connection = geH2Connection();
setUpTable(connection);
try { try {
setUpTable(connection);
@SuppressWarnings("resource") @SuppressWarnings("resource")
// Closed when the connection is closed. // Closed when the connection is closed.
final Statement stmt = connection.createStatement(); final Statement stmt = connection.createStatement();