You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/05/06 16:20:20 UTC
[1/4] commons-dbutils git commit: Add final modifier to method
parameters.
Repository: commons-dbutils
Updated Branches:
refs/heads/master b5114a848 -> 41e682d63
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java b/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
index 79ccba2..d26f933 100644
--- a/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
+++ b/src/test/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSetTest.java
@@ -1,1022 +1,1022 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.dbutils.wrappers;
-
-import java.io.ByteArrayInputStream;
-import java.io.CharArrayReader;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Map;
-
-import org.apache.commons.dbutils.BaseTestCase;
-import org.apache.commons.dbutils.ProxyFactory;
-
-/**
- * Test cases for <code>SqlNullCheckedResultSet</code> class.
- */
-public class SqlNullCheckedResultSetTest extends BaseTestCase {
-
- private SqlNullCheckedResultSet rs2 = null;
-
- /**
- * Sets up instance variables required by this test case.
- */
- @Override
- public void setUp() throws Exception {
- super.setUp();
-
- rs2 =
- new SqlNullCheckedResultSet(
- ProxyFactory.instance().createResultSet(
- new SqlNullUncheckedMockResultSet()));
-
- rs = ProxyFactory.instance().createResultSet(rs2); // Override superclass field
- }
-
- /**
- * Tests the getAsciiStream implementation.
- */
- public void testGetAsciiStream() throws SQLException {
-
- assertNull(rs.getAsciiStream(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getAsciiStream("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- InputStream stream = new ByteArrayInputStream(new byte[0]);
- rs2.setNullAsciiStream(stream);
- assertNotNull(rs.getAsciiStream(1));
- assertEquals(stream, rs.getAsciiStream(1));
- assertNotNull(rs.getAsciiStream("column"));
- assertEquals(stream, rs.getAsciiStream("column"));
-
- }
-
- /**
- * Tests the getBigDecimal implementation.
- */
- public void testGetBigDecimal() throws SQLException {
-
- assertNull(rs.getBigDecimal(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getBigDecimal("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- BigDecimal bd = new BigDecimal(5.0);
- rs2.setNullBigDecimal(bd);
- assertNotNull(rs.getBigDecimal(1));
- assertEquals(bd, rs.getBigDecimal(1));
- assertNotNull(rs.getBigDecimal("column"));
- assertEquals(bd, rs.getBigDecimal("column"));
-
- }
-
- /**
- * Tests the getBinaryStream implementation.
- */
- public void testGetBinaryStream() throws SQLException {
-
- assertNull(rs.getBinaryStream(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getBinaryStream("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- InputStream stream = new ByteArrayInputStream(new byte[0]);
- rs2.setNullBinaryStream(stream);
- assertNotNull(rs.getBinaryStream(1));
- assertEquals(stream, rs.getBinaryStream(1));
- assertNotNull(rs.getBinaryStream("column"));
- assertEquals(stream, rs.getBinaryStream("column"));
-
- }
-
- /**
- * Tests the getBlob implementation.
- */
- public void testGetBlob() throws SQLException {
-
- assertNull(rs.getBlob(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getBlob("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Blob blob = new SqlNullCheckedResultSetMockBlob();
- rs2.setNullBlob(blob);
- assertNotNull(rs.getBlob(1));
- assertEquals(blob, rs.getBlob(1));
- assertNotNull(rs.getBlob("column"));
- assertEquals(blob, rs.getBlob("column"));
-
- }
-
- /**
- * Tests the getBoolean implementation.
- */
- public void testGetBoolean() throws SQLException {
-
- assertEquals(false, rs.getBoolean(1));
- assertTrue(rs.wasNull());
- assertEquals(false, rs.getBoolean("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- rs2.setNullBoolean(true);
- assertEquals(true, rs.getBoolean(1));
- assertEquals(true, rs.getBoolean("column"));
-
- }
-
- /**
- * Tests the getByte implementation.
- */
- public void testGetByte() throws SQLException {
-
- assertEquals((byte) 0, rs.getByte(1));
- assertTrue(rs.wasNull());
- assertEquals((byte) 0, rs.getByte("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- byte b = (byte) 10;
- rs2.setNullByte(b);
- assertEquals(b, rs.getByte(1));
- assertEquals(b, rs.getByte("column"));
-
- }
-
- /**
- * Tests the getByte implementation.
- */
- public void testGetBytes() throws SQLException {
-
- assertNull(rs.getBytes(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getBytes("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- byte[] b = new byte[5];
- for (int i = 0; i < 5; i++) {
- b[0] = (byte) i;
- }
- rs2.setNullBytes(b);
- assertNotNull(rs.getBytes(1));
- assertArrayEquals(b, rs.getBytes(1));
- assertNotNull(rs.getBytes("column"));
- assertArrayEquals(b, rs.getBytes("column"));
-
- }
-
- private static void assertArrayEquals(byte[] expected, byte[] actual) {
- if (expected == actual) {
- return;
- }
- if (expected.length != actual.length) {
- failNotEquals(null, Arrays.toString(expected), Arrays.toString(actual));
- }
- for (int i = 0; i < expected.length; i++) {
- byte expectedItem = expected[i];
- byte actualItem = actual[i];
- assertEquals("Array not equal at index " + i, expectedItem, actualItem);
- }
- }
-
- /**
- * Tests the getCharacterStream implementation.
- */
- public void testGetCharacterStream() throws SQLException {
-
- assertNull(rs.getCharacterStream(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getCharacterStream("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Reader reader = new CharArrayReader("this is a string".toCharArray());
- rs2.setNullCharacterStream(reader);
- assertNotNull(rs.getCharacterStream(1));
- assertEquals(reader, rs.getCharacterStream(1));
- assertNotNull(rs.getCharacterStream("column"));
- assertEquals(reader, rs.getCharacterStream("column"));
-
- }
-
- /**
- * Tests the getClob implementation.
- */
- public void testGetClob() throws SQLException {
-
- assertNull(rs.getClob(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getClob("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Clob clob = new SqlNullCheckedResultSetMockClob();
- rs2.setNullClob(clob);
- assertNotNull(rs.getClob(1));
- assertEquals(clob, rs.getClob(1));
- assertNotNull(rs.getClob("column"));
- assertEquals(clob, rs.getClob("column"));
-
- }
-
- /**
- * Tests the getDate implementation.
- */
- public void testGetDate() throws SQLException {
-
- assertNull(rs.getDate(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getDate("column"));
- assertTrue(rs.wasNull());
- assertNull(rs.getDate(1, Calendar.getInstance()));
- assertTrue(rs.wasNull());
- assertNull(rs.getDate("column", Calendar.getInstance()));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());
- rs2.setNullDate(date);
- assertNotNull(rs.getDate(1));
- assertEquals(date, rs.getDate(1));
- assertNotNull(rs.getDate("column"));
- assertEquals(date, rs.getDate("column"));
- assertNotNull(rs.getDate(1, Calendar.getInstance()));
- assertEquals(date, rs.getDate(1, Calendar.getInstance()));
- assertNotNull(rs.getDate("column", Calendar.getInstance()));
- assertEquals(date, rs.getDate("column", Calendar.getInstance()));
-
- }
-
- /**
- * Tests the getDouble implementation.
- */
- public void testGetDouble() throws SQLException {
-
- assertEquals(0.0, rs.getDouble(1), 0.0);
- assertTrue(rs.wasNull());
- assertEquals(0.0, rs.getDouble("column"), 0.0);
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- double d = 10.0;
- rs2.setNullDouble(d);
- assertEquals(d, rs.getDouble(1), 0.0);
- assertEquals(d, rs.getDouble("column"), 0.0);
-
- }
-
- /**
- * Tests the getFloat implementation.
- */
- public void testGetFloat() throws SQLException {
- assertEquals(0, rs.getFloat(1), 0.0);
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getFloat("column"), 0.0);
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- float f = 10;
- rs2.setNullFloat(f);
- assertEquals(f, rs.getFloat(1), 0.0);
- assertEquals(f, rs.getFloat("column"), 0.0);
- }
-
- /**
- * Tests the getInt implementation.
- */
- public void testGetInt() throws SQLException {
- assertEquals(0, rs.getInt(1));
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getInt("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- int i = 10;
- rs2.setNullInt(i);
- assertEquals(i, rs.getInt(1));
- assertEquals(i, rs.getInt("column"));
- }
-
- /**
- * Tests the getLong implementation.
- */
- public void testGetLong() throws SQLException {
- assertEquals(0, rs.getLong(1));
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getLong("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- long l = 10;
- rs2.setNullLong(l);
- assertEquals(l, rs.getLong(1));
- assertEquals(l, rs.getLong("column"));
- }
-
- /**
- * Tests the getObject implementation.
- */
- public void testGetObject() throws SQLException {
-
- assertNull(rs.getObject(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getObject("column"));
- assertTrue(rs.wasNull());
- assertNull(rs.getObject(1, (Map<String, Class<?>>) null));
- assertTrue(rs.wasNull());
- assertNull(rs.getObject("column", (Map<String, Class<?>>) null));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Object o = new Object();
- rs2.setNullObject(o);
- assertNotNull(rs.getObject(1));
- assertEquals(o, rs.getObject(1));
- assertNotNull(rs.getObject("column"));
- assertEquals(o, rs.getObject("column"));
- assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
- assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
- assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
- assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
-
- }
-
- /**
- * Tests the getRef implementation.
- */
- public void testGetRef() throws SQLException {
-
- assertNull(rs.getRef(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getRef("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Ref ref = new SqlNullCheckedResultSetMockRef();
- rs2.setNullRef(ref);
- assertNotNull(rs.getRef(1));
- assertEquals(ref, rs.getRef(1));
- assertNotNull(rs.getRef("column"));
- assertEquals(ref, rs.getRef("column"));
-
- }
-
- /**
- * Tests the getShort implementation.
- */
- public void testGetShort() throws SQLException {
-
- assertEquals((short) 0, rs.getShort(1));
- assertTrue(rs.wasNull());
- assertEquals((short) 0, rs.getShort("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- short s = (short) 10;
- rs2.setNullShort(s);
- assertEquals(s, rs.getShort(1));
- assertEquals(s, rs.getShort("column"));
- }
-
- /**
- * Tests the getString implementation.
- */
- public void testGetString() throws SQLException {
- assertEquals(null, rs.getString(1));
- assertTrue(rs.wasNull());
- assertEquals(null, rs.getString("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- String s = "hello, world";
- rs2.setNullString(s);
- assertEquals(s, rs.getString(1));
- assertEquals(s, rs.getString("column"));
- }
-
- /**
- * Tests the getTime implementation.
- */
- public void testGetTime() throws SQLException {
-
- assertNull(rs.getTime(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getTime("column"));
- assertTrue(rs.wasNull());
- assertNull(rs.getTime(1, Calendar.getInstance()));
- assertTrue(rs.wasNull());
- assertNull(rs.getTime("column", Calendar.getInstance()));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Time time = new Time(new java.util.Date().getTime());
- rs2.setNullTime(time);
- assertNotNull(rs.getTime(1));
- assertEquals(time, rs.getTime(1));
- assertNotNull(rs.getTime("column"));
- assertEquals(time, rs.getTime("column"));
- assertNotNull(rs.getTime(1, Calendar.getInstance()));
- assertEquals(time, rs.getTime(1, Calendar.getInstance()));
- assertNotNull(rs.getTime("column", Calendar.getInstance()));
- assertEquals(time, rs.getTime("column", Calendar.getInstance()));
-
- }
-
- /**
- * Tests the getTimestamp implementation.
- */
- public void testGetTimestamp() throws SQLException {
-
- assertNull(rs.getTimestamp(1));
- assertTrue(rs.wasNull());
- assertNull(rs.getTimestamp("column"));
- assertTrue(rs.wasNull());
- assertNull(rs.getTimestamp(1, Calendar.getInstance()));
- assertTrue(rs.wasNull());
- assertNull(rs.getTimestamp("column", Calendar.getInstance()));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- Timestamp ts = new Timestamp(new java.util.Date().getTime());
- rs2.setNullTimestamp(ts);
- assertNotNull(rs.getTimestamp(1));
- assertEquals(ts, rs.getTimestamp(1));
- assertNotNull(rs.getTimestamp("column"));
- assertEquals(ts, rs.getTimestamp("column"));
- assertNotNull(rs.getTimestamp(1, Calendar.getInstance()));
- assertEquals(ts, rs.getTimestamp(1, Calendar.getInstance()));
- assertNotNull(rs.getTimestamp("column", Calendar.getInstance()));
- assertEquals(ts, rs.getTimestamp("column", Calendar.getInstance()));
- }
-
- /**
- * Tests the getURL and setNullURL implementations.
- *
- * Uses reflection to allow for building under JDK 1.3.
- */
- public void testURL() throws SQLException, MalformedURLException,
- IllegalAccessException, IllegalArgumentException,
- java.lang.reflect.InvocationTargetException
- {
- Method getUrlInt = null;
- Method getUrlString = null;
- try {
- getUrlInt = ResultSet.class.getMethod("getURL",
- new Class[] { Integer.TYPE } );
- getUrlString = ResultSet.class.getMethod("getURL",
- new Class[] { String.class } );
- } catch(NoSuchMethodException e) {
- // ignore
- } catch(SecurityException e) {
- // ignore
- }
- if (getUrlInt != null && getUrlString != null) {
- assertEquals(null, getUrlInt.invoke(rs,
- new Object[] { Integer.valueOf(1) } ) );
- assertTrue(rs.wasNull());
- assertEquals(null, getUrlString.invoke(rs,
- new Object[] { "column" } ) );
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- URL u = new URL("http://www.apache.org");
- rs2.setNullURL(u);
- assertEquals(u, getUrlInt.invoke(rs,
- new Object[] { Integer.valueOf(1) } ) );
- assertEquals(u, getUrlString.invoke(rs,
- new Object[] { "column" } ) );
- }
- }
-
- /**
- * Tests the setNullAsciiStream implementation.
- */
- public void testSetNullAsciiStream() throws SQLException {
-
- assertNull(rs2.getNullAsciiStream());
- // Set what gets returned to something other than the default
- InputStream stream = new ByteArrayInputStream(new byte[0]);
- rs2.setNullAsciiStream(stream);
- assertNotNull(rs.getAsciiStream(1));
- assertEquals(stream, rs.getAsciiStream(1));
- assertNotNull(rs.getAsciiStream("column"));
- assertEquals(stream, rs.getAsciiStream("column"));
-
- }
-
- /**
- * Tests the setNullBigDecimal implementation.
- */
- public void testSetNullBigDecimal() throws SQLException {
-
- assertNull(rs2.getNullBigDecimal());
- // Set what gets returned to something other than the default
- BigDecimal bd = new BigDecimal(5.0);
- rs2.setNullBigDecimal(bd);
- assertNotNull(rs.getBigDecimal(1));
- assertEquals(bd, rs.getBigDecimal(1));
- assertNotNull(rs.getBigDecimal("column"));
- assertEquals(bd, rs.getBigDecimal("column"));
-
- }
-
- /**
- * Tests the setNullBinaryStream implementation.
- */
- public void testSetNullBinaryStream() throws SQLException {
-
- assertNull(rs2.getNullBinaryStream());
- // Set what gets returned to something other than the default
- InputStream stream = new ByteArrayInputStream(new byte[0]);
- rs2.setNullBinaryStream(stream);
- assertNotNull(rs.getBinaryStream(1));
- assertEquals(stream, rs.getBinaryStream(1));
- assertNotNull(rs.getBinaryStream("column"));
- assertEquals(stream, rs.getBinaryStream("column"));
-
- }
-
- /**
- * Tests the setNullBlob implementation.
- */
- public void testSetNullBlob() throws SQLException {
-
- assertNull(rs2.getNullBlob());
- // Set what gets returned to something other than the default
- Blob blob = new SqlNullCheckedResultSetMockBlob();
- rs2.setNullBlob(blob);
- assertNotNull(rs.getBlob(1));
- assertEquals(blob, rs.getBlob(1));
- assertNotNull(rs.getBlob("column"));
- assertEquals(blob, rs.getBlob("column"));
-
- }
-
- /**
- * Tests the setNullBoolean implementation.
- */
- public void testSetNullBoolean() throws SQLException {
-
- assertEquals(false, rs2.getNullBoolean());
- // Set what gets returned to something other than the default
- rs2.setNullBoolean(true);
- assertEquals(true, rs.getBoolean(1));
- assertEquals(true, rs.getBoolean("column"));
-
- }
-
- /**
- * Tests the setNullByte implementation.
- */
- public void testSetNullByte() throws SQLException {
-
- assertEquals((byte) 0, rs2.getNullByte());
- // Set what gets returned to something other than the default
- byte b = (byte) 10;
- rs2.setNullByte(b);
- assertEquals(b, rs.getByte(1));
- assertEquals(b, rs.getByte("column"));
-
- }
-
- /**
- * Tests the setNullByte implementation.
- */
- public void testSetNullBytes() throws SQLException {
-
- assertNull(rs2.getNullBytes());
- // Set what gets returned to something other than the default
- byte[] b = new byte[5];
- for (int i = 0; i < 5; i++) {
- b[0] = (byte) i;
- }
- rs2.setNullBytes(b);
- assertNotNull(rs.getBytes(1));
- assertArrayEquals(b, rs.getBytes(1));
- assertNotNull(rs.getBytes("column"));
- assertArrayEquals(b, rs.getBytes("column"));
-
- }
-
- /**
- * Tests the setNullCharacterStream implementation.
- */
- public void testSetNullCharacterStream() throws SQLException {
-
- assertNull(rs2.getNullCharacterStream());
- // Set what gets returned to something other than the default
- Reader reader = new CharArrayReader("this is a string".toCharArray());
- rs2.setNullCharacterStream(reader);
- assertNotNull(rs.getCharacterStream(1));
- assertEquals(reader, rs.getCharacterStream(1));
- assertNotNull(rs.getCharacterStream("column"));
- assertEquals(reader, rs.getCharacterStream("column"));
-
- }
-
- /**
- * Tests the setNullClob implementation.
- */
- public void testSetNullClob() throws SQLException {
-
- assertNull(rs2.getNullClob());
- // Set what gets returned to something other than the default
- Clob clob = new SqlNullCheckedResultSetMockClob();
- rs2.setNullClob(clob);
- assertNotNull(rs.getClob(1));
- assertEquals(clob, rs.getClob(1));
- assertNotNull(rs.getClob("column"));
- assertEquals(clob, rs.getClob("column"));
-
- }
-
- /**
- * Tests the setNullDate implementation.
- */
- public void testSetNullDate() throws SQLException {
-
- assertNull(rs2.getNullDate());
- // Set what gets returned to something other than the default
- java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());
- rs2.setNullDate(date);
- assertNotNull(rs.getDate(1));
- assertEquals(date, rs.getDate(1));
- assertNotNull(rs.getDate("column"));
- assertEquals(date, rs.getDate("column"));
- assertNotNull(rs.getDate(1, Calendar.getInstance()));
- assertEquals(date, rs.getDate(1, Calendar.getInstance()));
- assertNotNull(rs.getDate("column", Calendar.getInstance()));
- assertEquals(date, rs.getDate("column", Calendar.getInstance()));
-
- }
-
- /**
- * Tests the setNullDouble implementation.
- */
- public void testSetNullDouble() throws SQLException {
- assertEquals(0.0, rs2.getNullDouble(), 0.0);
- // Set what gets returned to something other than the default
- double d = 10.0;
- rs2.setNullDouble(d);
- assertEquals(d, rs.getDouble(1), 0.0);
- assertEquals(d, rs.getDouble("column"), 0.0);
- }
-
- /**
- * Tests the setNullFloat implementation.
- */
- public void testSetNullFloat() throws SQLException {
- assertEquals((float) 0.0, rs2.getNullFloat(), 0.0);
- // Set what gets returned to something other than the default
- float f = (float) 10.0;
- rs2.setNullFloat(f);
- assertEquals(f, rs.getFloat(1), 0.0);
- assertEquals(f, rs.getFloat("column"), 0.0);
- }
-
- /**
- * Tests the setNullInt implementation.
- */
- public void testSetNullInt() throws SQLException {
- assertEquals(0, rs2.getNullInt());
- assertEquals(0, rs.getInt(1));
- assertTrue(rs.wasNull());
- assertEquals(0, rs.getInt("column"));
- assertTrue(rs.wasNull());
- // Set what gets returned to something other than the default
- int i = 10;
- rs2.setNullInt(i);
- assertEquals(i, rs.getInt(1));
- assertEquals(i, rs.getInt("column"));
- }
-
- /**
- * Tests the setNullLong implementation.
- */
- public void testSetNullLong() throws SQLException {
- assertEquals(0, rs2.getNullLong());
- // Set what gets returned to something other than the default
- long l = 10;
- rs2.setNullLong(l);
- assertEquals(l, rs.getLong(1));
- assertEquals(l, rs.getLong("column"));
- }
-
- /**
- * Tests the setNullObject implementation.
- */
- public void testSetNullObject() throws SQLException {
- assertNull(rs2.getNullObject());
- // Set what gets returned to something other than the default
- Object o = new Object();
- rs2.setNullObject(o);
- assertNotNull(rs.getObject(1));
- assertEquals(o, rs.getObject(1));
- assertNotNull(rs.getObject("column"));
- assertEquals(o, rs.getObject("column"));
- assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
- assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
- assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
- assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
- }
-
- /**
- * Tests the setNullShort implementation.
- */
- public void testSetNullShort() throws SQLException {
-
- assertEquals((short) 0, rs2.getNullShort());
- // Set what gets returned to something other than the default
- short s = (short) 10;
- rs2.setNullShort(s);
- assertEquals(s, rs.getShort(1));
- assertEquals(s, rs.getShort("column"));
-
- }
-
- /**
- * Tests the setNullString implementation.
- */
- public void testSetNullString() throws SQLException {
- assertEquals(null, rs2.getNullString());
- // Set what gets returned to something other than the default
- String s = "hello, world";
- rs2.setNullString(s);
- assertEquals(s, rs.getString(1));
- assertEquals(s, rs.getString("column"));
- }
-
- /**
- * Tests the setNullRef implementation.
- */
- public void testSetNullRef() throws SQLException {
- assertNull(rs2.getNullRef());
- // Set what gets returned to something other than the default
- Ref ref = new SqlNullCheckedResultSetMockRef();
- rs2.setNullRef(ref);
- assertNotNull(rs.getRef(1));
- assertEquals(ref, rs.getRef(1));
- assertNotNull(rs.getRef("column"));
- assertEquals(ref, rs.getRef("column"));
- }
-
- /**
- * Tests the setNullTime implementation.
- */
- public void testSetNullTime() throws SQLException {
- assertEquals(null, rs2.getNullTime());
- // Set what gets returned to something other than the default
- Time time = new Time(new java.util.Date().getTime());
- rs2.setNullTime(time);
- assertNotNull(rs.getTime(1));
- assertEquals(time, rs.getTime(1));
- assertNotNull(rs.getTime("column"));
- assertEquals(time, rs.getTime("column"));
- assertNotNull(rs.getTime(1, Calendar.getInstance()));
- assertEquals(time, rs.getTime(1, Calendar.getInstance()));
- assertNotNull(rs.getTime("column", Calendar.getInstance()));
- assertEquals(time, rs.getTime("column", Calendar.getInstance()));
- }
-
- /**
- * Tests the setNullTimestamp implementation.
- */
- public void testSetNullTimestamp() throws SQLException {
- assertEquals(null, rs2.getNullTimestamp());
- // Set what gets returned to something other than the default
- Timestamp ts = new Timestamp(new java.util.Date().getTime());
- rs2.setNullTimestamp(ts);
- assertNotNull(rs.getTimestamp(1));
- assertEquals(ts, rs.getTimestamp(1));
- assertNotNull(rs.getTimestamp("column"));
- assertEquals(ts, rs.getTimestamp("column"));
- assertNotNull(rs.getTimestamp(1, Calendar.getInstance()));
- assertEquals(ts, rs.getTimestamp(1, Calendar.getInstance()));
- assertNotNull(rs.getTimestamp("column", Calendar.getInstance()));
- assertEquals(ts, rs.getTimestamp("column", Calendar.getInstance()));
- }
-
-}
-
-class SqlNullUncheckedMockResultSet implements InvocationHandler {
-
- /**
- * Always return false for booleans, 0 for numerics, and null for Objects.
- * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
- */
- @Override
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
-
- Class<?> returnType = method.getReturnType();
-
- if (method.getName().equals("wasNull")) {
- return Boolean.TRUE;
-
- } else if (returnType.equals(Boolean.TYPE)) {
- return Boolean.FALSE;
-
- } else if (returnType.equals(Integer.TYPE)) {
- return Integer.valueOf(0);
-
- } else if (returnType.equals(Short.TYPE)) {
- return Short.valueOf((short) 0);
-
- } else if (returnType.equals(Double.TYPE)) {
- return new Double(0);
-
- } else if (returnType.equals(Long.TYPE)) {
- return Long.valueOf(0);
-
- } else if (returnType.equals(Byte.TYPE)) {
- return Byte.valueOf((byte) 0);
-
- } else if (returnType.equals(Float.TYPE)) {
- return new Float(0);
-
- } else {
- return null;
- }
- }
-}
-
-class SqlNullCheckedResultSetMockBlob implements Blob {
-
- @Override
- public InputStream getBinaryStream() throws SQLException {
- return new ByteArrayInputStream(new byte[0]);
- }
-
- @Override
- public byte[] getBytes(long param, int param1) throws SQLException {
- return new byte[0];
- }
-
- @Override
- public long length() throws SQLException {
- return 0;
- }
-
- @Override
- public long position(byte[] values, long param) throws SQLException {
- return 0;
- }
-
- @Override
- public long position(Blob blob, long param) throws SQLException {
- return 0;
- }
-
- @Override
- public void truncate(long len) throws SQLException {
-
- }
-
- @Override
- public int setBytes(long pos, byte[] bytes) throws SQLException {
- return 0;
- }
-
- @Override
- public int setBytes(long pos, byte[] bytes, int offset, int len)
- throws SQLException {
- return 0;
- }
-
- @Override
- public OutputStream setBinaryStream(long pos) throws SQLException {
- return null;
- }
-
- /**
- * @throws SQLException
- */
- @Override
- public void free() throws SQLException {
-
- }
-
- /**
- * @throws SQLException
- */
- @Override
- public InputStream getBinaryStream(long pos, long length) throws SQLException {
- return null;
- }
-
-}
-
-class SqlNullCheckedResultSetMockClob implements Clob {
-
- @Override
- public InputStream getAsciiStream() throws SQLException {
- return null;
- }
-
- @Override
- public Reader getCharacterStream() throws SQLException {
- return null;
- }
-
- @Override
- public String getSubString(long param, int param1) throws SQLException {
- return "";
- }
-
- @Override
- public long length() throws SQLException {
- return 0;
- }
-
- @Override
- public long position(Clob clob, long param) throws SQLException {
- return 0;
- }
-
- @Override
- public long position(String str, long param) throws SQLException {
- return 0;
- }
-
- @Override
- public void truncate(long len) throws SQLException {
-
- }
-
- @Override
- public OutputStream setAsciiStream(long pos) throws SQLException {
- return null;
- }
-
- @Override
- public Writer setCharacterStream(long pos) throws SQLException {
- return null;
- }
-
- @Override
- public int setString(long pos, String str) throws SQLException {
- return 0;
- }
-
- @Override
- public int setString(long pos, String str, int offset, int len)
- throws SQLException {
- return 0;
- }
-
- /**
- * @throws SQLException
- */
- @Override
- public void free() throws SQLException {
-
- }
-
- /**
- * @throws SQLException
- */
- @Override
- public Reader getCharacterStream(long pos, long length) throws SQLException {
- return null;
- }
-
-}
-
-class SqlNullCheckedResultSetMockRef implements Ref {
-
- @Override
- public String getBaseTypeName() throws SQLException {
- return "";
- }
-
- @Override
- public Object getObject() throws SQLException {
- return null;
- }
-
- @Override
- public void setObject(Object value) throws SQLException {
-
- }
-
- @Override
- public Object getObject(Map<String,Class<?>> map) throws SQLException {
- return null;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils.wrappers;
+
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Map;
+
+import org.apache.commons.dbutils.BaseTestCase;
+import org.apache.commons.dbutils.ProxyFactory;
+
+/**
+ * Test cases for <code>SqlNullCheckedResultSet</code> class.
+ */
+public class SqlNullCheckedResultSetTest extends BaseTestCase {
+
+ private SqlNullCheckedResultSet rs2 = null;
+
+ /**
+ * Sets up instance variables required by this test case.
+ */
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ rs2 =
+ new SqlNullCheckedResultSet(
+ ProxyFactory.instance().createResultSet(
+ new SqlNullUncheckedMockResultSet()));
+
+ rs = ProxyFactory.instance().createResultSet(rs2); // Override superclass field
+ }
+
+ /**
+ * Tests the getAsciiStream implementation.
+ */
+ public void testGetAsciiStream() throws SQLException {
+
+ assertNull(rs.getAsciiStream(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getAsciiStream("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ InputStream stream = new ByteArrayInputStream(new byte[0]);
+ rs2.setNullAsciiStream(stream);
+ assertNotNull(rs.getAsciiStream(1));
+ assertEquals(stream, rs.getAsciiStream(1));
+ assertNotNull(rs.getAsciiStream("column"));
+ assertEquals(stream, rs.getAsciiStream("column"));
+
+ }
+
+ /**
+ * Tests the getBigDecimal implementation.
+ */
+ public void testGetBigDecimal() throws SQLException {
+
+ assertNull(rs.getBigDecimal(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getBigDecimal("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ BigDecimal bd = new BigDecimal(5.0);
+ rs2.setNullBigDecimal(bd);
+ assertNotNull(rs.getBigDecimal(1));
+ assertEquals(bd, rs.getBigDecimal(1));
+ assertNotNull(rs.getBigDecimal("column"));
+ assertEquals(bd, rs.getBigDecimal("column"));
+
+ }
+
+ /**
+ * Tests the getBinaryStream implementation.
+ */
+ public void testGetBinaryStream() throws SQLException {
+
+ assertNull(rs.getBinaryStream(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getBinaryStream("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ InputStream stream = new ByteArrayInputStream(new byte[0]);
+ rs2.setNullBinaryStream(stream);
+ assertNotNull(rs.getBinaryStream(1));
+ assertEquals(stream, rs.getBinaryStream(1));
+ assertNotNull(rs.getBinaryStream("column"));
+ assertEquals(stream, rs.getBinaryStream("column"));
+
+ }
+
+ /**
+ * Tests the getBlob implementation.
+ */
+ public void testGetBlob() throws SQLException {
+
+ assertNull(rs.getBlob(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getBlob("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Blob blob = new SqlNullCheckedResultSetMockBlob();
+ rs2.setNullBlob(blob);
+ assertNotNull(rs.getBlob(1));
+ assertEquals(blob, rs.getBlob(1));
+ assertNotNull(rs.getBlob("column"));
+ assertEquals(blob, rs.getBlob("column"));
+
+ }
+
+ /**
+ * Tests the getBoolean implementation.
+ */
+ public void testGetBoolean() throws SQLException {
+
+ assertEquals(false, rs.getBoolean(1));
+ assertTrue(rs.wasNull());
+ assertEquals(false, rs.getBoolean("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ rs2.setNullBoolean(true);
+ assertEquals(true, rs.getBoolean(1));
+ assertEquals(true, rs.getBoolean("column"));
+
+ }
+
+ /**
+ * Tests the getByte implementation.
+ */
+ public void testGetByte() throws SQLException {
+
+ assertEquals((byte) 0, rs.getByte(1));
+ assertTrue(rs.wasNull());
+ assertEquals((byte) 0, rs.getByte("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ byte b = (byte) 10;
+ rs2.setNullByte(b);
+ assertEquals(b, rs.getByte(1));
+ assertEquals(b, rs.getByte("column"));
+
+ }
+
+ /**
+ * Tests the getByte implementation.
+ */
+ public void testGetBytes() throws SQLException {
+
+ assertNull(rs.getBytes(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getBytes("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ byte[] b = new byte[5];
+ for (int i = 0; i < 5; i++) {
+ b[0] = (byte) i;
+ }
+ rs2.setNullBytes(b);
+ assertNotNull(rs.getBytes(1));
+ assertArrayEquals(b, rs.getBytes(1));
+ assertNotNull(rs.getBytes("column"));
+ assertArrayEquals(b, rs.getBytes("column"));
+
+ }
+
+ private static void assertArrayEquals(final byte[] expected, final byte[] actual) {
+ if (expected == actual) {
+ return;
+ }
+ if (expected.length != actual.length) {
+ failNotEquals(null, Arrays.toString(expected), Arrays.toString(actual));
+ }
+ for (int i = 0; i < expected.length; i++) {
+ byte expectedItem = expected[i];
+ byte actualItem = actual[i];
+ assertEquals("Array not equal at index " + i, expectedItem, actualItem);
+ }
+ }
+
+ /**
+ * Tests the getCharacterStream implementation.
+ */
+ public void testGetCharacterStream() throws SQLException {
+
+ assertNull(rs.getCharacterStream(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getCharacterStream("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Reader reader = new CharArrayReader("this is a string".toCharArray());
+ rs2.setNullCharacterStream(reader);
+ assertNotNull(rs.getCharacterStream(1));
+ assertEquals(reader, rs.getCharacterStream(1));
+ assertNotNull(rs.getCharacterStream("column"));
+ assertEquals(reader, rs.getCharacterStream("column"));
+
+ }
+
+ /**
+ * Tests the getClob implementation.
+ */
+ public void testGetClob() throws SQLException {
+
+ assertNull(rs.getClob(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getClob("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Clob clob = new SqlNullCheckedResultSetMockClob();
+ rs2.setNullClob(clob);
+ assertNotNull(rs.getClob(1));
+ assertEquals(clob, rs.getClob(1));
+ assertNotNull(rs.getClob("column"));
+ assertEquals(clob, rs.getClob("column"));
+
+ }
+
+ /**
+ * Tests the getDate implementation.
+ */
+ public void testGetDate() throws SQLException {
+
+ assertNull(rs.getDate(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getDate("column"));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getDate(1, Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getDate("column", Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());
+ rs2.setNullDate(date);
+ assertNotNull(rs.getDate(1));
+ assertEquals(date, rs.getDate(1));
+ assertNotNull(rs.getDate("column"));
+ assertEquals(date, rs.getDate("column"));
+ assertNotNull(rs.getDate(1, Calendar.getInstance()));
+ assertEquals(date, rs.getDate(1, Calendar.getInstance()));
+ assertNotNull(rs.getDate("column", Calendar.getInstance()));
+ assertEquals(date, rs.getDate("column", Calendar.getInstance()));
+
+ }
+
+ /**
+ * Tests the getDouble implementation.
+ */
+ public void testGetDouble() throws SQLException {
+
+ assertEquals(0.0, rs.getDouble(1), 0.0);
+ assertTrue(rs.wasNull());
+ assertEquals(0.0, rs.getDouble("column"), 0.0);
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ double d = 10.0;
+ rs2.setNullDouble(d);
+ assertEquals(d, rs.getDouble(1), 0.0);
+ assertEquals(d, rs.getDouble("column"), 0.0);
+
+ }
+
+ /**
+ * Tests the getFloat implementation.
+ */
+ public void testGetFloat() throws SQLException {
+ assertEquals(0, rs.getFloat(1), 0.0);
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getFloat("column"), 0.0);
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ float f = 10;
+ rs2.setNullFloat(f);
+ assertEquals(f, rs.getFloat(1), 0.0);
+ assertEquals(f, rs.getFloat("column"), 0.0);
+ }
+
+ /**
+ * Tests the getInt implementation.
+ */
+ public void testGetInt() throws SQLException {
+ assertEquals(0, rs.getInt(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getInt("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ int i = 10;
+ rs2.setNullInt(i);
+ assertEquals(i, rs.getInt(1));
+ assertEquals(i, rs.getInt("column"));
+ }
+
+ /**
+ * Tests the getLong implementation.
+ */
+ public void testGetLong() throws SQLException {
+ assertEquals(0, rs.getLong(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getLong("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ long l = 10;
+ rs2.setNullLong(l);
+ assertEquals(l, rs.getLong(1));
+ assertEquals(l, rs.getLong("column"));
+ }
+
+ /**
+ * Tests the getObject implementation.
+ */
+ public void testGetObject() throws SQLException {
+
+ assertNull(rs.getObject(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getObject("column"));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getObject(1, (Map<String, Class<?>>) null));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getObject("column", (Map<String, Class<?>>) null));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Object o = new Object();
+ rs2.setNullObject(o);
+ assertNotNull(rs.getObject(1));
+ assertEquals(o, rs.getObject(1));
+ assertNotNull(rs.getObject("column"));
+ assertEquals(o, rs.getObject("column"));
+ assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
+ assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
+
+ }
+
+ /**
+ * Tests the getRef implementation.
+ */
+ public void testGetRef() throws SQLException {
+
+ assertNull(rs.getRef(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getRef("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Ref ref = new SqlNullCheckedResultSetMockRef();
+ rs2.setNullRef(ref);
+ assertNotNull(rs.getRef(1));
+ assertEquals(ref, rs.getRef(1));
+ assertNotNull(rs.getRef("column"));
+ assertEquals(ref, rs.getRef("column"));
+
+ }
+
+ /**
+ * Tests the getShort implementation.
+ */
+ public void testGetShort() throws SQLException {
+
+ assertEquals((short) 0, rs.getShort(1));
+ assertTrue(rs.wasNull());
+ assertEquals((short) 0, rs.getShort("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ short s = (short) 10;
+ rs2.setNullShort(s);
+ assertEquals(s, rs.getShort(1));
+ assertEquals(s, rs.getShort("column"));
+ }
+
+ /**
+ * Tests the getString implementation.
+ */
+ public void testGetString() throws SQLException {
+ assertEquals(null, rs.getString(1));
+ assertTrue(rs.wasNull());
+ assertEquals(null, rs.getString("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ String s = "hello, world";
+ rs2.setNullString(s);
+ assertEquals(s, rs.getString(1));
+ assertEquals(s, rs.getString("column"));
+ }
+
+ /**
+ * Tests the getTime implementation.
+ */
+ public void testGetTime() throws SQLException {
+
+ assertNull(rs.getTime(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTime("column"));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTime(1, Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTime("column", Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Time time = new Time(new java.util.Date().getTime());
+ rs2.setNullTime(time);
+ assertNotNull(rs.getTime(1));
+ assertEquals(time, rs.getTime(1));
+ assertNotNull(rs.getTime("column"));
+ assertEquals(time, rs.getTime("column"));
+ assertNotNull(rs.getTime(1, Calendar.getInstance()));
+ assertEquals(time, rs.getTime(1, Calendar.getInstance()));
+ assertNotNull(rs.getTime("column", Calendar.getInstance()));
+ assertEquals(time, rs.getTime("column", Calendar.getInstance()));
+
+ }
+
+ /**
+ * Tests the getTimestamp implementation.
+ */
+ public void testGetTimestamp() throws SQLException {
+
+ assertNull(rs.getTimestamp(1));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTimestamp("column"));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTimestamp(1, Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ assertNull(rs.getTimestamp("column", Calendar.getInstance()));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ Timestamp ts = new Timestamp(new java.util.Date().getTime());
+ rs2.setNullTimestamp(ts);
+ assertNotNull(rs.getTimestamp(1));
+ assertEquals(ts, rs.getTimestamp(1));
+ assertNotNull(rs.getTimestamp("column"));
+ assertEquals(ts, rs.getTimestamp("column"));
+ assertNotNull(rs.getTimestamp(1, Calendar.getInstance()));
+ assertEquals(ts, rs.getTimestamp(1, Calendar.getInstance()));
+ assertNotNull(rs.getTimestamp("column", Calendar.getInstance()));
+ assertEquals(ts, rs.getTimestamp("column", Calendar.getInstance()));
+ }
+
+ /**
+ * Tests the getURL and setNullURL implementations.
+ *
+ * Uses reflection to allow for building under JDK 1.3.
+ */
+ public void testURL() throws SQLException, MalformedURLException,
+ IllegalAccessException, IllegalArgumentException,
+ java.lang.reflect.InvocationTargetException
+ {
+ Method getUrlInt = null;
+ Method getUrlString = null;
+ try {
+ getUrlInt = ResultSet.class.getMethod("getURL",
+ new Class[] { Integer.TYPE } );
+ getUrlString = ResultSet.class.getMethod("getURL",
+ new Class[] { String.class } );
+ } catch(NoSuchMethodException e) {
+ // ignore
+ } catch(SecurityException e) {
+ // ignore
+ }
+ if (getUrlInt != null && getUrlString != null) {
+ assertEquals(null, getUrlInt.invoke(rs,
+ new Object[] { Integer.valueOf(1) } ) );
+ assertTrue(rs.wasNull());
+ assertEquals(null, getUrlString.invoke(rs,
+ new Object[] { "column" } ) );
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ URL u = new URL("http://www.apache.org");
+ rs2.setNullURL(u);
+ assertEquals(u, getUrlInt.invoke(rs,
+ new Object[] { Integer.valueOf(1) } ) );
+ assertEquals(u, getUrlString.invoke(rs,
+ new Object[] { "column" } ) );
+ }
+ }
+
+ /**
+ * Tests the setNullAsciiStream implementation.
+ */
+ public void testSetNullAsciiStream() throws SQLException {
+
+ assertNull(rs2.getNullAsciiStream());
+ // Set what gets returned to something other than the default
+ InputStream stream = new ByteArrayInputStream(new byte[0]);
+ rs2.setNullAsciiStream(stream);
+ assertNotNull(rs.getAsciiStream(1));
+ assertEquals(stream, rs.getAsciiStream(1));
+ assertNotNull(rs.getAsciiStream("column"));
+ assertEquals(stream, rs.getAsciiStream("column"));
+
+ }
+
+ /**
+ * Tests the setNullBigDecimal implementation.
+ */
+ public void testSetNullBigDecimal() throws SQLException {
+
+ assertNull(rs2.getNullBigDecimal());
+ // Set what gets returned to something other than the default
+ BigDecimal bd = new BigDecimal(5.0);
+ rs2.setNullBigDecimal(bd);
+ assertNotNull(rs.getBigDecimal(1));
+ assertEquals(bd, rs.getBigDecimal(1));
+ assertNotNull(rs.getBigDecimal("column"));
+ assertEquals(bd, rs.getBigDecimal("column"));
+
+ }
+
+ /**
+ * Tests the setNullBinaryStream implementation.
+ */
+ public void testSetNullBinaryStream() throws SQLException {
+
+ assertNull(rs2.getNullBinaryStream());
+ // Set what gets returned to something other than the default
+ InputStream stream = new ByteArrayInputStream(new byte[0]);
+ rs2.setNullBinaryStream(stream);
+ assertNotNull(rs.getBinaryStream(1));
+ assertEquals(stream, rs.getBinaryStream(1));
+ assertNotNull(rs.getBinaryStream("column"));
+ assertEquals(stream, rs.getBinaryStream("column"));
+
+ }
+
+ /**
+ * Tests the setNullBlob implementation.
+ */
+ public void testSetNullBlob() throws SQLException {
+
+ assertNull(rs2.getNullBlob());
+ // Set what gets returned to something other than the default
+ Blob blob = new SqlNullCheckedResultSetMockBlob();
+ rs2.setNullBlob(blob);
+ assertNotNull(rs.getBlob(1));
+ assertEquals(blob, rs.getBlob(1));
+ assertNotNull(rs.getBlob("column"));
+ assertEquals(blob, rs.getBlob("column"));
+
+ }
+
+ /**
+ * Tests the setNullBoolean implementation.
+ */
+ public void testSetNullBoolean() throws SQLException {
+
+ assertEquals(false, rs2.getNullBoolean());
+ // Set what gets returned to something other than the default
+ rs2.setNullBoolean(true);
+ assertEquals(true, rs.getBoolean(1));
+ assertEquals(true, rs.getBoolean("column"));
+
+ }
+
+ /**
+ * Tests the setNullByte implementation.
+ */
+ public void testSetNullByte() throws SQLException {
+
+ assertEquals((byte) 0, rs2.getNullByte());
+ // Set what gets returned to something other than the default
+ byte b = (byte) 10;
+ rs2.setNullByte(b);
+ assertEquals(b, rs.getByte(1));
+ assertEquals(b, rs.getByte("column"));
+
+ }
+
+ /**
+ * Tests the setNullByte implementation.
+ */
+ public void testSetNullBytes() throws SQLException {
+
+ assertNull(rs2.getNullBytes());
+ // Set what gets returned to something other than the default
+ byte[] b = new byte[5];
+ for (int i = 0; i < 5; i++) {
+ b[0] = (byte) i;
+ }
+ rs2.setNullBytes(b);
+ assertNotNull(rs.getBytes(1));
+ assertArrayEquals(b, rs.getBytes(1));
+ assertNotNull(rs.getBytes("column"));
+ assertArrayEquals(b, rs.getBytes("column"));
+
+ }
+
+ /**
+ * Tests the setNullCharacterStream implementation.
+ */
+ public void testSetNullCharacterStream() throws SQLException {
+
+ assertNull(rs2.getNullCharacterStream());
+ // Set what gets returned to something other than the default
+ Reader reader = new CharArrayReader("this is a string".toCharArray());
+ rs2.setNullCharacterStream(reader);
+ assertNotNull(rs.getCharacterStream(1));
+ assertEquals(reader, rs.getCharacterStream(1));
+ assertNotNull(rs.getCharacterStream("column"));
+ assertEquals(reader, rs.getCharacterStream("column"));
+
+ }
+
+ /**
+ * Tests the setNullClob implementation.
+ */
+ public void testSetNullClob() throws SQLException {
+
+ assertNull(rs2.getNullClob());
+ // Set what gets returned to something other than the default
+ Clob clob = new SqlNullCheckedResultSetMockClob();
+ rs2.setNullClob(clob);
+ assertNotNull(rs.getClob(1));
+ assertEquals(clob, rs.getClob(1));
+ assertNotNull(rs.getClob("column"));
+ assertEquals(clob, rs.getClob("column"));
+
+ }
+
+ /**
+ * Tests the setNullDate implementation.
+ */
+ public void testSetNullDate() throws SQLException {
+
+ assertNull(rs2.getNullDate());
+ // Set what gets returned to something other than the default
+ java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());
+ rs2.setNullDate(date);
+ assertNotNull(rs.getDate(1));
+ assertEquals(date, rs.getDate(1));
+ assertNotNull(rs.getDate("column"));
+ assertEquals(date, rs.getDate("column"));
+ assertNotNull(rs.getDate(1, Calendar.getInstance()));
+ assertEquals(date, rs.getDate(1, Calendar.getInstance()));
+ assertNotNull(rs.getDate("column", Calendar.getInstance()));
+ assertEquals(date, rs.getDate("column", Calendar.getInstance()));
+
+ }
+
+ /**
+ * Tests the setNullDouble implementation.
+ */
+ public void testSetNullDouble() throws SQLException {
+ assertEquals(0.0, rs2.getNullDouble(), 0.0);
+ // Set what gets returned to something other than the default
+ double d = 10.0;
+ rs2.setNullDouble(d);
+ assertEquals(d, rs.getDouble(1), 0.0);
+ assertEquals(d, rs.getDouble("column"), 0.0);
+ }
+
+ /**
+ * Tests the setNullFloat implementation.
+ */
+ public void testSetNullFloat() throws SQLException {
+ assertEquals((float) 0.0, rs2.getNullFloat(), 0.0);
+ // Set what gets returned to something other than the default
+ float f = (float) 10.0;
+ rs2.setNullFloat(f);
+ assertEquals(f, rs.getFloat(1), 0.0);
+ assertEquals(f, rs.getFloat("column"), 0.0);
+ }
+
+ /**
+ * Tests the setNullInt implementation.
+ */
+ public void testSetNullInt() throws SQLException {
+ assertEquals(0, rs2.getNullInt());
+ assertEquals(0, rs.getInt(1));
+ assertTrue(rs.wasNull());
+ assertEquals(0, rs.getInt("column"));
+ assertTrue(rs.wasNull());
+ // Set what gets returned to something other than the default
+ int i = 10;
+ rs2.setNullInt(i);
+ assertEquals(i, rs.getInt(1));
+ assertEquals(i, rs.getInt("column"));
+ }
+
+ /**
+ * Tests the setNullLong implementation.
+ */
+ public void testSetNullLong() throws SQLException {
+ assertEquals(0, rs2.getNullLong());
+ // Set what gets returned to something other than the default
+ long l = 10;
+ rs2.setNullLong(l);
+ assertEquals(l, rs.getLong(1));
+ assertEquals(l, rs.getLong("column"));
+ }
+
+ /**
+ * Tests the setNullObject implementation.
+ */
+ public void testSetNullObject() throws SQLException {
+ assertNull(rs2.getNullObject());
+ // Set what gets returned to something other than the default
+ Object o = new Object();
+ rs2.setNullObject(o);
+ assertNotNull(rs.getObject(1));
+ assertEquals(o, rs.getObject(1));
+ assertNotNull(rs.getObject("column"));
+ assertEquals(o, rs.getObject("column"));
+ assertNotNull(rs.getObject(1, (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject(1, (Map<String, Class<?>>) null));
+ assertNotNull(rs.getObject("column", (Map<String, Class<?>>) null));
+ assertEquals(o, rs.getObject("column", (Map<String, Class<?>>) null));
+ }
+
+ /**
+ * Tests the setNullShort implementation.
+ */
+ public void testSetNullShort() throws SQLException {
+
+ assertEquals((short) 0, rs2.getNullShort());
+ // Set what gets returned to something other than the default
+ short s = (short) 10;
+ rs2.setNullShort(s);
+ assertEquals(s, rs.getShort(1));
+ assertEquals(s, rs.getShort("column"));
+
+ }
+
+ /**
+ * Tests the setNullString implementation.
+ */
+ public void testSetNullString() throws SQLException {
+ assertEquals(null, rs2.getNullString());
+ // Set what gets returned to something other than the default
+ String s = "hello, world";
+ rs2.setNullString(s);
+ assertEquals(s, rs.getString(1));
+ assertEquals(s, rs.getString("column"));
+ }
+
+ /**
+ * Tests the setNullRef implementation.
+ */
+ public void testSetNullRef() throws SQLException {
+ assertNull(rs2.getNullRef());
+ // Set what gets returned to something other than the default
+ Ref ref = new SqlNullCheckedResultSetMockRef();
+ rs2.setNullRef(ref);
+ assertNotNull(rs.getRef(1));
+ assertEquals(ref, rs.getRef(1));
+ assertNotNull(rs.getRef("column"));
+ assertEquals(ref, rs.getRef("column"));
+ }
+
+ /**
+ * Tests the setNullTime implementation.
+ */
+ public void testSetNullTime() throws SQLException {
+ assertEquals(null, rs2.getNullTime());
+ // Set what gets returned to something other than the default
+ Time time = new Time(new java.util.Date().getTime());
+ rs2.setNullTime(time);
+ assertNotNull(rs.getTime(1));
+ assertEquals(time, rs.getTime(1));
+ assertNotNull(rs.getTime("column"));
+ assertEquals(time, rs.getTime("column"));
+ assertNotNull(rs.getTime(1, Calendar.getInstance()));
+ assertEquals(time, rs.getTime(1, Calendar.getInstance()));
+ assertNotNull(rs.getTime("column", Calendar.getInstance()));
+ assertEquals(time, rs.getTime("column", Calendar.getInstance()));
+ }
+
+ /**
+ * Tests the setNullTimestamp implementation.
+ */
+ public void testSetNullTimestamp() throws SQLException {
+ assertEquals(null, rs2.getNullTimestamp());
+ // Set what gets returned to something other than the default
+ Timestamp ts = new Timestamp(new java.util.Date().getTime());
+ rs2.setNullTimestamp(ts);
+ assertNotNull(rs.getTimestamp(1));
+ assertEquals(ts, rs.getTimestamp(1));
+ assertNotNull(rs.getTimestamp("column"));
+ assertEquals(ts, rs.getTimestamp("column"));
+ assertNotNull(rs.getTimestamp(1, Calendar.getInstance()));
+ assertEquals(ts, rs.getTimestamp(1, Calendar.getInstance()));
+ assertNotNull(rs.getTimestamp("column", Calendar.getInstance()));
+ assertEquals(ts, rs.getTimestamp("column", Calendar.getInstance()));
+ }
+
+}
+
+class SqlNullUncheckedMockResultSet implements InvocationHandler {
+
+ /**
+ * Always return false for booleans, 0 for numerics, and null for Objects.
+ * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
+ */
+ @Override
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
+ throws Throwable {
+
+ Class<?> returnType = method.getReturnType();
+
+ if (method.getName().equals("wasNull")) {
+ return Boolean.TRUE;
+
+ } else if (returnType.equals(Boolean.TYPE)) {
+ return Boolean.FALSE;
+
+ } else if (returnType.equals(Integer.TYPE)) {
+ return Integer.valueOf(0);
+
+ } else if (returnType.equals(Short.TYPE)) {
+ return Short.valueOf((short) 0);
+
+ } else if (returnType.equals(Double.TYPE)) {
+ return new Double(0);
+
+ } else if (returnType.equals(Long.TYPE)) {
+ return Long.valueOf(0);
+
+ } else if (returnType.equals(Byte.TYPE)) {
+ return Byte.valueOf((byte) 0);
+
+ } else if (returnType.equals(Float.TYPE)) {
+ return new Float(0);
+
+ } else {
+ return null;
+ }
+ }
+}
+
+class SqlNullCheckedResultSetMockBlob implements Blob {
+
+ @Override
+ public InputStream getBinaryStream() throws SQLException {
+ return new ByteArrayInputStream(new byte[0]);
+ }
+
+ @Override
+ public byte[] getBytes(final long param, final int param1) throws SQLException {
+ return new byte[0];
+ }
+
+ @Override
+ public long length() throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public long position(final byte[] values, final long param) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public long position(final Blob blob, final long param) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public void truncate(final long len) throws SQLException {
+
+ }
+
+ @Override
+ public int setBytes(final long pos, final byte[] bytes) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public int setBytes(final long pos, final byte[] bytes, final int offset, final int len)
+ throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public OutputStream setBinaryStream(final long pos) throws SQLException {
+ return null;
+ }
+
+ /**
+ * @throws SQLException
+ */
+ @Override
+ public void free() throws SQLException {
+
+ }
+
+ /**
+ * @throws SQLException
+ */
+ @Override
+ public InputStream getBinaryStream(final long pos, final long length) throws SQLException {
+ return null;
+ }
+
+}
+
+class SqlNullCheckedResultSetMockClob implements Clob {
+
+ @Override
+ public InputStream getAsciiStream() throws SQLException {
+ return null;
+ }
+
+ @Override
+ public Reader getCharacterStream() throws SQLException {
+ return null;
+ }
+
+ @Override
+ public String getSubString(final long param, final int param1) throws SQLException {
+ return "";
+ }
+
+ @Override
+ public long length() throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public long position(final Clob clob, final long param) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public long position(final String str, final long param) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public void truncate(final long len) throws SQLException {
+
+ }
+
+ @Override
+ public OutputStream setAsciiStream(final long pos) throws SQLException {
+ return null;
+ }
+
+ @Override
+ public Writer setCharacterStream(final long pos) throws SQLException {
+ return null;
+ }
+
+ @Override
+ public int setString(final long pos, final String str) throws SQLException {
+ return 0;
+ }
+
+ @Override
+ public int setString(final long pos, final String str, final int offset, final int len)
+ throws SQLException {
+ return 0;
+ }
+
+ /**
+ * @throws SQLException
+ */
+ @Override
+ public void free() throws SQLException {
+
+ }
+
+ /**
+ * @throws SQLException
+ */
+ @Override
+ public Reader getCharacterStream(final long pos, final long length) throws SQLException {
+ return null;
+ }
+
+}
+
+class SqlNullCheckedResultSetMockRef implements Ref {
+
+ @Override
+ public String getBaseTypeName() throws SQLException {
+ return "";
+ }
+
+ @Override
+ public Object getObject() throws SQLException {
+ return null;
+ }
+
+ @Override
+ public void setObject(final Object value) throws SQLException {
+
+ }
+
+ @Override
+ public Object getObject(final Map<String,Class<?>> map) throws SQLException {
+ return null;
+ }
+
+}
[3/4] commons-dbutils git commit: Add final modifier to method
parameters.
Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java b/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java
index e8a3e9d..06c276e 100644
--- a/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java
+++ b/src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java
@@ -47,7 +47,7 @@ public class BasicRowProcessor implements RowProcessor {
*/
private static final BasicRowProcessor instance = new BasicRowProcessor();
- protected static Map<String, Object> createCaseInsensitiveHashMap(int cols) {
+ protected static Map<String, Object> createCaseInsensitiveHashMap(final int cols) {
return new CaseInsensitiveHashMap(cols);
}
@@ -82,7 +82,7 @@ public class BasicRowProcessor implements RowProcessor {
* bean properties.
* @since DbUtils 1.1
*/
- public BasicRowProcessor(BeanProcessor convert) {
+ public BasicRowProcessor(final BeanProcessor convert) {
super();
this.convert = convert;
}
@@ -99,7 +99,7 @@ public class BasicRowProcessor implements RowProcessor {
* @return the newly created array
*/
@Override
- public Object[] toArray(ResultSet rs) throws SQLException {
+ public Object[] toArray(final ResultSet rs) throws SQLException {
ResultSetMetaData meta = rs.getMetaData();
int cols = meta.getColumnCount();
Object[] result = new Object[cols];
@@ -123,7 +123,7 @@ public class BasicRowProcessor implements RowProcessor {
* @return the newly created bean
*/
@Override
- public <T> T toBean(ResultSet rs, Class<? extends T> type) throws SQLException {
+ public <T> T toBean(final ResultSet rs, final Class<? extends T> type) throws SQLException {
return this.convert.toBean(rs, type);
}
@@ -140,7 +140,7 @@ public class BasicRowProcessor implements RowProcessor {
* they were returned by the <code>ResultSet</code>.
*/
@Override
- public <T> List<T> toBeanList(ResultSet rs, Class<? extends T> type) throws SQLException {
+ public <T> List<T> toBeanList(final ResultSet rs, final Class<? extends T> type) throws SQLException {
return this.convert.toBeanList(rs, type);
}
@@ -160,7 +160,7 @@ public class BasicRowProcessor implements RowProcessor {
* @see org.apache.commons.dbutils.RowProcessor#toMap(java.sql.ResultSet)
*/
@Override
- public Map<String, Object> toMap(ResultSet rs) throws SQLException {
+ public Map<String, Object> toMap(final ResultSet rs) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
Map<String, Object> result = createCaseInsensitiveHashMap(cols);
@@ -194,7 +194,7 @@ public class BasicRowProcessor implements RowProcessor {
*/
private static class CaseInsensitiveHashMap extends LinkedHashMap<String, Object> {
- private CaseInsensitiveHashMap(int initialCapacity) {
+ private CaseInsensitiveHashMap(final int initialCapacity) {
super(initialCapacity);
}
@@ -223,7 +223,7 @@ public class BasicRowProcessor implements RowProcessor {
/** {@inheritDoc} */
@Override
- public boolean containsKey(Object key) {
+ public boolean containsKey(final Object key) {
Object realKey = lowerCaseMap.get(key.toString().toLowerCase(Locale.ENGLISH));
return super.containsKey(realKey);
// Possible optimisation here:
@@ -234,14 +234,14 @@ public class BasicRowProcessor implements RowProcessor {
/** {@inheritDoc} */
@Override
- public Object get(Object key) {
+ public Object get(final Object key) {
Object realKey = lowerCaseMap.get(key.toString().toLowerCase(Locale.ENGLISH));
return super.get(realKey);
}
/** {@inheritDoc} */
@Override
- public Object put(String key, Object value) {
+ public Object put(final String key, final Object value) {
/*
* In order to keep the map and lowerCaseMap synchronized,
* we have to remove the old mapping before putting the
@@ -257,7 +257,7 @@ public class BasicRowProcessor implements RowProcessor {
/** {@inheritDoc} */
@Override
- public void putAll(Map<? extends String, ?> m) {
+ public void putAll(final Map<? extends String, ?> m) {
for (Map.Entry<? extends String, ?> entry : m.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
@@ -267,7 +267,7 @@ public class BasicRowProcessor implements RowProcessor {
/** {@inheritDoc} */
@Override
- public Object remove(Object key) {
+ public Object remove(final Object key) {
Object realKey = lowerCaseMap.remove(key.toString().toLowerCase(Locale.ENGLISH));
return super.remove(realKey);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/BeanProcessor.java b/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
index df361fe..caee455 100644
--- a/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
+++ b/src/main/java/org/apache/commons/dbutils/BeanProcessor.java
@@ -108,7 +108,7 @@ public class BeanProcessor {
* @param columnToPropertyOverrides ResultSet column to bean property name overrides
* @since 1.5
*/
- public BeanProcessor(Map<String, String> columnToPropertyOverrides) {
+ public BeanProcessor(final Map<String, String> columnToPropertyOverrides) {
super();
if (columnToPropertyOverrides == null) {
throw new IllegalArgumentException("columnToPropertyOverrides map cannot be null");
@@ -149,7 +149,7 @@ public class BeanProcessor {
* @throws SQLException if a database access error occurs
* @return the newly created bean
*/
- public <T> T toBean(ResultSet rs, Class<? extends T> type) throws SQLException {
+ public <T> T toBean(final ResultSet rs, final Class<? extends T> type) throws SQLException {
T bean = this.newInstance(type);
return this.populateBean(rs, bean);
}
@@ -187,7 +187,7 @@ public class BeanProcessor {
* @throws SQLException if a database access error occurs
* @return the newly created List of beans
*/
- public <T> List<T> toBeanList(ResultSet rs, Class<? extends T> type) throws SQLException {
+ public <T> List<T> toBeanList(final ResultSet rs, final Class<? extends T> type) throws SQLException {
List<T> results = new ArrayList<>();
if (!rs.next()) {
@@ -215,8 +215,8 @@ public class BeanProcessor {
* @return An initialized object.
* @throws SQLException if a database error occurs.
*/
- private <T> T createBean(ResultSet rs, Class<T> type,
- PropertyDescriptor[] props, int[] columnToProperty)
+ private <T> T createBean(final ResultSet rs, final Class<T> type,
+ final PropertyDescriptor[] props, final int[] columnToProperty)
throws SQLException {
T bean = this.newInstance(type);
@@ -231,7 +231,7 @@ public class BeanProcessor {
* @return An initialized object.
* @throws SQLException if a database error occurs.
*/
- public <T> T populateBean(ResultSet rs, T bean) throws SQLException {
+ public <T> T populateBean(final ResultSet rs, final T bean) throws SQLException {
PropertyDescriptor[] props = this.propertyDescriptors(bean.getClass());
ResultSetMetaData rsmd = rs.getMetaData();
int[] columnToProperty = this.mapColumnsToProperties(rsmd, props);
@@ -250,8 +250,8 @@ public class BeanProcessor {
* @return An initialized object.
* @throws SQLException if a database error occurs.
*/
- private <T> T populateBean(ResultSet rs, T bean,
- PropertyDescriptor[] props, int[] columnToProperty)
+ private <T> T populateBean(final ResultSet rs, final T bean,
+ final PropertyDescriptor[] props, final int[] columnToProperty)
throws SQLException {
for (int i = 1; i < columnToProperty.length; i++) {
@@ -286,7 +286,7 @@ public class BeanProcessor {
* @param value The value to pass into the setter.
* @throws SQLException if an error occurs setting the property.
*/
- private void callSetter(Object target, PropertyDescriptor prop, Object value)
+ private void callSetter(final Object target, final PropertyDescriptor prop, Object value)
throws SQLException {
Method setter = getWriteMethod(target, prop, value);
@@ -339,7 +339,7 @@ public class BeanProcessor {
* @param type The setter's parameter type (non-null)
* @return boolean True if the value is compatible (null => true)
*/
- private boolean isCompatibleType(Object value, Class<?> type) {
+ private boolean isCompatibleType(final Object value, final Class<?> type) {
// Do object check first, then primitives
if (value == null || type.isInstance(value) || matchesPrimitive(type, value.getClass())) {
return true;
@@ -356,7 +356,7 @@ public class BeanProcessor {
* @param valueType The value to match to the primitive type.
* @return Whether <code>valueType</code> can be coerced (e.g. autoboxed) into <code>targetType</code>.
*/
- private boolean matchesPrimitive(Class<?> targetType, Class<?> valueType) {
+ private boolean matchesPrimitive(final Class<?> targetType, final Class<?> valueType) {
if (!targetType.isPrimitive()) {
return false;
}
@@ -388,7 +388,7 @@ public class BeanProcessor {
* @return The {@link java.lang.reflect.Method} to call on {@code target} to write {@code value} or {@code null} if
* there is no suitable write method.
*/
- protected Method getWriteMethod(Object target, PropertyDescriptor prop, Object value) {
+ protected Method getWriteMethod(final Object target, final PropertyDescriptor prop, final Object value) {
Method method = prop.getWriteMethod();
return method;
}
@@ -403,7 +403,7 @@ public class BeanProcessor {
* @return A newly created object of the Class.
* @throws SQLException if creation failed.
*/
- protected <T> T newInstance(Class<T> c) throws SQLException {
+ protected <T> T newInstance(final Class<T> c) throws SQLException {
try {
return c.newInstance();
@@ -424,7 +424,7 @@ public class BeanProcessor {
* @return A PropertyDescriptor[] describing the Class.
* @throws SQLException if introspection failed.
*/
- private PropertyDescriptor[] propertyDescriptors(Class<?> c)
+ private PropertyDescriptor[] propertyDescriptors(final Class<?> c)
throws SQLException {
// Introspector caches BeanInfo classes for better performance
BeanInfo beanInfo = null;
@@ -456,8 +456,8 @@ public class BeanProcessor {
* @return An int[] with column index to property index mappings. The 0th
* element is meaningless because JDBC column indexing starts at 1.
*/
- protected int[] mapColumnsToProperties(ResultSetMetaData rsmd,
- PropertyDescriptor[] props) throws SQLException {
+ protected int[] mapColumnsToProperties(final ResultSetMetaData rsmd,
+ final PropertyDescriptor[] props) throws SQLException {
int cols = rsmd.getColumnCount();
int[] columnToProperty = new int[cols + 1];
@@ -511,7 +511,7 @@ public class BeanProcessor {
* index after optional type processing or <code>null</code> if the column
* value was SQL NULL.
*/
- protected Object processColumn(ResultSet rs, int index, Class<?> propType)
+ protected Object processColumn(final ResultSet rs, final int index, final Class<?> propType)
throws SQLException {
Object retval = rs.getObject(index);
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/DbUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/DbUtils.java b/src/main/java/org/apache/commons/dbutils/DbUtils.java
index 5d837b8..d65d277 100644
--- a/src/main/java/org/apache/commons/dbutils/DbUtils.java
+++ b/src/main/java/org/apache/commons/dbutils/DbUtils.java
@@ -55,7 +55,7 @@ public final class DbUtils {
* @param conn Connection to close.
* @throws SQLException if a database access error occurs
*/
- public static void close(Connection conn) throws SQLException {
+ public static void close(final Connection conn) throws SQLException {
if (conn != null) {
conn.close();
}
@@ -67,7 +67,7 @@ public final class DbUtils {
* @param rs ResultSet to close.
* @throws SQLException if a database access error occurs
*/
- public static void close(ResultSet rs) throws SQLException {
+ public static void close(final ResultSet rs) throws SQLException {
if (rs != null) {
rs.close();
}
@@ -79,7 +79,7 @@ public final class DbUtils {
* @param stmt Statement to close.
* @throws SQLException if a database access error occurs
*/
- public static void close(Statement stmt) throws SQLException {
+ public static void close(final Statement stmt) throws SQLException {
if (stmt != null) {
stmt.close();
}
@@ -91,7 +91,7 @@ public final class DbUtils {
*
* @param conn Connection to close.
*/
- public static void closeQuietly(Connection conn) {
+ public static void closeQuietly(final Connection conn) {
try {
close(conn);
} catch (SQLException e) { // NOPMD
@@ -108,8 +108,8 @@ public final class DbUtils {
* @param stmt Statement to close.
* @param rs ResultSet to close.
*/
- public static void closeQuietly(Connection conn, Statement stmt,
- ResultSet rs) {
+ public static void closeQuietly(final Connection conn, final Statement stmt,
+ final ResultSet rs) {
try {
closeQuietly(rs);
@@ -129,7 +129,7 @@ public final class DbUtils {
*
* @param rs ResultSet to close.
*/
- public static void closeQuietly(ResultSet rs) {
+ public static void closeQuietly(final ResultSet rs) {
try {
close(rs);
} catch (SQLException e) { // NOPMD
@@ -143,7 +143,7 @@ public final class DbUtils {
*
* @param stmt Statement to close.
*/
- public static void closeQuietly(Statement stmt) {
+ public static void closeQuietly(final Statement stmt) {
try {
close(stmt);
} catch (SQLException e) { // NOPMD
@@ -157,7 +157,7 @@ public final class DbUtils {
* @param conn Connection to close.
* @throws SQLException if a database access error occurs
*/
- public static void commitAndClose(Connection conn) throws SQLException {
+ public static void commitAndClose(final Connection conn) throws SQLException {
if (conn != null) {
try {
conn.commit();
@@ -173,7 +173,7 @@ public final class DbUtils {
*
* @param conn Connection to close.
*/
- public static void commitAndCloseQuietly(Connection conn) {
+ public static void commitAndCloseQuietly(final Connection conn) {
try {
commitAndClose(conn);
} catch (SQLException e) { // NOPMD
@@ -188,7 +188,7 @@ public final class DbUtils {
* @param driverClassName of driver to load
* @return boolean <code>true</code> if the driver was found, otherwise <code>false</code>
*/
- public static boolean loadDriver(String driverClassName) {
+ public static boolean loadDriver(final String driverClassName) {
return loadDriver(DbUtils.class.getClassLoader(), driverClassName);
}
@@ -201,7 +201,7 @@ public final class DbUtils {
* @return boolean <code>true</code> if the driver was found, otherwise <code>false</code>
* @since 1.4
*/
- public static boolean loadDriver(ClassLoader classLoader, String driverClassName) {
+ public static boolean loadDriver(final ClassLoader classLoader, final String driverClassName) {
try {
Class<?> loadedClass = classLoader.loadClass(driverClassName);
@@ -239,7 +239,7 @@ public final class DbUtils {
*
* @param e SQLException to print stack trace of
*/
- public static void printStackTrace(SQLException e) {
+ public static void printStackTrace(final SQLException e) {
printStackTrace(e, new PrintWriter(System.err));
}
@@ -250,7 +250,7 @@ public final class DbUtils {
* @param e SQLException to print stack trace of
* @param pw PrintWriter to print to
*/
- public static void printStackTrace(SQLException e, PrintWriter pw) {
+ public static void printStackTrace(final SQLException e, final PrintWriter pw) {
SQLException next = e;
while (next != null) {
@@ -267,7 +267,7 @@ public final class DbUtils {
*
* @param conn Connection to print warnings from
*/
- public static void printWarnings(Connection conn) {
+ public static void printWarnings(final Connection conn) {
printWarnings(conn, new PrintWriter(System.err));
}
@@ -277,7 +277,7 @@ public final class DbUtils {
* @param conn Connection to print warnings from
* @param pw PrintWriter to print to
*/
- public static void printWarnings(Connection conn, PrintWriter pw) {
+ public static void printWarnings(final Connection conn, final PrintWriter pw) {
if (conn != null) {
try {
printStackTrace(conn.getWarnings(), pw);
@@ -292,7 +292,7 @@ public final class DbUtils {
* @param conn Connection to rollback. A null value is legal.
* @throws SQLException if a database access error occurs
*/
- public static void rollback(Connection conn) throws SQLException {
+ public static void rollback(final Connection conn) throws SQLException {
if (conn != null) {
conn.rollback();
}
@@ -306,7 +306,7 @@ public final class DbUtils {
* @throws SQLException if a database access error occurs
* @since DbUtils 1.1
*/
- public static void rollbackAndClose(Connection conn) throws SQLException {
+ public static void rollbackAndClose(final Connection conn) throws SQLException {
if (conn != null) {
try {
conn.rollback();
@@ -323,7 +323,7 @@ public final class DbUtils {
* @param conn Connection to rollback. A null value is legal.
* @since DbUtils 1.1
*/
- public static void rollbackAndCloseQuietly(Connection conn) {
+ public static void rollbackAndCloseQuietly(final Connection conn) {
try {
rollbackAndClose(conn);
} catch (SQLException e) { // NOPMD
@@ -350,7 +350,7 @@ public final class DbUtils {
*
* @param adapted the adapted JDBC Driver loaded dynamically.
*/
- public DriverProxy(Driver adapted) {
+ public DriverProxy(final Driver adapted) {
this.adapted = adapted;
}
@@ -358,7 +358,7 @@ public final class DbUtils {
* {@inheritDoc}
*/
@Override
- public boolean acceptsURL(String url) throws SQLException {
+ public boolean acceptsURL(final String url) throws SQLException {
return adapted.acceptsURL(url);
}
@@ -366,7 +366,7 @@ public final class DbUtils {
* {@inheritDoc}
*/
@Override
- public Connection connect(String url, Properties info) throws SQLException {
+ public Connection connect(final String url, final Properties info) throws SQLException {
return adapted.connect(url, info);
}
@@ -390,7 +390,7 @@ public final class DbUtils {
* {@inheritDoc}
*/
@Override
- public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
+ public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties info) throws SQLException {
return adapted.getPropertyInfo(url, info);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/OutParameter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/OutParameter.java b/src/main/java/org/apache/commons/dbutils/OutParameter.java
index d49b474..e3996a1 100644
--- a/src/main/java/org/apache/commons/dbutils/OutParameter.java
+++ b/src/main/java/org/apache/commons/dbutils/OutParameter.java
@@ -46,7 +46,7 @@ public class OutParameter<T> {
* with the type returned by <code>CallableStatement.getObject(int)</code>
* for the JDBC type given by <code>sqlType</code>.
*/
- public OutParameter(int sqlType, Class<T> javaType) {
+ public OutParameter(final int sqlType, final Class<T> javaType) {
this.sqlType = sqlType;
this.javaType = javaType;
}
@@ -62,7 +62,7 @@ public class OutParameter<T> {
* for the JDBC type given by <code>sqlType</code>.
* @param value the IN value of the parameter
*/
- public OutParameter(int sqlType, Class<T> javaType, T value) {
+ public OutParameter(final int sqlType, final Class<T> javaType, final T value) {
this.sqlType = sqlType;
this.javaType = javaType;
this.value = value;
@@ -100,7 +100,7 @@ public class OutParameter<T> {
* INOUT parameter.
* @param value the new value for the parameter.
*/
- public void setValue(T value) {
+ public void setValue(final T value) {
this.value = value;
}
@@ -112,7 +112,7 @@ public class OutParameter<T> {
* @throws SQLException when the value could not be retrieved from the
* statement.
*/
- void setValue(CallableStatement stmt, int index) throws SQLException {
+ void setValue(final CallableStatement stmt, final int index) throws SQLException {
Object object = stmt.getObject(index);
value = javaType.cast(object);
}
@@ -127,7 +127,7 @@ public class OutParameter<T> {
* @throws SQLException if the parameter could not be registered, or if the
* value of the parameter could not be set.
*/
- void register(CallableStatement stmt, int index) throws SQLException {
+ void register(final CallableStatement stmt, final int index) throws SQLException {
stmt.registerOutParameter(index, sqlType);
if (value != null) {
stmt.setObject(index, value);
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/ProxyFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/ProxyFactory.java b/src/main/java/org/apache/commons/dbutils/ProxyFactory.java
index 3a212e1..1c97c84 100644
--- a/src/main/java/org/apache/commons/dbutils/ProxyFactory.java
+++ b/src/main/java/org/apache/commons/dbutils/ProxyFactory.java
@@ -65,7 +65,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied object
*/
- public <T> T newProxyInstance(Class<T> type, InvocationHandler handler) {
+ public <T> T newProxyInstance(final Class<T> type, final InvocationHandler handler) {
return type.cast(Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class<?>[] {type}, handler));
}
@@ -74,7 +74,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied CallableStatement
*/
- public CallableStatement createCallableStatement(InvocationHandler handler) {
+ public CallableStatement createCallableStatement(final InvocationHandler handler) {
return newProxyInstance(CallableStatement.class, handler);
}
@@ -83,7 +83,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied Connection
*/
- public Connection createConnection(InvocationHandler handler) {
+ public Connection createConnection(final InvocationHandler handler) {
return newProxyInstance(Connection.class, handler);
}
@@ -92,7 +92,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied Driver
*/
- public Driver createDriver(InvocationHandler handler) {
+ public Driver createDriver(final InvocationHandler handler) {
return newProxyInstance(Driver.class, handler);
}
@@ -101,7 +101,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied PreparedStatement
*/
- public PreparedStatement createPreparedStatement(InvocationHandler handler) {
+ public PreparedStatement createPreparedStatement(final InvocationHandler handler) {
return newProxyInstance(PreparedStatement.class, handler);
}
@@ -110,7 +110,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied ResultSet
*/
- public ResultSet createResultSet(InvocationHandler handler) {
+ public ResultSet createResultSet(final InvocationHandler handler) {
return newProxyInstance(ResultSet.class, handler);
}
@@ -119,7 +119,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied ResultSetMetaData
*/
- public ResultSetMetaData createResultSetMetaData(InvocationHandler handler) {
+ public ResultSetMetaData createResultSetMetaData(final InvocationHandler handler) {
return newProxyInstance(ResultSetMetaData.class, handler);
}
@@ -128,7 +128,7 @@ public class ProxyFactory {
* @param handler The handler that intercepts/overrides method calls.
* @return proxied Statement
*/
- public Statement createStatement(InvocationHandler handler) {
+ public Statement createStatement(final InvocationHandler handler) {
return newProxyInstance(Statement.class, handler);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/QueryLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/QueryLoader.java b/src/main/java/org/apache/commons/dbutils/QueryLoader.java
index cec9fbd..2fd032c 100644
--- a/src/main/java/org/apache/commons/dbutils/QueryLoader.java
+++ b/src/main/java/org/apache/commons/dbutils/QueryLoader.java
@@ -80,7 +80,7 @@ public class QueryLoader {
* @return Map of query names to SQL values
* @see java.util.Properties
*/
- public synchronized Map<String, String> load(String path) throws IOException {
+ public synchronized Map<String, String> load(final String path) throws IOException {
Map<String, String> queryMap = this.queries.get(path);
@@ -108,7 +108,7 @@ public class QueryLoader {
* @return Map of query names to SQL values
* @see java.util.Properties
*/
- protected Map<String, String> loadQueries(String path) throws IOException {
+ protected Map<String, String> loadQueries(final String path) throws IOException {
// Findbugs flags getClass().getResource as a bad practice; maybe we should change the API?
final Properties props;
try (InputStream in = getClass().getResourceAsStream(path)) {
@@ -135,7 +135,7 @@ public class QueryLoader {
* Removes the queries for the given path from the cache.
* @param path The path that the queries were loaded from.
*/
- public synchronized void unload(String path) {
+ public synchronized void unload(final String path) {
this.queries.remove(path);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/QueryRunner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/QueryRunner.java b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
index 321caee..f4f3f4b 100644
--- a/src/main/java/org/apache/commons/dbutils/QueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/QueryRunner.java
@@ -48,7 +48,7 @@ public class QueryRunner extends AbstractQueryRunner {
* if <code>pmdKnownBroken</code> is set to true, we won't even try it; if false, we'll try it,
* and if it breaks, we'll remember not to use it again.
*/
- public QueryRunner(boolean pmdKnownBroken) {
+ public QueryRunner(final boolean pmdKnownBroken) {
super(pmdKnownBroken);
}
@@ -60,7 +60,7 @@ public class QueryRunner extends AbstractQueryRunner {
*
* @param ds The <code>DataSource</code> to retrieve connections from.
*/
- public QueryRunner(DataSource ds) {
+ public QueryRunner(final DataSource ds) {
super(ds);
}
@@ -70,7 +70,7 @@ public class QueryRunner extends AbstractQueryRunner {
*
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public QueryRunner(StatementConfiguration stmtConfig) {
+ public QueryRunner(final StatementConfiguration stmtConfig) {
super(stmtConfig);
}
@@ -84,7 +84,7 @@ public class QueryRunner extends AbstractQueryRunner {
* if <code>pmdKnownBroken</code> is set to true, we won't even try it; if false, we'll try it,
* and if it breaks, we'll remember not to use it again.
*/
- public QueryRunner(DataSource ds, boolean pmdKnownBroken) {
+ public QueryRunner(final DataSource ds, final boolean pmdKnownBroken) {
super(ds, pmdKnownBroken);
}
@@ -97,7 +97,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @param ds The <code>DataSource</code> to retrieve connections from.
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public QueryRunner(DataSource ds, StatementConfiguration stmtConfig) {
+ public QueryRunner(final DataSource ds, final StatementConfiguration stmtConfig) {
super(ds, stmtConfig);
}
@@ -112,7 +112,7 @@ public class QueryRunner extends AbstractQueryRunner {
* and if it breaks, we'll remember not to use it again.
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public QueryRunner(DataSource ds, boolean pmdKnownBroken, StatementConfiguration stmtConfig) {
+ public QueryRunner(final DataSource ds, final boolean pmdKnownBroken, final StatementConfiguration stmtConfig) {
super(ds, pmdKnownBroken, stmtConfig);
}
@@ -128,7 +128,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since DbUtils 1.1
*/
- public int[] batch(Connection conn, String sql, Object[][] params) throws SQLException {
+ public int[] batch(final Connection conn, final String sql, final Object[][] params) throws SQLException {
return this.batch(conn, false, sql, params);
}
@@ -145,7 +145,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since DbUtils 1.1
*/
- public int[] batch(String sql, Object[][] params) throws SQLException {
+ public int[] batch(final String sql, final Object[][] params) throws SQLException {
Connection conn = this.prepareConnection();
return this.batch(conn, true, sql, params);
@@ -161,7 +161,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated in the batch.
* @throws SQLException If there are database or parameter errors.
*/
- private int[] batch(Connection conn, boolean closeConn, String sql, Object[][] params) throws SQLException {
+ private int[] batch(final Connection conn, final boolean closeConn, final String sql, final Object[][] params) throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
}
@@ -216,7 +216,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @deprecated Use {@link #query(Connection, String, ResultSetHandler, Object...)}
*/
@Deprecated
- public <T> T query(Connection conn, String sql, Object param, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final Connection conn, final String sql, final Object param, final ResultSetHandler<T> rsh) throws SQLException {
return this.<T>query(conn, false, sql, rsh, new Object[]{param});
}
@@ -233,7 +233,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @deprecated Use {@link #query(Connection,String,ResultSetHandler,Object...)} instead
*/
@Deprecated
- public <T> T query(Connection conn, String sql, Object[] params, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final Connection conn, final String sql, final Object[] params, final ResultSetHandler<T> rsh) throws SQLException {
return this.<T>query(conn, false, sql, rsh, params);
}
@@ -248,7 +248,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
*/
- public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> T query(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
return this.<T>query(conn, false, sql, rsh, params);
}
@@ -262,7 +262,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The object returned by the handler.
* @throws SQLException if a database access error occurs
*/
- public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
return this.<T>query(conn, false, sql, rsh, (Object[]) null);
}
@@ -281,7 +281,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
*/
@Deprecated
- public <T> T query(String sql, Object param, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final String sql, final Object param, final ResultSetHandler<T> rsh) throws SQLException {
Connection conn = this.prepareConnection();
return this.<T>query(conn, true, sql, rsh, new Object[]{param});
@@ -304,7 +304,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @deprecated Use {@link #query(String, ResultSetHandler, Object...)}
*/
@Deprecated
- public <T> T query(String sql, Object[] params, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final String sql, final Object[] params, final ResultSetHandler<T> rsh) throws SQLException {
Connection conn = this.prepareConnection();
return this.<T>query(conn, true, sql, rsh, params);
@@ -323,7 +323,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
*/
- public <T> T query(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> T query(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
Connection conn = this.prepareConnection();
return this.<T>query(conn, true, sql, rsh, params);
@@ -341,7 +341,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return An object generated by the handler.
* @throws SQLException if a database access error occurs
*/
- public <T> T query(String sql, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T query(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
Connection conn = this.prepareConnection();
return this.<T>query(conn, true, sql, rsh, (Object[]) null);
@@ -357,7 +357,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The results of the query.
* @throws SQLException If there are database or parameter errors.
*/
- private <T> T query(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params)
+ private <T> T query(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
@@ -410,7 +410,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException if a database access error occurs
*/
- public int update(Connection conn, String sql) throws SQLException {
+ public int update(final Connection conn, final String sql) throws SQLException {
return this.update(conn, false, sql, (Object[]) null);
}
@@ -424,7 +424,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException if a database access error occurs
*/
- public int update(Connection conn, String sql, Object param) throws SQLException {
+ public int update(final Connection conn, final String sql, final Object param) throws SQLException {
return this.update(conn, false, sql, new Object[]{param});
}
@@ -437,7 +437,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException if a database access error occurs
*/
- public int update(Connection conn, String sql, Object... params) throws SQLException {
+ public int update(final Connection conn, final String sql, final Object... params) throws SQLException {
return update(conn, false, sql, params);
}
@@ -452,7 +452,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @return The number of rows updated.
*/
- public int update(String sql) throws SQLException {
+ public int update(final String sql) throws SQLException {
Connection conn = this.prepareConnection();
return this.update(conn, true, sql, (Object[]) null);
@@ -470,7 +470,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @return The number of rows updated.
*/
- public int update(String sql, Object param) throws SQLException {
+ public int update(final String sql, final Object param) throws SQLException {
Connection conn = this.prepareConnection();
return this.update(conn, true, sql, new Object[]{param});
@@ -488,7 +488,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @return The number of rows updated.
*/
- public int update(String sql, Object... params) throws SQLException {
+ public int update(final String sql, final Object... params) throws SQLException {
Connection conn = this.prepareConnection();
return this.update(conn, true, sql, params);
@@ -504,7 +504,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException If there are database or parameter errors.
*/
- private int update(Connection conn, boolean closeConn, String sql, Object... params) throws SQLException {
+ private int update(final Connection conn, final boolean closeConn, final String sql, final Object... params) throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
}
@@ -549,7 +549,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insert(String sql, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T insert(final String sql, final ResultSetHandler<T> rsh) throws SQLException {
return insert(this.prepareConnection(), true, sql, rsh, (Object[]) null);
}
@@ -567,7 +567,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insert(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> T insert(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
return insert(this.prepareConnection(), true, sql, rsh, params);
}
@@ -582,7 +582,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insert(Connection conn, String sql, ResultSetHandler<T> rsh) throws SQLException {
+ public <T> T insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh) throws SQLException {
return insert(conn, false, sql, rsh, (Object[]) null);
}
@@ -598,7 +598,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insert(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> T insert(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
return insert(conn, false, sql, rsh, params);
}
@@ -614,7 +614,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException If there are database or parameter errors.
* @since 1.6
*/
- private <T> T insert(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params)
+ private <T> T insert(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object... params)
throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
@@ -669,7 +669,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insertBatch(String sql, ResultSetHandler<T> rsh, Object[][] params) throws SQLException {
+ public <T> T insertBatch(final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
return insertBatch(this.prepareConnection(), true, sql, rsh, params);
}
@@ -685,7 +685,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @since 1.6
*/
- public <T> T insertBatch(Connection conn, String sql, ResultSetHandler<T> rsh, Object[][] params) throws SQLException {
+ public <T> T insertBatch(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params) throws SQLException {
return insertBatch(conn, false, sql, rsh, params);
}
@@ -701,7 +701,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException If there are database or parameter errors.
* @since 1.6
*/
- private <T> T insertBatch(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object[][] params)
+ private <T> T insertBatch(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object[][] params)
throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
@@ -765,7 +765,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException if a database access error occurs
*/
- public int execute(Connection conn, String sql, Object... params) throws SQLException {
+ public int execute(final Connection conn, final String sql, final Object... params) throws SQLException {
return this.execute(conn, false, sql, params);
}
@@ -791,7 +791,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException if a database access error occurs
* @return The number of rows updated.
*/
- public int execute(String sql, Object... params) throws SQLException {
+ public int execute(final String sql, final Object... params) throws SQLException {
Connection conn = this.prepareConnection();
return this.execute(conn, true, sql, params);
@@ -819,7 +819,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return A list of objects generated by the handler
* @throws SQLException if a database access error occurs
*/
- public <T> List<T> execute(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> List<T> execute(final Connection conn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
return this.execute(conn, false, sql, rsh, params);
}
@@ -844,7 +844,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return A list of objects generated by the handler
* @throws SQLException if a database access error occurs
*/
- public <T> List<T> execute(String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ public <T> List<T> execute(final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
Connection conn = this.prepareConnection();
return this.execute(conn, true, sql, rsh, params);
@@ -861,7 +861,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return The number of rows updated.
* @throws SQLException If there are database or parameter errors.
*/
- private int execute(Connection conn, boolean closeConn, String sql, Object... params) throws SQLException {
+ private int execute(final Connection conn, final boolean closeConn, final String sql, final Object... params) throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
}
@@ -908,7 +908,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @return List of all objects generated by the ResultSetHandler for all result sets handled.
* @throws SQLException If there are database or parameter errors.
*/
- private <T> List<T> execute(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
+ private <T> List<T> execute(final Connection conn, final boolean closeConn, final String sql, final ResultSetHandler<T> rsh, final Object... params) throws SQLException {
if (conn == null) {
throw new SQLException("Null connection");
}
@@ -971,7 +971,7 @@ public class QueryRunner extends AbstractQueryRunner {
* @throws SQLException when the value could not be retrieved from the
* statement.
*/
- private void retrieveOutParameters(CallableStatement stmt, Object[] params) throws SQLException {
+ private void retrieveOutParameters(final CallableStatement stmt, final Object[] params) throws SQLException {
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (params[i] instanceof OutParameter) {
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/ResultSetIterator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/ResultSetIterator.java b/src/main/java/org/apache/commons/dbutils/ResultSetIterator.java
index 50e2a12..a7ce7c9 100644
--- a/src/main/java/org/apache/commons/dbutils/ResultSetIterator.java
+++ b/src/main/java/org/apache/commons/dbutils/ResultSetIterator.java
@@ -48,7 +48,7 @@ public class ResultSetIterator implements Iterator<Object[]> {
* Constructor for ResultSetIterator.
* @param rs Wrap this <code>ResultSet</code> in an <code>Iterator</code>.
*/
- public ResultSetIterator(ResultSet rs) {
+ public ResultSetIterator(final ResultSet rs) {
this(rs, new BasicRowProcessor());
}
@@ -59,7 +59,7 @@ public class ResultSetIterator implements Iterator<Object[]> {
* <code>Object[]</code>. Defaults to a
* <code>BasicRowProcessor</code>.
*/
- public ResultSetIterator(ResultSet rs, RowProcessor convert) {
+ public ResultSetIterator(final ResultSet rs, final RowProcessor convert) {
this.rs = rs;
this.convert = convert;
}
@@ -117,7 +117,7 @@ public class ResultSetIterator implements Iterator<Object[]> {
* @param e SQLException to rethrow
* @since DbUtils 1.1
*/
- protected void rethrow(SQLException e) {
+ protected void rethrow(final SQLException e) {
throw new RuntimeException(e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/StatementConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/StatementConfiguration.java b/src/main/java/org/apache/commons/dbutils/StatementConfiguration.java
index 68761ab..e916b8b 100644
--- a/src/main/java/org/apache/commons/dbutils/StatementConfiguration.java
+++ b/src/main/java/org/apache/commons/dbutils/StatementConfiguration.java
@@ -35,8 +35,8 @@ public class StatementConfiguration {
* @param maxRows The maximum number of rows that a <code>ResultSet</code> can produce.
* @param queryTimeout The number of seconds the driver will wait for execution.
*/
- public StatementConfiguration(Integer fetchDirection, Integer fetchSize, Integer maxFieldSize, Integer maxRows,
- Integer queryTimeout) {
+ public StatementConfiguration(final Integer fetchDirection, final Integer fetchSize, final Integer maxFieldSize, final Integer maxRows,
+ final Integer queryTimeout) {
this.fetchDirection = fetchDirection;
this.fetchSize = fetchSize;
this.maxFieldSize = maxFieldSize;
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/AbstractKeyedHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/AbstractKeyedHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/AbstractKeyedHandler.java
index c16f587..69e3a64 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/AbstractKeyedHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/AbstractKeyedHandler.java
@@ -47,7 +47,7 @@ public abstract class AbstractKeyedHandler<K, V> implements ResultSetHandler<Map
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
@Override
- public Map<K, V> handle(ResultSet rs) throws SQLException {
+ public Map<K, V> handle(final ResultSet rs) throws SQLException {
Map<K, V> result = createMap();
while (rs.next()) {
result.put(createKey(rs), createRow(rs));
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
index a8fb5fe..d360155 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/AbstractListHandler.java
@@ -42,7 +42,7 @@ public abstract class AbstractListHandler<T> implements ResultSetHandler<List<T>
* @throws SQLException error occurs
*/
@Override
- public List<T> handle(ResultSet rs) throws SQLException {
+ public List<T> handle(final ResultSet rs) throws SQLException {
List<T> rows = new ArrayList<>();
while (rs.next()) {
rows.add(this.handleRow(rs));
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/ArrayHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
index 7d7bfea..4344c42 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/ArrayHandler.java
@@ -64,7 +64,7 @@ public class ArrayHandler implements ResultSetHandler<Object[]> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into arrays.
*/
- public ArrayHandler(RowProcessor convert) {
+ public ArrayHandler(final RowProcessor convert) {
super();
this.convert = convert;
}
@@ -79,7 +79,7 @@ public class ArrayHandler implements ResultSetHandler<Object[]> {
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
@Override
- public Object[] handle(ResultSet rs) throws SQLException {
+ public Object[] handle(final ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toArray(rs) : EMPTY_ARRAY;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
index d2359cf..9527f3b 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/ArrayListHandler.java
@@ -50,7 +50,7 @@ public class ArrayListHandler extends AbstractListHandler<Object[]> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into Object[]s.
*/
- public ArrayListHandler(RowProcessor convert) {
+ public ArrayListHandler(final RowProcessor convert) {
super();
this.convert = convert;
}
@@ -65,7 +65,7 @@ public class ArrayListHandler extends AbstractListHandler<Object[]> {
* @see org.apache.commons.dbutils.handlers.AbstractListHandler#handle(ResultSet)
*/
@Override
- protected Object[] handleRow(ResultSet rs) throws SQLException {
+ protected Object[] handleRow(final ResultSet rs) throws SQLException {
return this.convert.toArray(rs);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/BeanHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/BeanHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/BeanHandler.java
index c2f0436..09758df 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/BeanHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/BeanHandler.java
@@ -48,7 +48,7 @@ public class BeanHandler<T> implements ResultSetHandler<T> {
* @param type The Class that objects returned from <code>handle()</code>
* are created from.
*/
- public BeanHandler(Class<? extends T> type) {
+ public BeanHandler(final Class<? extends T> type) {
this(type, ArrayHandler.ROW_PROCESSOR);
}
@@ -60,7 +60,7 @@ public class BeanHandler<T> implements ResultSetHandler<T> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into beans.
*/
- public BeanHandler(Class<? extends T> type, RowProcessor convert) {
+ public BeanHandler(final Class<? extends T> type, final RowProcessor convert) {
this.type = type;
this.convert = convert;
}
@@ -76,7 +76,7 @@ public class BeanHandler<T> implements ResultSetHandler<T> {
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
@Override
- public T handle(ResultSet rs) throws SQLException {
+ public T handle(final ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toBean(rs, this.type) : null;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/BeanListHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
index c990dbd..cee50fd 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/BeanListHandler.java
@@ -50,7 +50,7 @@ public class BeanListHandler<T> implements ResultSetHandler<List<T>> {
* @param type The Class that objects returned from <code>handle()</code>
* are created from.
*/
- public BeanListHandler(Class<? extends T> type) {
+ public BeanListHandler(final Class<? extends T> type) {
this(type, ArrayHandler.ROW_PROCESSOR);
}
@@ -62,7 +62,7 @@ public class BeanListHandler<T> implements ResultSetHandler<List<T>> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into beans.
*/
- public BeanListHandler(Class<? extends T> type, RowProcessor convert) {
+ public BeanListHandler(final Class<? extends T> type, final RowProcessor convert) {
this.type = type;
this.convert = convert;
}
@@ -79,7 +79,7 @@ public class BeanListHandler<T> implements ResultSetHandler<List<T>> {
* @see org.apache.commons.dbutils.RowProcessor#toBeanList(ResultSet, Class)
*/
@Override
- public List<T> handle(ResultSet rs) throws SQLException {
+ public List<T> handle(final ResultSet rs) throws SQLException {
return this.convert.toBeanList(rs, type);
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
index 79cfbb4..e9af0d0 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/BeanMapHandler.java
@@ -86,7 +86,7 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
* The Class that objects returned from <code>createRow()</code>
* are created from.
*/
- public BeanMapHandler(Class<V> type) {
+ public BeanMapHandler(final Class<V> type) {
this(type, ArrayHandler.ROW_PROCESSOR, 1, null);
}
@@ -101,7 +101,7 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
* The <code>RowProcessor</code> implementation to use when
* converting rows into Beans
*/
- public BeanMapHandler(Class<V> type, RowProcessor convert) {
+ public BeanMapHandler(final Class<V> type, final RowProcessor convert) {
this(type, convert, 1, null);
}
@@ -115,7 +115,7 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
* The values to use as keys in the Map are retrieved from the
* column at this index.
*/
- public BeanMapHandler(Class<V> type, int columnIndex) {
+ public BeanMapHandler(final Class<V> type, final int columnIndex) {
this(type, ArrayHandler.ROW_PROCESSOR, columnIndex, null);
}
@@ -129,7 +129,7 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
* The values to use as keys in the Map are retrieved from the
* column with this name.
*/
- public BeanMapHandler(Class<V> type, String columnName) {
+ public BeanMapHandler(final Class<V> type, final String columnName) {
this(type, ArrayHandler.ROW_PROCESSOR, 1, columnName);
}
@@ -146,8 +146,8 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
* The values to use as keys in the Map are retrieved from the
* column with this name.
*/
- private BeanMapHandler(Class<V> type, RowProcessor convert,
- int columnIndex, String columnName) {
+ private BeanMapHandler(final Class<V> type, final RowProcessor convert,
+ final int columnIndex, final String columnName) {
super();
this.type = type;
this.convert = convert;
@@ -171,14 +171,14 @@ public class BeanMapHandler<K, V> extends AbstractKeyedHandler<K, V> {
// so getObject will return the appropriate type and the cast will succeed.
@SuppressWarnings("unchecked")
@Override
- protected K createKey(ResultSet rs) throws SQLException {
+ protected K createKey(final ResultSet rs) throws SQLException {
return (columnName == null) ?
(K) rs.getObject(columnIndex) :
(K) rs.getObject(columnName);
}
@Override
- protected V createRow(ResultSet rs) throws SQLException {
+ protected V createRow(final ResultSet rs) throws SQLException {
return this.convert.toBean(rs, type);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
index 4f3e506..8a12f2e 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/ColumnListHandler.java
@@ -55,7 +55,7 @@ public class ColumnListHandler<T> extends AbstractListHandler<T> {
* @param columnIndex The index of the column to retrieve from the
* <code>ResultSet</code>.
*/
- public ColumnListHandler(int columnIndex) {
+ public ColumnListHandler(final int columnIndex) {
this(columnIndex, null);
}
@@ -65,7 +65,7 @@ public class ColumnListHandler<T> extends AbstractListHandler<T> {
* @param columnName The name of the column to retrieve from the
* <code>ResultSet</code>.
*/
- public ColumnListHandler(String columnName) {
+ public ColumnListHandler(final String columnName) {
this(1, columnName);
}
@@ -75,7 +75,7 @@ public class ColumnListHandler<T> extends AbstractListHandler<T> {
* @param columnName The name of the column to retrieve from the
* <code>ResultSet</code>.
*/
- private ColumnListHandler(int columnIndex, String columnName) {
+ private ColumnListHandler(final int columnIndex, final String columnName) {
super();
this.columnIndex = columnIndex;
this.columnName = columnName;
@@ -95,7 +95,7 @@ public class ColumnListHandler<T> extends AbstractListHandler<T> {
// so getObject will return the appropriate type and the cast will succeed.
@SuppressWarnings("unchecked")
@Override
- protected T handleRow(ResultSet rs) throws SQLException {
+ protected T handleRow(final ResultSet rs) throws SQLException {
if (this.columnName == null) {
return (T) rs.getObject(this.columnIndex);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
index ed79290..6580d6d 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/KeyedHandler.java
@@ -83,7 +83,7 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into Maps
*/
- public KeyedHandler(RowProcessor convert) {
+ public KeyedHandler(final RowProcessor convert) {
this(convert, 1, null);
}
@@ -93,7 +93,7 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
* @param columnIndex The values to use as keys in the Map are
* retrieved from the column at this index.
*/
- public KeyedHandler(int columnIndex) {
+ public KeyedHandler(final int columnIndex) {
this(ArrayHandler.ROW_PROCESSOR, columnIndex, null);
}
@@ -103,7 +103,7 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
* @param columnName The values to use as keys in the Map are
* retrieved from the column with this name.
*/
- public KeyedHandler(String columnName) {
+ public KeyedHandler(final String columnName) {
this(ArrayHandler.ROW_PROCESSOR, 1, columnName);
}
@@ -115,8 +115,8 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
* @param columnName The values to use as keys in the Map are
* retrieved from the column with this name.
*/
- private KeyedHandler(RowProcessor convert, int columnIndex,
- String columnName) {
+ private KeyedHandler(final RowProcessor convert, final int columnIndex,
+ final String columnName) {
super();
this.convert = convert;
this.columnIndex = columnIndex;
@@ -137,7 +137,7 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
// so getObject will return the appropriate type and the cast will succeed.
@SuppressWarnings("unchecked")
@Override
- protected K createKey(ResultSet rs) throws SQLException {
+ protected K createKey(final ResultSet rs) throws SQLException {
return (columnName == null) ?
(K) rs.getObject(columnIndex) :
(K) rs.getObject(columnName);
@@ -154,7 +154,7 @@ public class KeyedHandler<K> extends AbstractKeyedHandler<K, Map<String, Object>
* @throws SQLException if a database access error occurs
*/
@Override
- protected Map<String, Object> createRow(ResultSet rs) throws SQLException {
+ protected Map<String, Object> createRow(final ResultSet rs) throws SQLException {
return this.convert.toMap(rs);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/MapHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/MapHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/MapHandler.java
index db00345..3a2d391 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/MapHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/MapHandler.java
@@ -52,7 +52,7 @@ public class MapHandler implements ResultSetHandler<Map<String, Object>> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into Maps.
*/
- public MapHandler(RowProcessor convert) {
+ public MapHandler(final RowProcessor convert) {
super();
this.convert = convert;
}
@@ -69,7 +69,7 @@ public class MapHandler implements ResultSetHandler<Map<String, Object>> {
* @see org.apache.commons.dbutils.ResultSetHandler#handle(java.sql.ResultSet)
*/
@Override
- public Map<String, Object> handle(ResultSet rs) throws SQLException {
+ public Map<String, Object> handle(final ResultSet rs) throws SQLException {
return rs.next() ? this.convert.toMap(rs) : null;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/MapListHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/MapListHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/MapListHandler.java
index a055f2a..443ba35 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/MapListHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/MapListHandler.java
@@ -51,7 +51,7 @@ public class MapListHandler extends AbstractListHandler<Map<String, Object>> {
* @param convert The <code>RowProcessor</code> implementation
* to use when converting rows into Maps.
*/
- public MapListHandler(RowProcessor convert) {
+ public MapListHandler(final RowProcessor convert) {
super();
this.convert = convert;
}
@@ -66,7 +66,7 @@ public class MapListHandler extends AbstractListHandler<Map<String, Object>> {
* @see org.apache.commons.dbutils.handlers.AbstractListHandler#handle(ResultSet)
*/
@Override
- protected Map<String, Object> handleRow(ResultSet rs) throws SQLException {
+ protected Map<String, Object> handleRow(final ResultSet rs) throws SQLException {
return this.convert.toMap(rs);
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
index 4b70604..4afc758 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/ScalarHandler.java
@@ -55,7 +55,7 @@ public class ScalarHandler<T> implements ResultSetHandler<T> {
* @param columnIndex The index of the column to retrieve from the
* <code>ResultSet</code>.
*/
- public ScalarHandler(int columnIndex) {
+ public ScalarHandler(final int columnIndex) {
this(columnIndex, null);
}
@@ -65,7 +65,7 @@ public class ScalarHandler<T> implements ResultSetHandler<T> {
* @param columnName The name of the column to retrieve from the
* <code>ResultSet</code>.
*/
- public ScalarHandler(String columnName) {
+ public ScalarHandler(final String columnName) {
this(1, columnName);
}
@@ -75,7 +75,7 @@ public class ScalarHandler<T> implements ResultSetHandler<T> {
* @param columnName The name of the column to retrieve from the
* <code>ResultSet</code>.
*/
- private ScalarHandler(int columnIndex, String columnName) {
+ private ScalarHandler(final int columnIndex, final String columnName) {
this.columnIndex = columnIndex;
this.columnName = columnName;
}
@@ -97,7 +97,7 @@ public class ScalarHandler<T> implements ResultSetHandler<T> {
// so getObject will return the appropriate type and the cast will succeed.
@SuppressWarnings("unchecked")
@Override
- public T handle(ResultSet rs) throws SQLException {
+ public T handle(final ResultSet rs) throws SQLException {
if (rs.next()) {
if (this.columnName == null) {
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandler.java
index a7d1189..d0a77fb 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/BooleanColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class BooleanColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Boolean.TYPE) || propType.equals(Boolean.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Boolean.valueOf(rs.getBoolean(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandler.java
index 4731452..2df55df 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/ByteColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class ByteColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Byte.TYPE) || propType.equals(Byte.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Byte.valueOf(rs.getByte(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandler.java
index dbfb58b..3cedb26 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/DoubleColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class DoubleColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Double.TYPE) || propType.equals(Double.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Double.valueOf(rs.getDouble(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandler.java
index 8f7edf1..b50045f 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/FloatColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class FloatColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Float.TYPE) || propType.equals(Float.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Float.valueOf(rs.getFloat(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandler.java
index 7d7d00e..a803cff 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/IntegerColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class IntegerColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Integer.TYPE) || propType.equals(Integer.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Integer.valueOf(rs.getInt(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandler.java
index 75dec28..0cbaeb1 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/LongColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class LongColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Long.TYPE) || propType.equals(Long.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Long.valueOf(rs.getLong(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java
index 19166fd..d02a14d 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/SQLXMLColumnHandler.java
@@ -24,12 +24,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class SQLXMLColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(SQLXML.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return rs.getSQLXML(columnIndex);
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandler.java
index 7ce36e4..27aecf8 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/ShortColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class ShortColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Short.TYPE) || propType.equals(Short.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return Short.valueOf(rs.getShort(columnIndex));
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java
index 6f07c78..dc68fe6 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/StringColumnHandler.java
@@ -23,12 +23,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class StringColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(String.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return rs.getString(columnIndex);
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandler.java
index 4e2195b..1d505e3 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/columns/TimestampColumnHandler.java
@@ -24,12 +24,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class TimestampColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return propType.equals(Timestamp.class);
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return rs.getTimestamp(columnIndex);
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandler.java
index 9e623dd..3c83cb0 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/properties/DatePropertyHandler.java
@@ -22,7 +22,7 @@ import org.apache.commons.dbutils.PropertyHandler;
public class DatePropertyHandler implements PropertyHandler {
@Override
- public boolean match(Class<?> parameter, Object value) {
+ public boolean match(final Class<?> parameter, final Object value) {
if (value instanceof java.util.Date) {
final String targetType = parameter.getName();
if ("java.sql.Date".equals(targetType)) {
@@ -40,7 +40,7 @@ public class DatePropertyHandler implements PropertyHandler {
}
@Override
- public Object apply(Class<?> parameter, Object value) {
+ public Object apply(final Class<?> parameter, Object value) {
final String targetType = parameter.getName();
if ("java.sql.Date".equals(targetType)) {
value = new java.sql.Date(((java.util.Date) value).getTime());
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandler.java b/src/main/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandler.java
index 67e309f..bf3bdf5 100644
--- a/src/main/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/handlers/properties/StringEnumPropertyHandler.java
@@ -20,12 +20,12 @@ import org.apache.commons.dbutils.PropertyHandler;
public class StringEnumPropertyHandler implements PropertyHandler {
@Override
- public boolean match(Class<?> parameter, Object value) {
+ public boolean match(final Class<?> parameter, final Object value) {
return value instanceof String && parameter.isEnum();
}
@Override
- public Object apply(Class<?> parameter, Object value) {
+ public Object apply(final Class<?> parameter, final Object value) {
return Enum.valueOf(parameter.asSubclass(Enum.class), (String) value);
}
}
[2/4] commons-dbutils git commit: Add final modifier to method
parameters.
Posted by gg...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
index ff54f68..4ef433e 100644
--- a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
+++ b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
@@ -109,7 +109,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
* @param rs The <code>ResultSet</code> to wrap.
* @return wrapped ResultSet
*/
- public static ResultSet wrap(ResultSet rs) {
+ public static ResultSet wrap(final ResultSet rs) {
return factory.createResultSet(new SqlNullCheckedResultSet(rs));
}
@@ -146,7 +146,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
* to wrap the specified <code>ResultSet</code>.
* @param rs ResultSet to wrap
*/
- public SqlNullCheckedResultSet(ResultSet rs) {
+ public SqlNullCheckedResultSet(final ResultSet rs) {
super();
this.rs = rs;
}
@@ -379,7 +379,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
* @throws Throwable error
*/
@Override
- public Object invoke(Object proxy, Method method, Object[] args)
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
Object result = method.invoke(this.rs, args);
@@ -399,7 +399,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullAsciiStream the value
*/
- public void setNullAsciiStream(InputStream nullAsciiStream) {
+ public void setNullAsciiStream(final InputStream nullAsciiStream) {
this.nullAsciiStream = nullAsciiStream;
}
@@ -409,7 +409,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullBigDecimal the value
*/
- public void setNullBigDecimal(BigDecimal nullBigDecimal) {
+ public void setNullBigDecimal(final BigDecimal nullBigDecimal) {
this.nullBigDecimal = nullBigDecimal;
}
@@ -419,7 +419,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullBinaryStream the value
*/
- public void setNullBinaryStream(InputStream nullBinaryStream) {
+ public void setNullBinaryStream(final InputStream nullBinaryStream) {
this.nullBinaryStream = nullBinaryStream;
}
@@ -429,7 +429,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullBlob the value
*/
- public void setNullBlob(Blob nullBlob) {
+ public void setNullBlob(final Blob nullBlob) {
this.nullBlob = nullBlob;
}
@@ -439,7 +439,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullBoolean the value
*/
- public void setNullBoolean(boolean nullBoolean) {
+ public void setNullBoolean(final boolean nullBoolean) {
this.nullBoolean = nullBoolean;
}
@@ -449,7 +449,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullByte the value
*/
- public void setNullByte(byte nullByte) {
+ public void setNullByte(final byte nullByte) {
this.nullByte = nullByte;
}
@@ -459,7 +459,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullBytes the value
*/
- public void setNullBytes(byte[] nullBytes) {
+ public void setNullBytes(final byte[] nullBytes) {
byte[] copy = new byte[nullBytes.length];
System.arraycopy(nullBytes, 0, copy, 0, nullBytes.length);
this.nullBytes = copy;
@@ -471,7 +471,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullCharacterStream the value
*/
- public void setNullCharacterStream(Reader nullCharacterStream) {
+ public void setNullCharacterStream(final Reader nullCharacterStream) {
this.nullCharacterStream = nullCharacterStream;
}
@@ -481,7 +481,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullClob the value
*/
- public void setNullClob(Clob nullClob) {
+ public void setNullClob(final Clob nullClob) {
this.nullClob = nullClob;
}
@@ -491,7 +491,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullDate the value
*/
- public void setNullDate(Date nullDate) {
+ public void setNullDate(final Date nullDate) {
this.nullDate = nullDate != null ? new Date(nullDate.getTime()) : null;
}
@@ -501,7 +501,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullDouble the value
*/
- public void setNullDouble(double nullDouble) {
+ public void setNullDouble(final double nullDouble) {
this.nullDouble = nullDouble;
}
@@ -511,7 +511,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullFloat the value
*/
- public void setNullFloat(float nullFloat) {
+ public void setNullFloat(final float nullFloat) {
this.nullFloat = nullFloat;
}
@@ -521,7 +521,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullInt the value
*/
- public void setNullInt(int nullInt) {
+ public void setNullInt(final int nullInt) {
this.nullInt = nullInt;
}
@@ -531,7 +531,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullLong the value
*/
- public void setNullLong(long nullLong) {
+ public void setNullLong(final long nullLong) {
this.nullLong = nullLong;
}
@@ -541,7 +541,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullObject the value
*/
- public void setNullObject(Object nullObject) {
+ public void setNullObject(final Object nullObject) {
this.nullObject = nullObject;
}
@@ -551,7 +551,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullRef the value
*/
- public void setNullRef(Ref nullRef) {
+ public void setNullRef(final Ref nullRef) {
this.nullRef = nullRef;
}
@@ -561,7 +561,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullShort the value
*/
- public void setNullShort(short nullShort) {
+ public void setNullShort(final short nullShort) {
this.nullShort = nullShort;
}
@@ -571,7 +571,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullString the value
*/
- public void setNullString(String nullString) {
+ public void setNullString(final String nullString) {
this.nullString = nullString;
}
@@ -581,7 +581,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullTime the value
*/
- public void setNullTime(Time nullTime) {
+ public void setNullTime(final Time nullTime) {
this.nullTime = nullTime;
}
@@ -591,7 +591,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullTimestamp the value
*/
- public void setNullTimestamp(Timestamp nullTimestamp) {
+ public void setNullTimestamp(final Timestamp nullTimestamp) {
this.nullTimestamp = nullTimestamp != null ? new Timestamp(nullTimestamp.getTime()) : null;
}
@@ -601,7 +601,7 @@ public class SqlNullCheckedResultSet implements InvocationHandler {
*
* @param nullURL the value
*/
- public void setNullURL(URL nullURL) {
+ public void setNullURL(final URL nullURL) {
this.nullURL = nullURL;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java b/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
index 830ef72..11c6fb3 100644
--- a/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
+++ b/src/main/java/org/apache/commons/dbutils/wrappers/StringTrimmedResultSet.java
@@ -60,7 +60,7 @@ public class StringTrimmedResultSet implements InvocationHandler {
* @param rs The <code>ResultSet</code> to wrap.
* @return wrapped ResultSet
*/
- public static ResultSet wrap(ResultSet rs) {
+ public static ResultSet wrap(final ResultSet rs) {
return factory.createResultSet(new StringTrimmedResultSet(rs));
}
@@ -74,7 +74,7 @@ public class StringTrimmedResultSet implements InvocationHandler {
* to wrap the specified <code>ResultSet</code>.
* @param rs ResultSet to wrap
*/
- public StringTrimmedResultSet(ResultSet rs) {
+ public StringTrimmedResultSet(final ResultSet rs) {
super();
this.rs = rs;
}
@@ -92,7 +92,7 @@ public class StringTrimmedResultSet implements InvocationHandler {
* @throws Throwable error
*/
@Override
- public Object invoke(Object proxy, Method method, Object[] args)
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
Object result = method.invoke(this.rs, args);
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java b/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
index 3a00aa9..6c0a769 100644
--- a/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/AsyncQueryRunnerTest.java
@@ -1,496 +1,496 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.dbutils;
-
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.sql.Connection;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.dbutils.handlers.ArrayHandler;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-@SuppressWarnings("boxing") // test code
-public class AsyncQueryRunnerTest {
- AsyncQueryRunner runner;
- ArrayHandler handler;
-
- @Mock DataSource dataSource;
- @Mock Connection conn;
- @Mock PreparedStatement stmt;
- @Mock ParameterMetaData meta;
- @Mock ResultSet results;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
- when(dataSource.getConnection()).thenReturn(conn);
- when(conn.prepareStatement(any(String.class))).thenReturn(stmt);
- when(stmt.getParameterMetaData()).thenReturn(meta);
- when(stmt.getResultSet()).thenReturn(results);
- when(stmt.executeQuery()).thenReturn(results);
- when(results.next()).thenReturn(false);
-
- handler = new ArrayHandler();
- runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1), new QueryRunner(dataSource));
- }
-
- //
- // Batch test cases
- //
- private void callGoodBatch(Connection conn, Object[][] params) throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- Future<int[]> future = runner.batch(conn, "select * from blah where ? = ?", params);
-
- future.get();
-
- verify(stmt, times(2)).addBatch();
- verify(stmt, times(1)).executeBatch();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
- }
-
- private void callGoodBatch(Object[][] params) throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- Future<int[]> future = runner.batch("select * from blah where ? = ?", params);
-
- future.get();
-
- verify(stmt, times(2)).addBatch();
- verify(stmt, times(1)).executeBatch();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(1)).close(); // make sure we closed the connection
- }
-
- @Test
- public void testGoodBatch() throws Exception {
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- callGoodBatch(params);
- }
-
- @SuppressWarnings("deprecation") // deliberate test of deprecated code
- @Test
- public void testGoodBatchPmdTrue() throws Exception {
- runner = new AsyncQueryRunner(dataSource, true, Executors.newFixedThreadPool(1));
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- callGoodBatch(params);
- }
-
- @Test
- public void testGoodBatchDefaultConstructor() throws Exception {
- runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- callGoodBatch(conn, params);
- }
-
- @Test
- public void testNullParamsBatch() throws Exception {
- String[][] params = new String[][] { { null, "unit" }, { "test", null } };
-
- callGoodBatch(params);
- }
-
-
-
- // helper method for calling batch when an exception is expected
- private void callBatchWithException(String sql, Object[][] params) throws Exception {
- Future<int[]> future = null;
- boolean caught = false;
-
- try {
- future = runner.batch(sql, params);
-
- future.get();
-
- verify(stmt, times(2)).addBatch();
- verify(stmt, times(1)).executeBatch();
- verify(stmt, times(1)).close(); // make sure the statement is closed
- verify(conn, times(1)).close(); // make sure the connection is closed
- } catch(Exception e) {
- caught = true;
- }
-
- if(!caught) {
- fail("Exception never thrown, but expected");
- }
- }
-
- @Test
- public void testTooFewParamsBatch() throws Exception {
- String[][] params = new String[][] { { "unit" }, { "test" } };
-
- callBatchWithException("select * from blah where ? = ?", params);
- }
-
- @Test
- public void testTooManyParamsBatch() throws Exception {
- String[][] params = new String[][] { { "unit", "unit", "unit" }, { "test", "test", "test" } };
-
- callBatchWithException("select * from blah where ? = ?", params);
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullConnectionBatch() throws Exception {
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- when(meta.getParameterCount()).thenReturn(2);
- when(dataSource.getConnection()).thenReturn(null);
-
- runner.batch("select * from blah where ? = ?", params).get();
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullSqlBatch() throws Exception {
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- when(meta.getParameterCount()).thenReturn(2);
-
- runner.batch(null, params).get();
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullParamsArgBatch() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
-
- runner.batch("select * from blah where ? = ?", null).get();
- }
-
- @Test
- public void testAddBatchException() throws Exception {
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- doThrow(new SQLException()).when(stmt).addBatch();
-
- callBatchWithException("select * from blah where ? = ?", params);
- }
-
- @Test
- public void testExecuteBatchException() throws Exception {
- String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
-
- doThrow(new SQLException()).when(stmt).executeBatch();
-
- callBatchWithException("select * from blah where ? = ?", params);
- }
-
-
- //
- // Query test cases
- //
- private void callGoodQuery(Connection conn) throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test").get();
-
- verify(stmt, times(1)).executeQuery();
- verify(results, times(1)).close();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
-
- // call the other variation of query
- when(meta.getParameterCount()).thenReturn(0);
- runner.query(conn, "select * from blah", handler).get();
-
- verify(stmt, times(2)).executeQuery();
- verify(results, times(2)).close();
- verify(stmt, times(2)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
- }
-
- private void callGoodQuery() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- runner.query("select * from blah where ? = ?", handler, "unit", "test").get();
-
- verify(stmt, times(1)).executeQuery();
- verify(results, times(1)).close();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(1)).close(); // make sure we closed the connection
-
- // call the other variation of query
- when(meta.getParameterCount()).thenReturn(0);
- runner.query("select * from blah", handler).get();
-
- verify(stmt, times(2)).executeQuery();
- verify(results, times(2)).close();
- verify(stmt, times(2)).close(); // make sure we closed the statement
- verify(conn, times(2)).close(); // make sure we closed the connection
- }
-
- @Test
- public void testGoodQuery() throws Exception {
- callGoodQuery();
- }
-
- @SuppressWarnings("deprecation") // deliberate test of deprecated code
- @Test
- public void testGoodQueryPmdTrue() throws Exception {
- runner = new AsyncQueryRunner(true, Executors.newFixedThreadPool(1));
- callGoodQuery(conn);
- }
-
- @Test
- public void testGoodQueryDefaultConstructor() throws Exception {
- runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
- callGoodQuery(conn);
- }
-
-
- // helper method for calling batch when an exception is expected
- private void callQueryWithException(Object... params) throws Exception {
- boolean caught = false;
-
- try {
- when(meta.getParameterCount()).thenReturn(2);
- runner.query("select * from blah where ? = ?", handler, params).get();
-
- verify(stmt, times(1)).executeQuery();
- verify(results, times(1)).close();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(1)).close(); // make sure we closed the connection
- } catch(Exception e) {
- caught = true;
- }
-
- if(!caught) {
- fail("Exception never thrown, but expected");
- }
- }
-
- @Test
- public void testNoParamsQuery() throws Exception {
- callQueryWithException();
- }
-
- @Test
- public void testTooFewParamsQuery() throws Exception {
- callQueryWithException("unit");
- }
-
- @Test
- public void testTooManyParamsQuery() throws Exception {
- callQueryWithException("unit", "test", "fail");
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullConnectionQuery() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- when(dataSource.getConnection()).thenReturn(null);
-
- runner.query("select * from blah where ? = ?", handler, "unit", "test").get();
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullSqlQuery() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
-
- runner.query(null, handler).get();
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullHandlerQuery() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
-
- runner.query("select * from blah where ? = ?", null).get();
- }
-
- @Test
- public void testExecuteQueryException() throws Exception {
- doThrow(new SQLException()).when(stmt).executeQuery();
-
- callQueryWithException(handler, "unit", "test");
- }
-
-
- //
- // Update test cases
- //
- private void callGoodUpdate(Connection conn) throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- runner.update(conn, "update blah set ? = ?", "unit", "test").get();
-
- verify(stmt, times(1)).executeUpdate();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
-
- // call the other variation
- when(meta.getParameterCount()).thenReturn(0);
- runner.update(conn, "update blah set unit = test").get();
-
- verify(stmt, times(2)).executeUpdate();
- verify(stmt, times(2)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
-
- // call the other variation
- when(meta.getParameterCount()).thenReturn(1);
- runner.update(conn, "update blah set unit = ?", "test").get();
-
- verify(stmt, times(3)).executeUpdate();
- verify(stmt, times(3)).close(); // make sure we closed the statement
- verify(conn, times(0)).close(); // make sure we closed the connection
- }
-
- private void callGoodUpdate() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- runner.update("update blah set ? = ?", "unit", "test").get();
-
- verify(stmt, times(1)).executeUpdate();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(1)).close(); // make sure we closed the connection
-
- // call the other variation
- when(meta.getParameterCount()).thenReturn(0);
- runner.update("update blah set unit = test").get();
-
- verify(stmt, times(2)).executeUpdate();
- verify(stmt, times(2)).close(); // make sure we closed the statement
- verify(conn, times(2)).close(); // make sure we closed the connection
-
- // call the other variation
- when(meta.getParameterCount()).thenReturn(1);
- runner.update("update blah set unit = ?", "test").get();
-
- verify(stmt, times(3)).executeUpdate();
- verify(stmt, times(3)).close(); // make sure we closed the statement
- verify(conn, times(3)).close(); // make sure we closed the connection
- }
-
- @Test
- public void testGoodUpdate() throws Exception {
- callGoodUpdate();
- }
-
- @SuppressWarnings("deprecation") // deliberate test of deprecated code
- @Test
- public void testGoodUpdatePmdTrue() throws Exception {
- runner = new AsyncQueryRunner(true, Executors.newFixedThreadPool(1));
- callGoodUpdate(conn);
- }
-
- @Test
- public void testGoodUpdateDefaultConstructor() throws Exception {
- runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
- callGoodUpdate(conn);
- }
-
- // helper method for calling batch when an exception is expected
- private void callUpdateWithException(Object... params) throws Exception {
- boolean caught = false;
-
- try {
- when(meta.getParameterCount()).thenReturn(2);
- runner.update("select * from blah where ? = ?", params).get();
-
- verify(stmt, times(1)).executeUpdate();
- verify(stmt, times(1)).close(); // make sure we closed the statement
- verify(conn, times(1)).close(); // make sure we closed the connection
- } catch(Exception e) {
- caught = true;
- }
-
- if(!caught) {
- fail("Exception never thrown, but expected");
- }
- }
-
- @Test
- public void testNoParamsUpdate() throws Exception {
- callUpdateWithException();
- }
-
- @Test
- public void testTooFewParamsUpdate() throws Exception {
- callUpdateWithException("unit");
- }
-
- @Test
- public void testTooManyParamsUpdate() throws Exception {
- callUpdateWithException("unit", "test", "fail");
- }
-
- @Test
- public void testInsertUsesGivenQueryRunner() throws Exception {
- QueryRunner mockQueryRunner = mock(QueryRunner.class
- , org.mockito.Mockito.withSettings().verboseLogging() // debug for Continuum
- );
- runner = new AsyncQueryRunner(Executors.newSingleThreadExecutor(), mockQueryRunner);
-
- runner.insert("1", handler);
- runner.insert("2", handler, "param1");
- runner.insert(conn, "3", handler);
- runner.insert(conn, "4", handler, "param1");
-
- // give the Executor time to submit all insert statements. Otherwise the following verify statements will fail from time to time.
- TimeUnit.MILLISECONDS.sleep(50);
-
- verify(mockQueryRunner).insert("1", handler);
- verify(mockQueryRunner).insert("2", handler, "param1");
- verify(mockQueryRunner).insert(conn, "3", handler);
- verify(mockQueryRunner).insert(conn, "4", handler, "param1");
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullConnectionUpdate() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
- when(dataSource.getConnection()).thenReturn(null);
-
- runner.update("select * from blah where ? = ?", "unit", "test").get();
- }
-
- @Test(expected=ExecutionException.class)
- public void testNullSqlUpdate() throws Exception {
- when(meta.getParameterCount()).thenReturn(2);
-
- runner.update(null).get();
- }
-
- @Test
- public void testExecuteUpdateException() throws Exception {
- doThrow(new SQLException()).when(stmt).executeUpdate();
-
- callUpdateWithException("unit", "test");
- }
-
- //
- // Random tests
- //
- @Test(expected=ExecutionException.class)
- public void testBadPrepareConnection() throws Exception {
- runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
- runner.update("update blah set unit = test").get();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.sql.Connection;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.dbutils.handlers.ArrayHandler;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@SuppressWarnings("boxing") // test code
+public class AsyncQueryRunnerTest {
+ AsyncQueryRunner runner;
+ ArrayHandler handler;
+
+ @Mock DataSource dataSource;
+ @Mock Connection conn;
+ @Mock PreparedStatement stmt;
+ @Mock ParameterMetaData meta;
+ @Mock ResultSet results;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ when(dataSource.getConnection()).thenReturn(conn);
+ when(conn.prepareStatement(any(String.class))).thenReturn(stmt);
+ when(stmt.getParameterMetaData()).thenReturn(meta);
+ when(stmt.getResultSet()).thenReturn(results);
+ when(stmt.executeQuery()).thenReturn(results);
+ when(results.next()).thenReturn(false);
+
+ handler = new ArrayHandler();
+ runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1), new QueryRunner(dataSource));
+ }
+
+ //
+ // Batch test cases
+ //
+ private void callGoodBatch(final Connection conn, final Object[][] params) throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ Future<int[]> future = runner.batch(conn, "select * from blah where ? = ?", params);
+
+ future.get();
+
+ verify(stmt, times(2)).addBatch();
+ verify(stmt, times(1)).executeBatch();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+ }
+
+ private void callGoodBatch(final Object[][] params) throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ Future<int[]> future = runner.batch("select * from blah where ? = ?", params);
+
+ future.get();
+
+ verify(stmt, times(2)).addBatch();
+ verify(stmt, times(1)).executeBatch();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(1)).close(); // make sure we closed the connection
+ }
+
+ @Test
+ public void testGoodBatch() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ callGoodBatch(params);
+ }
+
+ @SuppressWarnings("deprecation") // deliberate test of deprecated code
+ @Test
+ public void testGoodBatchPmdTrue() throws Exception {
+ runner = new AsyncQueryRunner(dataSource, true, Executors.newFixedThreadPool(1));
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ callGoodBatch(params);
+ }
+
+ @Test
+ public void testGoodBatchDefaultConstructor() throws Exception {
+ runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ callGoodBatch(conn, params);
+ }
+
+ @Test
+ public void testNullParamsBatch() throws Exception {
+ String[][] params = new String[][] { { null, "unit" }, { "test", null } };
+
+ callGoodBatch(params);
+ }
+
+
+
+ // helper method for calling batch when an exception is expected
+ private void callBatchWithException(final String sql, final Object[][] params) throws Exception {
+ Future<int[]> future = null;
+ boolean caught = false;
+
+ try {
+ future = runner.batch(sql, params);
+
+ future.get();
+
+ verify(stmt, times(2)).addBatch();
+ verify(stmt, times(1)).executeBatch();
+ verify(stmt, times(1)).close(); // make sure the statement is closed
+ verify(conn, times(1)).close(); // make sure the connection is closed
+ } catch(Exception e) {
+ caught = true;
+ }
+
+ if(!caught) {
+ fail("Exception never thrown, but expected");
+ }
+ }
+
+ @Test
+ public void testTooFewParamsBatch() throws Exception {
+ String[][] params = new String[][] { { "unit" }, { "test" } };
+
+ callBatchWithException("select * from blah where ? = ?", params);
+ }
+
+ @Test
+ public void testTooManyParamsBatch() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit", "unit" }, { "test", "test", "test" } };
+
+ callBatchWithException("select * from blah where ? = ?", params);
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullConnectionBatch() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ when(meta.getParameterCount()).thenReturn(2);
+ when(dataSource.getConnection()).thenReturn(null);
+
+ runner.batch("select * from blah where ? = ?", params).get();
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullSqlBatch() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ when(meta.getParameterCount()).thenReturn(2);
+
+ runner.batch(null, params).get();
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullParamsArgBatch() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+
+ runner.batch("select * from blah where ? = ?", null).get();
+ }
+
+ @Test
+ public void testAddBatchException() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ doThrow(new SQLException()).when(stmt).addBatch();
+
+ callBatchWithException("select * from blah where ? = ?", params);
+ }
+
+ @Test
+ public void testExecuteBatchException() throws Exception {
+ String[][] params = new String[][] { { "unit", "unit" }, { "test", "test" } };
+
+ doThrow(new SQLException()).when(stmt).executeBatch();
+
+ callBatchWithException("select * from blah where ? = ?", params);
+ }
+
+
+ //
+ // Query test cases
+ //
+ private void callGoodQuery(final Connection conn) throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test").get();
+
+ verify(stmt, times(1)).executeQuery();
+ verify(results, times(1)).close();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+
+ // call the other variation of query
+ when(meta.getParameterCount()).thenReturn(0);
+ runner.query(conn, "select * from blah", handler).get();
+
+ verify(stmt, times(2)).executeQuery();
+ verify(results, times(2)).close();
+ verify(stmt, times(2)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+ }
+
+ private void callGoodQuery() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.query("select * from blah where ? = ?", handler, "unit", "test").get();
+
+ verify(stmt, times(1)).executeQuery();
+ verify(results, times(1)).close();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(1)).close(); // make sure we closed the connection
+
+ // call the other variation of query
+ when(meta.getParameterCount()).thenReturn(0);
+ runner.query("select * from blah", handler).get();
+
+ verify(stmt, times(2)).executeQuery();
+ verify(results, times(2)).close();
+ verify(stmt, times(2)).close(); // make sure we closed the statement
+ verify(conn, times(2)).close(); // make sure we closed the connection
+ }
+
+ @Test
+ public void testGoodQuery() throws Exception {
+ callGoodQuery();
+ }
+
+ @SuppressWarnings("deprecation") // deliberate test of deprecated code
+ @Test
+ public void testGoodQueryPmdTrue() throws Exception {
+ runner = new AsyncQueryRunner(true, Executors.newFixedThreadPool(1));
+ callGoodQuery(conn);
+ }
+
+ @Test
+ public void testGoodQueryDefaultConstructor() throws Exception {
+ runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
+ callGoodQuery(conn);
+ }
+
+
+ // helper method for calling batch when an exception is expected
+ private void callQueryWithException(final Object... params) throws Exception {
+ boolean caught = false;
+
+ try {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.query("select * from blah where ? = ?", handler, params).get();
+
+ verify(stmt, times(1)).executeQuery();
+ verify(results, times(1)).close();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(1)).close(); // make sure we closed the connection
+ } catch(Exception e) {
+ caught = true;
+ }
+
+ if(!caught) {
+ fail("Exception never thrown, but expected");
+ }
+ }
+
+ @Test
+ public void testNoParamsQuery() throws Exception {
+ callQueryWithException();
+ }
+
+ @Test
+ public void testTooFewParamsQuery() throws Exception {
+ callQueryWithException("unit");
+ }
+
+ @Test
+ public void testTooManyParamsQuery() throws Exception {
+ callQueryWithException("unit", "test", "fail");
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullConnectionQuery() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ when(dataSource.getConnection()).thenReturn(null);
+
+ runner.query("select * from blah where ? = ?", handler, "unit", "test").get();
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullSqlQuery() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+
+ runner.query(null, handler).get();
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullHandlerQuery() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+
+ runner.query("select * from blah where ? = ?", null).get();
+ }
+
+ @Test
+ public void testExecuteQueryException() throws Exception {
+ doThrow(new SQLException()).when(stmt).executeQuery();
+
+ callQueryWithException(handler, "unit", "test");
+ }
+
+
+ //
+ // Update test cases
+ //
+ private void callGoodUpdate(final Connection conn) throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.update(conn, "update blah set ? = ?", "unit", "test").get();
+
+ verify(stmt, times(1)).executeUpdate();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+
+ // call the other variation
+ when(meta.getParameterCount()).thenReturn(0);
+ runner.update(conn, "update blah set unit = test").get();
+
+ verify(stmt, times(2)).executeUpdate();
+ verify(stmt, times(2)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+
+ // call the other variation
+ when(meta.getParameterCount()).thenReturn(1);
+ runner.update(conn, "update blah set unit = ?", "test").get();
+
+ verify(stmt, times(3)).executeUpdate();
+ verify(stmt, times(3)).close(); // make sure we closed the statement
+ verify(conn, times(0)).close(); // make sure we closed the connection
+ }
+
+ private void callGoodUpdate() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.update("update blah set ? = ?", "unit", "test").get();
+
+ verify(stmt, times(1)).executeUpdate();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(1)).close(); // make sure we closed the connection
+
+ // call the other variation
+ when(meta.getParameterCount()).thenReturn(0);
+ runner.update("update blah set unit = test").get();
+
+ verify(stmt, times(2)).executeUpdate();
+ verify(stmt, times(2)).close(); // make sure we closed the statement
+ verify(conn, times(2)).close(); // make sure we closed the connection
+
+ // call the other variation
+ when(meta.getParameterCount()).thenReturn(1);
+ runner.update("update blah set unit = ?", "test").get();
+
+ verify(stmt, times(3)).executeUpdate();
+ verify(stmt, times(3)).close(); // make sure we closed the statement
+ verify(conn, times(3)).close(); // make sure we closed the connection
+ }
+
+ @Test
+ public void testGoodUpdate() throws Exception {
+ callGoodUpdate();
+ }
+
+ @SuppressWarnings("deprecation") // deliberate test of deprecated code
+ @Test
+ public void testGoodUpdatePmdTrue() throws Exception {
+ runner = new AsyncQueryRunner(true, Executors.newFixedThreadPool(1));
+ callGoodUpdate(conn);
+ }
+
+ @Test
+ public void testGoodUpdateDefaultConstructor() throws Exception {
+ runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
+ callGoodUpdate(conn);
+ }
+
+ // helper method for calling batch when an exception is expected
+ private void callUpdateWithException(final Object... params) throws Exception {
+ boolean caught = false;
+
+ try {
+ when(meta.getParameterCount()).thenReturn(2);
+ runner.update("select * from blah where ? = ?", params).get();
+
+ verify(stmt, times(1)).executeUpdate();
+ verify(stmt, times(1)).close(); // make sure we closed the statement
+ verify(conn, times(1)).close(); // make sure we closed the connection
+ } catch(Exception e) {
+ caught = true;
+ }
+
+ if(!caught) {
+ fail("Exception never thrown, but expected");
+ }
+ }
+
+ @Test
+ public void testNoParamsUpdate() throws Exception {
+ callUpdateWithException();
+ }
+
+ @Test
+ public void testTooFewParamsUpdate() throws Exception {
+ callUpdateWithException("unit");
+ }
+
+ @Test
+ public void testTooManyParamsUpdate() throws Exception {
+ callUpdateWithException("unit", "test", "fail");
+ }
+
+ @Test
+ public void testInsertUsesGivenQueryRunner() throws Exception {
+ QueryRunner mockQueryRunner = mock(QueryRunner.class
+ , org.mockito.Mockito.withSettings().verboseLogging() // debug for Continuum
+ );
+ runner = new AsyncQueryRunner(Executors.newSingleThreadExecutor(), mockQueryRunner);
+
+ runner.insert("1", handler);
+ runner.insert("2", handler, "param1");
+ runner.insert(conn, "3", handler);
+ runner.insert(conn, "4", handler, "param1");
+
+ // give the Executor time to submit all insert statements. Otherwise the following verify statements will fail from time to time.
+ TimeUnit.MILLISECONDS.sleep(50);
+
+ verify(mockQueryRunner).insert("1", handler);
+ verify(mockQueryRunner).insert("2", handler, "param1");
+ verify(mockQueryRunner).insert(conn, "3", handler);
+ verify(mockQueryRunner).insert(conn, "4", handler, "param1");
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullConnectionUpdate() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+ when(dataSource.getConnection()).thenReturn(null);
+
+ runner.update("select * from blah where ? = ?", "unit", "test").get();
+ }
+
+ @Test(expected=ExecutionException.class)
+ public void testNullSqlUpdate() throws Exception {
+ when(meta.getParameterCount()).thenReturn(2);
+
+ runner.update(null).get();
+ }
+
+ @Test
+ public void testExecuteUpdateException() throws Exception {
+ doThrow(new SQLException()).when(stmt).executeUpdate();
+
+ callUpdateWithException("unit", "test");
+ }
+
+ //
+ // Random tests
+ //
+ @Test(expected=ExecutionException.class)
+ public void testBadPrepareConnection() throws Exception {
+ runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
+ runner.update("update blah set unit = test").get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java b/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
index cb591a2..e1606e4 100644
--- a/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
+++ b/src/test/java/org/apache/commons/dbutils/BeanProcessorTest.java
@@ -71,7 +71,7 @@ public class BeanProcessorTest extends BaseTestCase {
return one;
}
- public void setOne(String one) {
+ public void setOne(final String one) {
this.one = one;
}
@@ -79,7 +79,7 @@ public class BeanProcessorTest extends BaseTestCase {
return two;
}
- public void setTwo(String two) {
+ public void setTwo(final String two) {
this.two = two;
}
@@ -87,7 +87,7 @@ public class BeanProcessorTest extends BaseTestCase {
return three;
}
- public void setThree(String three) {
+ public void setThree(final String three) {
this.three = three;
}
@@ -95,7 +95,7 @@ public class BeanProcessorTest extends BaseTestCase {
return four;
}
- public void setFour(String four) {
+ public void setFour(final String four) {
this.four = four;
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/GenerousBeanProcessorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/GenerousBeanProcessorTest.java b/src/test/java/org/apache/commons/dbutils/GenerousBeanProcessorTest.java
index 2013627..24a5639 100644
--- a/src/test/java/org/apache/commons/dbutils/GenerousBeanProcessorTest.java
+++ b/src/test/java/org/apache/commons/dbutils/GenerousBeanProcessorTest.java
@@ -1,156 +1,156 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.dbutils;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.beans.PropertyDescriptor;
-import java.sql.ResultSetMetaData;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Mockito.when;
-
-
-public class GenerousBeanProcessorTest {
-
- GenerousBeanProcessor processor = new GenerousBeanProcessor();
- @Mock ResultSetMetaData metaData;
- PropertyDescriptor[] propDescriptors;
-
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
-
- propDescriptors = new PropertyDescriptor[3];
-
- propDescriptors[0] = new PropertyDescriptor("one", TestBean.class);
- propDescriptors[1] = new PropertyDescriptor("two", TestBean.class);
- propDescriptors[2] = new PropertyDescriptor("three", TestBean.class);
- }
-
- @SuppressWarnings("boxing") // test code
- @Test
- public void testMapColumnsToPropertiesWithOutUnderscores() throws Exception {
- when(metaData.getColumnCount()).thenReturn(3);
-
- when(metaData.getColumnLabel(1)).thenReturn("three");
- when(metaData.getColumnLabel(2)).thenReturn("one");
- when(metaData.getColumnLabel(3)).thenReturn("two");
-
- int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
-
- assertNotNull(ret);
- assertEquals(4, ret.length);
- assertEquals(-1, ret[0]);
- assertEquals(2, ret[1]);
- assertEquals(0, ret[2]);
- assertEquals(1, ret[3]);
- }
-
- @SuppressWarnings("boxing") // test code
- @Test
- public void testMapColumnsToPropertiesMixedCase() throws Exception {
- when(metaData.getColumnCount()).thenReturn(3);
-
- when(metaData.getColumnLabel(1)).thenReturn("tHree");
- when(metaData.getColumnLabel(2)).thenReturn("One");
- when(metaData.getColumnLabel(3)).thenReturn("tWO");
-
- int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
-
- assertNotNull(ret);
- assertEquals(4, ret.length);
- assertEquals(-1, ret[0]);
- assertEquals(2, ret[1]);
- assertEquals(0, ret[2]);
- assertEquals(1, ret[3]);
- }
-
- @SuppressWarnings("boxing") // test code
- @Test
- public void testMapColumnsToPropertiesWithUnderscores() throws Exception {
- when(metaData.getColumnCount()).thenReturn(3);
-
- when(metaData.getColumnLabel(1)).thenReturn("t_h_r_e_e");
- when(metaData.getColumnLabel(2)).thenReturn("o_n_e");
- when(metaData.getColumnLabel(3)).thenReturn("t_w_o");
-
- int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
-
- assertNotNull(ret);
- assertEquals(4, ret.length);
- assertEquals(-1, ret[0]);
- assertEquals(2, ret[1]);
- assertEquals(0, ret[2]);
- assertEquals(1, ret[3]);
- }
-
- @SuppressWarnings("boxing") // test code
- @Test
- public void testMapColumnsToPropertiesColumnLabelIsNull() throws Exception {
- when(metaData.getColumnCount()).thenReturn(1);
- when(metaData.getColumnName(1)).thenReturn("juhu");
-
- when(metaData.getColumnLabel(1)).thenReturn(null);
- when(metaData.getColumnLabel(2)).thenReturn("One");
- when(metaData.getColumnLabel(3)).thenReturn("tWO");
-
- int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
-
- assertNotNull(ret);
- assertEquals(2, ret.length);
- assertEquals(-1, ret[0]);
- assertEquals(-1, ret[1]);
- assertEquals(-1, ret[1]);
- assertEquals(-1, ret[1]);
- }
-
- static class TestBean {
- private String one;
- private int two;
- private long three;
-
- public String getOne() {
- return one;
- }
-
- public void setOne(String one) {
- this.one = one;
- }
-
- public int getTwo() {
- return two;
- }
-
- public void setTwo(int two) {
- this.two = two;
- }
-
- public long getThree() {
- return three;
- }
-
- public void setThree(long three) {
- this.three = three;
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.beans.PropertyDescriptor;
+import java.sql.ResultSetMetaData;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.when;
+
+
+public class GenerousBeanProcessorTest {
+
+ GenerousBeanProcessor processor = new GenerousBeanProcessor();
+ @Mock ResultSetMetaData metaData;
+ PropertyDescriptor[] propDescriptors;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+
+ propDescriptors = new PropertyDescriptor[3];
+
+ propDescriptors[0] = new PropertyDescriptor("one", TestBean.class);
+ propDescriptors[1] = new PropertyDescriptor("two", TestBean.class);
+ propDescriptors[2] = new PropertyDescriptor("three", TestBean.class);
+ }
+
+ @SuppressWarnings("boxing") // test code
+ @Test
+ public void testMapColumnsToPropertiesWithOutUnderscores() throws Exception {
+ when(metaData.getColumnCount()).thenReturn(3);
+
+ when(metaData.getColumnLabel(1)).thenReturn("three");
+ when(metaData.getColumnLabel(2)).thenReturn("one");
+ when(metaData.getColumnLabel(3)).thenReturn("two");
+
+ int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
+
+ assertNotNull(ret);
+ assertEquals(4, ret.length);
+ assertEquals(-1, ret[0]);
+ assertEquals(2, ret[1]);
+ assertEquals(0, ret[2]);
+ assertEquals(1, ret[3]);
+ }
+
+ @SuppressWarnings("boxing") // test code
+ @Test
+ public void testMapColumnsToPropertiesMixedCase() throws Exception {
+ when(metaData.getColumnCount()).thenReturn(3);
+
+ when(metaData.getColumnLabel(1)).thenReturn("tHree");
+ when(metaData.getColumnLabel(2)).thenReturn("One");
+ when(metaData.getColumnLabel(3)).thenReturn("tWO");
+
+ int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
+
+ assertNotNull(ret);
+ assertEquals(4, ret.length);
+ assertEquals(-1, ret[0]);
+ assertEquals(2, ret[1]);
+ assertEquals(0, ret[2]);
+ assertEquals(1, ret[3]);
+ }
+
+ @SuppressWarnings("boxing") // test code
+ @Test
+ public void testMapColumnsToPropertiesWithUnderscores() throws Exception {
+ when(metaData.getColumnCount()).thenReturn(3);
+
+ when(metaData.getColumnLabel(1)).thenReturn("t_h_r_e_e");
+ when(metaData.getColumnLabel(2)).thenReturn("o_n_e");
+ when(metaData.getColumnLabel(3)).thenReturn("t_w_o");
+
+ int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
+
+ assertNotNull(ret);
+ assertEquals(4, ret.length);
+ assertEquals(-1, ret[0]);
+ assertEquals(2, ret[1]);
+ assertEquals(0, ret[2]);
+ assertEquals(1, ret[3]);
+ }
+
+ @SuppressWarnings("boxing") // test code
+ @Test
+ public void testMapColumnsToPropertiesColumnLabelIsNull() throws Exception {
+ when(metaData.getColumnCount()).thenReturn(1);
+ when(metaData.getColumnName(1)).thenReturn("juhu");
+
+ when(metaData.getColumnLabel(1)).thenReturn(null);
+ when(metaData.getColumnLabel(2)).thenReturn("One");
+ when(metaData.getColumnLabel(3)).thenReturn("tWO");
+
+ int[] ret = processor.mapColumnsToProperties(metaData, propDescriptors);
+
+ assertNotNull(ret);
+ assertEquals(2, ret.length);
+ assertEquals(-1, ret[0]);
+ assertEquals(-1, ret[1]);
+ assertEquals(-1, ret[1]);
+ assertEquals(-1, ret[1]);
+ }
+
+ static class TestBean {
+ private String one;
+ private int two;
+ private long three;
+
+ public String getOne() {
+ return one;
+ }
+
+ public void setOne(final String one) {
+ this.one = one;
+ }
+
+ public int getTwo() {
+ return two;
+ }
+
+ public void setTwo(final int two) {
+ this.two = two;
+ }
+
+ public long getThree() {
+ return three;
+ }
+
+ public void setThree(final long three) {
+ this.three = three;
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/MockResultSet.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/MockResultSet.java b/src/test/java/org/apache/commons/dbutils/MockResultSet.java
index e1d2e49..c89b5bd 100644
--- a/src/test/java/org/apache/commons/dbutils/MockResultSet.java
+++ b/src/test/java/org/apache/commons/dbutils/MockResultSet.java
@@ -40,8 +40,8 @@ public class MockResultSet implements InvocationHandler {
* @param metaData
* @param rows A null value indicates an empty <code>ResultSet</code>.
*/
- public static ResultSet create(ResultSetMetaData metaData,
- Object[][] rows) {
+ public static ResultSet create(final ResultSetMetaData metaData,
+ final Object[][] rows) {
return ProxyFactory.instance().createResultSet(
new MockResultSet(metaData, rows));
}
@@ -59,7 +59,7 @@ public class MockResultSet implements InvocationHandler {
* @param metaData
* @param rows A null value indicates an empty <code>ResultSet</code>.
*/
- public MockResultSet(ResultSetMetaData metaData, Object[][] rows) {
+ public MockResultSet(final ResultSetMetaData metaData, final Object[][] rows) {
super();
this.metaData = metaData;
if (rows == null) {
@@ -78,7 +78,7 @@ public class MockResultSet implements InvocationHandler {
* @return A column index.
* @throws SQLException if a database access error occurs
*/
- private int columnIndex(Object[] args) throws SQLException {
+ private int columnIndex(final Object[] args) throws SQLException {
if (args[0] instanceof Integer) {
return ((Integer) args[0]).intValue();
@@ -96,7 +96,7 @@ public class MockResultSet implements InvocationHandler {
* @return A 1 based index
* @throws SQLException if the column name is invalid
*/
- private int columnNameToIndex(String columnName) throws SQLException {
+ private int columnNameToIndex(final String columnName) throws SQLException {
for (int i = 0; i < this.currentRow.length; i++) {
int c = i + 1;
if (this.metaData.getColumnName(c).equalsIgnoreCase(columnName)) {
@@ -112,7 +112,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getBoolean(int columnIndex) throws SQLException {
+ protected Object getBoolean(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -131,7 +131,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getByte(int columnIndex) throws SQLException {
+ protected Object getByte(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -150,7 +150,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getDouble(int columnIndex) throws SQLException {
+ protected Object getDouble(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -169,7 +169,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getFloat(int columnIndex) throws SQLException {
+ protected Object getFloat(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -186,7 +186,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getInt(int columnIndex) throws SQLException {
+ protected Object getInt(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -205,7 +205,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getLong(int columnIndex) throws SQLException {
+ protected Object getLong(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -229,7 +229,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getObject(int columnIndex) throws SQLException {
+ protected Object getObject(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
return obj;
@@ -240,7 +240,7 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected Object getShort(int columnIndex) throws SQLException {
+ protected Object getShort(final int columnIndex) throws SQLException {
Object obj = this.currentRow[columnIndex - 1];
this.setWasNull(obj);
@@ -259,14 +259,14 @@ public class MockResultSet implements InvocationHandler {
* @param columnIndex A 1 based index.
* @throws SQLException if a database access error occurs
*/
- protected String getString(int columnIndex) throws SQLException {
+ protected String getString(final int columnIndex) throws SQLException {
Object obj = this.getObject(columnIndex);
this.setWasNull(obj);
return (obj == null) ? null : obj.toString();
}
@Override
- public Object invoke(Object proxy, Method method, Object[] args)
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
String methodName = method.getName();
@@ -350,7 +350,7 @@ public class MockResultSet implements InvocationHandler {
* Assigns this.wasNull a Boolean value based on the object passed in.
* @param isNull
*/
- private void setWasNull(Object isNull) {
+ private void setWasNull(final Object isNull) {
this.wasNull = (isNull == null) ? Boolean.TRUE : Boolean.FALSE;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/MockResultSetMetaData.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/MockResultSetMetaData.java b/src/test/java/org/apache/commons/dbutils/MockResultSetMetaData.java
index 2e02807..92e4f29 100644
--- a/src/test/java/org/apache/commons/dbutils/MockResultSetMetaData.java
+++ b/src/test/java/org/apache/commons/dbutils/MockResultSetMetaData.java
@@ -39,19 +39,19 @@ public class MockResultSetMetaData implements InvocationHandler {
* @param columnNames
* @return the proxy object
*/
- public static ResultSetMetaData create(String[] columnNames) {
+ public static ResultSetMetaData create(final String[] columnNames) {
return ProxyFactory.instance().createResultSetMetaData(
new MockResultSetMetaData(columnNames));
}
- public MockResultSetMetaData(String[] columnNames) {
+ public MockResultSetMetaData(final String[] columnNames) {
super();
this.columnNames = columnNames;
this.columnLabels = new String[columnNames.length];
}
- public MockResultSetMetaData(String[] columnNames, String[] columnLabels) {
+ public MockResultSetMetaData(final String[] columnNames, final String[] columnLabels) {
super();
this.columnNames = columnNames;
this.columnLabels = columnLabels;
@@ -59,7 +59,7 @@ public class MockResultSetMetaData implements InvocationHandler {
}
@Override
- public Object invoke(Object proxy, Method method, Object[] args)
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
String methodName = method.getName();
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/ProxyFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/ProxyFactoryTest.java b/src/test/java/org/apache/commons/dbutils/ProxyFactoryTest.java
index 9466e2f..ac91392 100644
--- a/src/test/java/org/apache/commons/dbutils/ProxyFactoryTest.java
+++ b/src/test/java/org/apache/commons/dbutils/ProxyFactoryTest.java
@@ -28,7 +28,7 @@ public class ProxyFactoryTest extends BaseTestCase {
private static final InvocationHandler stub = new InvocationHandler() {
@Override
- public Object invoke(Object proxy, Method method, Object[] args)
+ public Object invoke(final Object proxy, final Method method, final Object[] args)
throws Throwable {
return null;
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java b/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
index ec8778c..f95ac95 100644
--- a/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
+++ b/src/test/java/org/apache/commons/dbutils/QueryRunnerTest.java
@@ -86,7 +86,7 @@ public class QueryRunnerTest {
// Batch test cases
//
- private void callGoodBatch(Connection conn, Object[][] params) throws Exception {
+ private void callGoodBatch(final Connection conn, final Object[][] params) throws Exception {
when(meta.getParameterCount()).thenReturn(2);
runner.batch(conn, "select * from blah where ? = ?", params);
@@ -96,7 +96,7 @@ public class QueryRunnerTest {
verify(conn, times(0)).close(); // make sure we do not close the connection, since QueryRunner.batch(Connection, String, Object[][]) does not close connections
}
- private void callGoodBatch(Object[][] params) throws Exception {
+ private void callGoodBatch(final Object[][] params) throws Exception {
when(meta.getParameterCount()).thenReturn(2);
runner.batch("select * from blah where ? = ?", params);
@@ -139,7 +139,7 @@ public class QueryRunnerTest {
// helper method for calling batch when an exception is expected
- private void callBatchWithException(String sql, Object[][] params) throws Exception {
+ private void callBatchWithException(final String sql, final Object[][] params) throws Exception {
boolean caught = false;
try {
@@ -220,7 +220,7 @@ public class QueryRunnerTest {
//
// Query test cases
//
- private void callGoodQuery(Connection conn) throws Exception {
+ private void callGoodQuery(final Connection conn) throws Exception {
when(meta.getParameterCount()).thenReturn(2);
runner.query(conn, "select * from blah where ? = ?", handler, "unit", "test");
@@ -277,7 +277,7 @@ public class QueryRunnerTest {
// helper method for calling batch when an exception is expected
- private void callQueryWithException(Object... params) throws Exception {
+ private void callQueryWithException(final Object... params) throws Exception {
boolean caught = false;
try {
@@ -346,7 +346,7 @@ public class QueryRunnerTest {
//
// Update test cases
//
- private void callGoodUpdate(Connection conn) throws Exception {
+ private void callGoodUpdate(final Connection conn) throws Exception {
when(meta.getParameterCount()).thenReturn(2);
runner.update(conn, "update blah set ? = ?", "unit", "test");
@@ -447,7 +447,7 @@ public class QueryRunnerTest {
ResultSetHandler<List<Object>> handler = new ResultSetHandler<List<Object>>()
{
@Override
- public List<Object> handle(ResultSet rs) throws SQLException
+ public List<Object> handle(final ResultSet rs) throws SQLException
{
List<Object> objects = new ArrayList<>();
while (rs.next())
@@ -475,7 +475,7 @@ public class QueryRunnerTest {
}
// helper method for calling batch when an exception is expected
- private void callUpdateWithException(Object... params) throws Exception {
+ private void callUpdateWithException(final Object... params) throws Exception {
boolean caught = false;
try {
@@ -547,7 +547,7 @@ public class QueryRunnerTest {
//
// Execute tests
//
- private void callGoodExecute(Connection conn) throws Exception {
+ private void callGoodExecute(final Connection conn) throws Exception {
when(call.execute()).thenReturn(false);
when(call.getUpdateCount()).thenReturn(3);
@@ -701,7 +701,7 @@ public class QueryRunnerTest {
}
// helper method for calling execute when an exception is expected
- private void callExecuteWithException(Object... params) throws Exception {
+ private void callExecuteWithException(final Object... params) throws Exception {
boolean caught = false;
try {
@@ -773,7 +773,7 @@ public class QueryRunnerTest {
{
int count = 1;
@Override
- public Boolean answer(InvocationOnMock invocation)
+ public Boolean answer(final InvocationOnMock invocation)
{
return ++count <= 3;
}
@@ -789,7 +789,7 @@ public class QueryRunnerTest {
}
- private void callGoodExecuteWithResultSet(Connection conn) throws Exception {
+ private void callGoodExecuteWithResultSet(final Connection conn) throws Exception {
when(call.execute()).thenReturn(true);
when(meta.getParameterCount()).thenReturn(2);
@@ -937,7 +937,7 @@ public class QueryRunnerTest {
}
// helper method for calling execute when an exception is expected
- private void callExecuteWithResultSetWithException(Object... params) throws Exception {
+ private void callExecuteWithResultSetWithException(final Object... params) throws Exception {
boolean caught = false;
try {
@@ -1007,11 +1007,11 @@ public class QueryRunnerTest {
private String c;
public int getA() { return a; }
- public void setA(int a) { this.a = a; }
+ public void setA(final int a) { this.a = a; }
public double getB() { return b; }
- public void setB(double b) { this.b = b; }
+ public void setB(final double b) { this.b = b; }
public String getC() { return c; }
- public void setC(String c) { this.c = c; }
+ public void setC(final String c) { this.c = c; }
}
@Test
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/TestBean.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/TestBean.java b/src/test/java/org/apache/commons/dbutils/TestBean.java
index 3372ddf..406994e 100644
--- a/src/test/java/org/apache/commons/dbutils/TestBean.java
+++ b/src/test/java/org/apache/commons/dbutils/TestBean.java
@@ -1,156 +1,156 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.dbutils;
-
-/**
- * A bean to use in testing toBean() and toBeanList().
- */
-public class TestBean {
-
- public enum Ordinal {
-
- THREE, SIX;
-
- }
-
- private String one = null;
-
- private String two = null;
-
- private Ordinal three = null;
-
- private int intTest = 0;
-
- private Integer integerTest = Integer.valueOf(0);
-
- // UNUSED private Timestamp timestamp = null;
-
- private String doNotSet = "not set";
-
- /**
- * toBean() should set primitive fields to their defaults (ie. 0) when
- * null is returned from the ResultSet.
- */
- private int nullPrimitiveTest = 7;
-
- /**
- * toBean() should set Object fields to null when null is returned from the
- * ResultSet
- */
- private Object nullObjectTest = "overwrite";
-
- /**
- * A Date will be returned from the ResultSet but the property is a String.
- * BeanProcessor should create a String from the Date and set this property.
- */
- private String notDate = "not a date";
-
- /**
- * The ResultSet will have a BigDecimal in this column and the
- * BasicColumnProcessor should convert that to a double and store the value
- * in this property.
- */
- private double columnProcessorDoubleTest = -1;
-
- /**
- * Constructor for TestBean.
- */
- public TestBean() {
- super();
- }
-
- public String getOne() {
- return one;
- }
-
- public Ordinal getThree() {
- return three;
- }
-
- public String getTwo() {
- return two;
- }
-
- public void setOne(String string) {
- one = string;
- }
-
- public void setThree(Ordinal ordinal) {
- three = ordinal;
- }
-
- public void setTwo(String string) {
- two = string;
- }
-
- public String getDoNotSet() {
- return doNotSet;
- }
-
- public void setDoNotSet(String string) {
- doNotSet = string;
- }
-
- public Integer getIntegerTest() {
- return integerTest;
- }
-
- public int getIntTest() {
- return intTest;
- }
-
- public void setIntegerTest(Integer integer) {
- integerTest = integer;
- }
-
- public void setIntTest(int i) {
- intTest = i;
- }
-
- public Object getNullObjectTest() {
- return nullObjectTest;
- }
-
- public int getNullPrimitiveTest() {
- return nullPrimitiveTest;
- }
-
- public void setNullObjectTest(Object object) {
- nullObjectTest = object;
- }
-
- public void setNullPrimitiveTest(int i) {
- nullPrimitiveTest = i;
- }
-
- public String getNotDate() {
- return notDate;
- }
-
- public void setNotDate(String string) {
- notDate = string;
- }
-
- public double getColumnProcessorDoubleTest() {
- return columnProcessorDoubleTest;
- }
-
- public void setColumnProcessorDoubleTest(double d) {
- columnProcessorDoubleTest = d;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.dbutils;
+
+/**
+ * A bean to use in testing toBean() and toBeanList().
+ */
+public class TestBean {
+
+ public enum Ordinal {
+
+ THREE, SIX;
+
+ }
+
+ private String one = null;
+
+ private String two = null;
+
+ private Ordinal three = null;
+
+ private int intTest = 0;
+
+ private Integer integerTest = Integer.valueOf(0);
+
+ // UNUSED private Timestamp timestamp = null;
+
+ private String doNotSet = "not set";
+
+ /**
+ * toBean() should set primitive fields to their defaults (ie. 0) when
+ * null is returned from the ResultSet.
+ */
+ private int nullPrimitiveTest = 7;
+
+ /**
+ * toBean() should set Object fields to null when null is returned from the
+ * ResultSet
+ */
+ private Object nullObjectTest = "overwrite";
+
+ /**
+ * A Date will be returned from the ResultSet but the property is a String.
+ * BeanProcessor should create a String from the Date and set this property.
+ */
+ private String notDate = "not a date";
+
+ /**
+ * The ResultSet will have a BigDecimal in this column and the
+ * BasicColumnProcessor should convert that to a double and store the value
+ * in this property.
+ */
+ private double columnProcessorDoubleTest = -1;
+
+ /**
+ * Constructor for TestBean.
+ */
+ public TestBean() {
+ super();
+ }
+
+ public String getOne() {
+ return one;
+ }
+
+ public Ordinal getThree() {
+ return three;
+ }
+
+ public String getTwo() {
+ return two;
+ }
+
+ public void setOne(final String string) {
+ one = string;
+ }
+
+ public void setThree(final Ordinal ordinal) {
+ three = ordinal;
+ }
+
+ public void setTwo(final String string) {
+ two = string;
+ }
+
+ public String getDoNotSet() {
+ return doNotSet;
+ }
+
+ public void setDoNotSet(final String string) {
+ doNotSet = string;
+ }
+
+ public Integer getIntegerTest() {
+ return integerTest;
+ }
+
+ public int getIntTest() {
+ return intTest;
+ }
+
+ public void setIntegerTest(final Integer integer) {
+ integerTest = integer;
+ }
+
+ public void setIntTest(final int i) {
+ intTest = i;
+ }
+
+ public Object getNullObjectTest() {
+ return nullObjectTest;
+ }
+
+ public int getNullPrimitiveTest() {
+ return nullPrimitiveTest;
+ }
+
+ public void setNullObjectTest(final Object object) {
+ nullObjectTest = object;
+ }
+
+ public void setNullPrimitiveTest(final int i) {
+ nullPrimitiveTest = i;
+ }
+
+ public String getNotDate() {
+ return notDate;
+ }
+
+ public void setNotDate(final String string) {
+ notDate = string;
+ }
+
+ public double getColumnProcessorDoubleTest() {
+ return columnProcessorDoubleTest;
+ }
+
+ public void setColumnProcessorDoubleTest(final double d) {
+ columnProcessorDoubleTest = d;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
index 35b6f10..378eade 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/ColumnHandlerTestBase.java
@@ -32,7 +32,7 @@ public abstract class ColumnHandlerTestBase {
protected final ColumnHandler handler;
protected final Class<?> matchingType;
- public ColumnHandlerTestBase(ColumnHandler handler, Class<?> matchingType) {
+ public ColumnHandlerTestBase(final ColumnHandler handler, final Class<?> matchingType) {
this.handler = handler;
this.matchingType = matchingType;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java b/src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
index f36d0a0..db4e69d 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/columns/TestColumnHandler.java
@@ -24,12 +24,12 @@ import org.apache.commons.dbutils.ColumnHandler;
public class TestColumnHandler implements ColumnHandler {
@Override
- public boolean match(Class<?> propType) {
+ public boolean match(final Class<?> propType) {
return false;
}
@Override
- public Object apply(ResultSet rs, int columnIndex) throws SQLException {
+ public Object apply(final ResultSet rs, final int columnIndex) throws SQLException {
return null;
}
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java b/src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
index c6344b3..99a0d27 100644
--- a/src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
+++ b/src/test/java/org/apache/commons/dbutils/handlers/properties/TestPropertyHandler.java
@@ -21,12 +21,12 @@ import org.apache.commons.dbutils.PropertyHandler;
public class TestPropertyHandler implements PropertyHandler {
@Override
- public boolean match(Class<?> parameter, Object value) {
+ public boolean match(final Class<?> parameter, final Object value) {
return false;
}
@Override
- public Object apply(Class<?> parameter, Object value) {
+ public Object apply(final Class<?> parameter, final Object value) {
return null;
}
}
[4/4] commons-dbutils git commit: Add final modifier to method
parameters.
Posted by gg...@apache.org.
Add final modifier to method parameters.
Project: http://git-wip-us.apache.org/repos/asf/commons-dbutils/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-dbutils/commit/41e682d6
Tree: http://git-wip-us.apache.org/repos/asf/commons-dbutils/tree/41e682d6
Diff: http://git-wip-us.apache.org/repos/asf/commons-dbutils/diff/41e682d6
Branch: refs/heads/master
Commit: 41e682d63b661a70cf7e7f3249c6c5b60b83eb48
Parents: b5114a8
Author: Gary Gregory <ga...@gmail.com>
Authored: Sun May 6 10:20:15 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Sun May 6 10:20:15 2018 -0600
----------------------------------------------------------------------
.../commons/dbutils/AbstractQueryRunner.java | 46 +-
.../commons/dbutils/AsyncQueryRunner.java | 18 +-
.../commons/dbutils/BaseResultSetHandler.java | 312 +--
.../commons/dbutils/BasicRowProcessor.java | 24 +-
.../apache/commons/dbutils/BeanProcessor.java | 34 +-
.../org/apache/commons/dbutils/DbUtils.java | 46 +-
.../apache/commons/dbutils/OutParameter.java | 10 +-
.../apache/commons/dbutils/ProxyFactory.java | 16 +-
.../org/apache/commons/dbutils/QueryLoader.java | 6 +-
.../org/apache/commons/dbutils/QueryRunner.java | 80 +-
.../commons/dbutils/ResultSetIterator.java | 6 +-
.../commons/dbutils/StatementConfiguration.java | 4 +-
.../dbutils/handlers/AbstractKeyedHandler.java | 2 +-
.../dbutils/handlers/AbstractListHandler.java | 2 +-
.../commons/dbutils/handlers/ArrayHandler.java | 4 +-
.../dbutils/handlers/ArrayListHandler.java | 4 +-
.../commons/dbutils/handlers/BeanHandler.java | 6 +-
.../dbutils/handlers/BeanListHandler.java | 6 +-
.../dbutils/handlers/BeanMapHandler.java | 16 +-
.../dbutils/handlers/ColumnListHandler.java | 8 +-
.../commons/dbutils/handlers/KeyedHandler.java | 14 +-
.../commons/dbutils/handlers/MapHandler.java | 4 +-
.../dbutils/handlers/MapListHandler.java | 4 +-
.../commons/dbutils/handlers/ScalarHandler.java | 8 +-
.../handlers/columns/BooleanColumnHandler.java | 4 +-
.../handlers/columns/ByteColumnHandler.java | 4 +-
.../handlers/columns/DoubleColumnHandler.java | 4 +-
.../handlers/columns/FloatColumnHandler.java | 4 +-
.../handlers/columns/IntegerColumnHandler.java | 4 +-
.../handlers/columns/LongColumnHandler.java | 4 +-
.../handlers/columns/SQLXMLColumnHandler.java | 4 +-
.../handlers/columns/ShortColumnHandler.java | 4 +-
.../handlers/columns/StringColumnHandler.java | 4 +-
.../columns/TimestampColumnHandler.java | 4 +-
.../properties/DatePropertyHandler.java | 4 +-
.../properties/StringEnumPropertyHandler.java | 4 +-
.../wrappers/SqlNullCheckedResultSet.java | 48 +-
.../wrappers/StringTrimmedResultSet.java | 6 +-
.../commons/dbutils/AsyncQueryRunnerTest.java | 992 ++++-----
.../commons/dbutils/BeanProcessorTest.java | 8 +-
.../dbutils/GenerousBeanProcessorTest.java | 312 +--
.../apache/commons/dbutils/MockResultSet.java | 32 +-
.../commons/dbutils/MockResultSetMetaData.java | 8 +-
.../commons/dbutils/ProxyFactoryTest.java | 2 +-
.../apache/commons/dbutils/QueryRunnerTest.java | 32 +-
.../org/apache/commons/dbutils/TestBean.java | 312 +--
.../handlers/columns/ColumnHandlerTestBase.java | 2 +-
.../handlers/columns/TestColumnHandler.java | 4 +-
.../properties/TestPropertyHandler.java | 4 +-
.../wrappers/SqlNullCheckedResultSetTest.java | 2044 +++++++++---------
50 files changed, 2267 insertions(+), 2267 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java b/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
index aae9b45..2ed174e 100644
--- a/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java
@@ -76,7 +76,7 @@ public abstract class AbstractQueryRunner {
* it; if false, we'll try it, and if it breaks, we'll remember
* not to use it again.
*/
- public AbstractQueryRunner(boolean pmdKnownBroken) {
+ public AbstractQueryRunner(final boolean pmdKnownBroken) {
this.pmdKnownBroken = pmdKnownBroken;
ds = null;
this.stmtConfig = null;
@@ -90,7 +90,7 @@ public abstract class AbstractQueryRunner {
* @param ds
* The <code>DataSource</code> to retrieve connections from.
*/
- public AbstractQueryRunner(DataSource ds) {
+ public AbstractQueryRunner(final DataSource ds) {
this.ds = ds;
this.stmtConfig = null;
}
@@ -110,7 +110,7 @@ public abstract class AbstractQueryRunner {
* it; if false, we'll try it, and if it breaks, we'll remember
* not to use it again.
*/
- public AbstractQueryRunner(DataSource ds, boolean pmdKnownBroken) {
+ public AbstractQueryRunner(final DataSource ds, final boolean pmdKnownBroken) {
this.pmdKnownBroken = pmdKnownBroken;
this.ds = ds;
this.stmtConfig = null;
@@ -127,7 +127,7 @@ public abstract class AbstractQueryRunner {
* and if it breaks, we'll remember not to use it again.
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public AbstractQueryRunner(DataSource ds, boolean pmdKnownBroken, StatementConfiguration stmtConfig) {
+ public AbstractQueryRunner(final DataSource ds, final boolean pmdKnownBroken, final StatementConfiguration stmtConfig) {
this.pmdKnownBroken = pmdKnownBroken;
this.ds = ds;
this.stmtConfig = stmtConfig;
@@ -142,7 +142,7 @@ public abstract class AbstractQueryRunner {
* @param ds The <code>DataSource</code> to retrieve connections from.
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public AbstractQueryRunner(DataSource ds, StatementConfiguration stmtConfig) {
+ public AbstractQueryRunner(final DataSource ds, final StatementConfiguration stmtConfig) {
this.ds = ds;
this.stmtConfig = stmtConfig;
}
@@ -153,7 +153,7 @@ public abstract class AbstractQueryRunner {
*
* @param stmtConfig The configuration to apply to statements when they are prepared.
*/
- public AbstractQueryRunner(StatementConfiguration stmtConfig) {
+ public AbstractQueryRunner(final StatementConfiguration stmtConfig) {
this.ds = null;
this.stmtConfig = stmtConfig;
}
@@ -169,7 +169,7 @@ public abstract class AbstractQueryRunner {
* if a database access error occurs
* @since DbUtils 1.1
*/
- protected void close(Connection conn) throws SQLException {
+ protected void close(final Connection conn) throws SQLException {
DbUtils.close(conn);
}
@@ -184,7 +184,7 @@ public abstract class AbstractQueryRunner {
* if a database access error occurs
* @since DbUtils 1.1
*/
- protected void close(ResultSet rs) throws SQLException {
+ protected void close(final ResultSet rs) throws SQLException {
DbUtils.close(rs);
}
@@ -199,7 +199,7 @@ public abstract class AbstractQueryRunner {
* if a database access error occurs
* @since DbUtils 1.1
*/
- protected void close(Statement stmt) throws SQLException {
+ protected void close(final Statement stmt) throws SQLException {
DbUtils.close(stmt);
}
@@ -209,7 +209,7 @@ public abstract class AbstractQueryRunner {
* @param conn Connection to close.
* @since 2.0
*/
- protected void closeQuietly(Connection conn) {
+ protected void closeQuietly(final Connection conn) {
DbUtils.closeQuietly(conn);
}
@@ -219,7 +219,7 @@ public abstract class AbstractQueryRunner {
* @param rs ResultSet to close.
* @since 2.0
*/
- protected void closeQuietly(ResultSet rs) {
+ protected void closeQuietly(final ResultSet rs) {
DbUtils.closeQuietly(rs);
}
@@ -229,11 +229,11 @@ public abstract class AbstractQueryRunner {
* @param statement ResultSet to close.
* @since 2.0
*/
- protected void closeQuietly(Statement statement) {
+ protected void closeQuietly(final Statement statement) {
DbUtils.closeQuietly(statement);
}
- private void configureStatement(Statement stmt) throws SQLException {
+ private void configureStatement(final Statement stmt) throws SQLException {
if (stmtConfig != null) {
if (stmtConfig.isFetchDirectionSet()) {
@@ -270,7 +270,7 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* if a database access error occurs
*/
- public void fillStatement(PreparedStatement stmt, Object... params)
+ public void fillStatement(final PreparedStatement stmt, final Object... params)
throws SQLException {
// check the parameter count, if we can
@@ -349,8 +349,8 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* if a database access error occurs
*/
- public void fillStatementWithBean(PreparedStatement stmt, Object bean,
- PropertyDescriptor[] properties) throws SQLException {
+ public void fillStatementWithBean(final PreparedStatement stmt, final Object bean,
+ final PropertyDescriptor[] properties) throws SQLException {
Object[] params = new Object[properties.length];
for (int i = 0; i < properties.length; i++) {
PropertyDescriptor property = properties[i];
@@ -392,8 +392,8 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* If a database access error occurs
*/
- public void fillStatementWithBean(PreparedStatement stmt, Object bean,
- String... propertyNames) throws SQLException {
+ public void fillStatementWithBean(final PreparedStatement stmt, final Object bean,
+ final String... propertyNames) throws SQLException {
PropertyDescriptor[] descriptors;
try {
descriptors = Introspector.getBeanInfo(bean.getClass())
@@ -469,7 +469,7 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* if a database access error occurs
*/
- protected CallableStatement prepareCall(Connection conn, String sql)
+ protected CallableStatement prepareCall(final Connection conn, final String sql)
throws SQLException {
return conn.prepareCall(sql);
@@ -513,7 +513,7 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* if a database access error occurs
*/
- protected PreparedStatement prepareStatement(Connection conn, String sql)
+ protected PreparedStatement prepareStatement(final Connection conn, final String sql)
throws SQLException {
@SuppressWarnings("resource")
@@ -550,7 +550,7 @@ public abstract class AbstractQueryRunner {
* if a database access error occurs
* @since 1.6
*/
- protected PreparedStatement prepareStatement(Connection conn, String sql, int returnedKeys)
+ protected PreparedStatement prepareStatement(final Connection conn, final String sql, final int returnedKeys)
throws SQLException {
@SuppressWarnings("resource")
@@ -581,7 +581,7 @@ public abstract class AbstractQueryRunner {
* @throws SQLException
* if a database access error occurs
*/
- protected void rethrow(SQLException cause, String sql, Object... params)
+ protected void rethrow(final SQLException cause, final String sql, final Object... params)
throws SQLException {
String causeMessage = cause.getMessage();
@@ -630,7 +630,7 @@ public abstract class AbstractQueryRunner {
* <code>null</code>.
* @return The <code>ResultSet</code> wrapped in some decorator.
*/
- protected ResultSet wrap(ResultSet rs) {
+ protected ResultSet wrap(final ResultSet rs) {
return rs;
}
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java b/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
index 4625695..94a29b2 100644
--- a/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
+++ b/src/main/java/org/apache/commons/dbutils/AsyncQueryRunner.java
@@ -45,7 +45,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param queryRunner the {@code QueryRunner} instance to use for the queries.
* @since DbUtils 1.5
*/
- public AsyncQueryRunner(ExecutorService executorService, QueryRunner queryRunner) {
+ public AsyncQueryRunner(final ExecutorService executorService, final QueryRunner queryRunner) {
this.executorService = executorService;
this.queryRunner = queryRunner;
}
@@ -55,7 +55,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
*
* @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
*/
- public AsyncQueryRunner(ExecutorService executorService) {
+ public AsyncQueryRunner(final ExecutorService executorService) {
this(null, false, executorService);
}
@@ -69,7 +69,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
*/
@Deprecated
- public AsyncQueryRunner(boolean pmdKnownBroken, ExecutorService executorService) {
+ public AsyncQueryRunner(final boolean pmdKnownBroken, final ExecutorService executorService) {
this(null, pmdKnownBroken, executorService);
}
@@ -84,7 +84,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
*/
@Deprecated
- public AsyncQueryRunner(DataSource ds, ExecutorService executorService) {
+ public AsyncQueryRunner(final DataSource ds, final ExecutorService executorService) {
this(ds, false, executorService);
}
@@ -101,7 +101,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param executorService the {@code ExecutorService} instance used to run JDBC invocations concurrently.
*/
@Deprecated
- public AsyncQueryRunner(DataSource ds, boolean pmdKnownBroken, ExecutorService executorService) {
+ public AsyncQueryRunner(final DataSource ds, final boolean pmdKnownBroken, final ExecutorService executorService) {
super(ds, pmdKnownBroken);
this.executorService = executorService;
this.queryRunner = new QueryRunner(ds, pmdKnownBroken);
@@ -129,7 +129,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param closeConn True if the connection should be closed, false otherwise.
* @param ps The {@link PreparedStatement} to be executed.
*/
- public BatchCallableStatement(String sql, Object[][] params, Connection conn, boolean closeConn, PreparedStatement ps) {
+ public BatchCallableStatement(final String sql, final Object[][] params, final Connection conn, final boolean closeConn, final PreparedStatement ps) {
this.sql = sql;
this.params = params.clone();
this.conn = conn;
@@ -231,8 +231,8 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param params An array of query replacement parameters. Each row in
* this array is one set of batch replacement values.
*/
- public QueryCallableStatement(Connection conn, boolean closeConn, PreparedStatement ps,
- ResultSetHandler<T> rsh, String sql, Object... params) {
+ public QueryCallableStatement(final Connection conn, final boolean closeConn, final PreparedStatement ps,
+ final ResultSetHandler<T> rsh, final String sql, final Object... params) {
this.sql = sql;
this.params = params;
this.conn = conn;
@@ -387,7 +387,7 @@ public class AsyncQueryRunner extends AbstractQueryRunner {
* @param params An array of query replacement parameters. Each row in
* this array is one set of batch replacement values.
*/
- public UpdateCallableStatement(Connection conn, boolean closeConn, PreparedStatement ps, String sql, Object... params) {
+ public UpdateCallableStatement(final Connection conn, final boolean closeConn, final PreparedStatement ps, final String sql, final Object... params) {
this.sql = sql;
this.params = params;
this.conn = conn;
http://git-wip-us.apache.org/repos/asf/commons-dbutils/blob/41e682d6/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java b/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
index 7cbf131..5b0db6a 100644
--- a/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
+++ b/src/main/java/org/apache/commons/dbutils/BaseResultSetHandler.java
@@ -62,7 +62,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* {@inheritDoc}
*/
@Override
- public final T handle(ResultSet rs) throws SQLException {
+ public final T handle(final ResultSet rs) throws SQLException {
if (this.rs != null) {
throw new IllegalStateException("Re-entry not allowed!");
}
@@ -91,7 +91,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#absolute(int)
*/
- protected final boolean absolute(int row) throws SQLException {
+ protected final boolean absolute(final int row) throws SQLException {
return rs.absolute(row);
}
@@ -149,7 +149,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#findColumn(java.lang.String)
*/
- protected final int findColumn(String columnLabel) throws SQLException {
+ protected final int findColumn(final String columnLabel) throws SQLException {
return rs.findColumn(columnLabel);
}
@@ -168,7 +168,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getArray(int)
*/
- protected final Array getArray(int columnIndex) throws SQLException {
+ protected final Array getArray(final int columnIndex) throws SQLException {
return rs.getArray(columnIndex);
}
@@ -178,7 +178,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getArray(java.lang.String)
*/
- protected final Array getArray(String columnLabel) throws SQLException {
+ protected final Array getArray(final String columnLabel) throws SQLException {
return rs.getArray(columnLabel);
}
@@ -188,7 +188,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getAsciiStream(int)
*/
- protected final InputStream getAsciiStream(int columnIndex) throws SQLException {
+ protected final InputStream getAsciiStream(final int columnIndex) throws SQLException {
return rs.getAsciiStream(columnIndex);
}
@@ -198,7 +198,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getAsciiStream(java.lang.String)
*/
- protected final InputStream getAsciiStream(String columnLabel) throws SQLException {
+ protected final InputStream getAsciiStream(final String columnLabel) throws SQLException {
return rs.getAsciiStream(columnLabel);
}
@@ -211,7 +211,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @see java.sql.ResultSet#getBigDecimal(int, int)
*/
@Deprecated
- protected final BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+ protected final BigDecimal getBigDecimal(final int columnIndex, final int scale) throws SQLException {
return rs.getBigDecimal(columnIndex, scale);
}
@@ -221,7 +221,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBigDecimal(int)
*/
- protected final BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ protected final BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
return rs.getBigDecimal(columnIndex);
}
@@ -234,7 +234,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
*/
@Deprecated
- protected final BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
+ protected final BigDecimal getBigDecimal(final String columnLabel, final int scale) throws SQLException {
return rs.getBigDecimal(columnLabel, scale);
}
@@ -244,7 +244,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBigDecimal(java.lang.String)
*/
- protected final BigDecimal getBigDecimal(String columnLabel) throws SQLException {
+ protected final BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
return rs.getBigDecimal(columnLabel);
}
@@ -254,7 +254,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBinaryStream(int)
*/
- protected final InputStream getBinaryStream(int columnIndex) throws SQLException {
+ protected final InputStream getBinaryStream(final int columnIndex) throws SQLException {
return rs.getBinaryStream(columnIndex);
}
@@ -264,7 +264,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBinaryStream(java.lang.String)
*/
- protected final InputStream getBinaryStream(String columnLabel) throws SQLException {
+ protected final InputStream getBinaryStream(final String columnLabel) throws SQLException {
return rs.getBinaryStream(columnLabel);
}
@@ -274,7 +274,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBlob(int)
*/
- protected final Blob getBlob(int columnIndex) throws SQLException {
+ protected final Blob getBlob(final int columnIndex) throws SQLException {
return rs.getBlob(columnIndex);
}
@@ -284,7 +284,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBlob(java.lang.String)
*/
- protected final Blob getBlob(String columnLabel) throws SQLException {
+ protected final Blob getBlob(final String columnLabel) throws SQLException {
return rs.getBlob(columnLabel);
}
@@ -294,7 +294,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBoolean(int)
*/
- protected final boolean getBoolean(int columnIndex) throws SQLException {
+ protected final boolean getBoolean(final int columnIndex) throws SQLException {
return rs.getBoolean(columnIndex);
}
@@ -304,7 +304,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBoolean(java.lang.String)
*/
- protected final boolean getBoolean(String columnLabel) throws SQLException {
+ protected final boolean getBoolean(final String columnLabel) throws SQLException {
return rs.getBoolean(columnLabel);
}
@@ -314,7 +314,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getByte(int)
*/
- protected final byte getByte(int columnIndex) throws SQLException {
+ protected final byte getByte(final int columnIndex) throws SQLException {
return rs.getByte(columnIndex);
}
@@ -324,7 +324,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getByte(java.lang.String)
*/
- protected final byte getByte(String columnLabel) throws SQLException {
+ protected final byte getByte(final String columnLabel) throws SQLException {
return rs.getByte(columnLabel);
}
@@ -334,7 +334,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBytes(int)
*/
- protected final byte[] getBytes(int columnIndex) throws SQLException {
+ protected final byte[] getBytes(final int columnIndex) throws SQLException {
return rs.getBytes(columnIndex);
}
@@ -344,7 +344,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getBytes(java.lang.String)
*/
- protected final byte[] getBytes(String columnLabel) throws SQLException {
+ protected final byte[] getBytes(final String columnLabel) throws SQLException {
return rs.getBytes(columnLabel);
}
@@ -354,7 +354,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getCharacterStream(int)
*/
- protected final Reader getCharacterStream(int columnIndex) throws SQLException {
+ protected final Reader getCharacterStream(final int columnIndex) throws SQLException {
return rs.getCharacterStream(columnIndex);
}
@@ -364,7 +364,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getCharacterStream(java.lang.String)
*/
- protected final Reader getCharacterStream(String columnLabel) throws SQLException {
+ protected final Reader getCharacterStream(final String columnLabel) throws SQLException {
return rs.getCharacterStream(columnLabel);
}
@@ -374,7 +374,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getClob(int)
*/
- protected final Clob getClob(int columnIndex) throws SQLException {
+ protected final Clob getClob(final int columnIndex) throws SQLException {
return rs.getClob(columnIndex);
}
@@ -384,7 +384,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getClob(java.lang.String)
*/
- protected final Clob getClob(String columnLabel) throws SQLException {
+ protected final Clob getClob(final String columnLabel) throws SQLException {
return rs.getClob(columnLabel);
}
@@ -413,7 +413,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDate(int, java.util.Calendar)
*/
- protected final Date getDate(int columnIndex, Calendar cal) throws SQLException {
+ protected final Date getDate(final int columnIndex, final Calendar cal) throws SQLException {
return rs.getDate(columnIndex, cal);
}
@@ -423,7 +423,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDate(int)
*/
- protected final Date getDate(int columnIndex) throws SQLException {
+ protected final Date getDate(final int columnIndex) throws SQLException {
return rs.getDate(columnIndex);
}
@@ -434,7 +434,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
*/
- protected final Date getDate(String columnLabel, Calendar cal) throws SQLException {
+ protected final Date getDate(final String columnLabel, final Calendar cal) throws SQLException {
return rs.getDate(columnLabel, cal);
}
@@ -444,7 +444,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDate(java.lang.String)
*/
- protected final Date getDate(String columnLabel) throws SQLException {
+ protected final Date getDate(final String columnLabel) throws SQLException {
return rs.getDate(columnLabel);
}
@@ -454,7 +454,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDouble(int)
*/
- protected final double getDouble(int columnIndex) throws SQLException {
+ protected final double getDouble(final int columnIndex) throws SQLException {
return rs.getDouble(columnIndex);
}
@@ -464,7 +464,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getDouble(java.lang.String)
*/
- protected final double getDouble(String columnLabel) throws SQLException {
+ protected final double getDouble(final String columnLabel) throws SQLException {
return rs.getDouble(columnLabel);
}
@@ -492,7 +492,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getFloat(int)
*/
- protected final float getFloat(int columnIndex) throws SQLException {
+ protected final float getFloat(final int columnIndex) throws SQLException {
return rs.getFloat(columnIndex);
}
@@ -502,7 +502,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getFloat(java.lang.String)
*/
- protected final float getFloat(String columnLabel) throws SQLException {
+ protected final float getFloat(final String columnLabel) throws SQLException {
return rs.getFloat(columnLabel);
}
@@ -521,7 +521,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getInt(int)
*/
- protected final int getInt(int columnIndex) throws SQLException {
+ protected final int getInt(final int columnIndex) throws SQLException {
return rs.getInt(columnIndex);
}
@@ -531,7 +531,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getInt(java.lang.String)
*/
- protected final int getInt(String columnLabel) throws SQLException {
+ protected final int getInt(final String columnLabel) throws SQLException {
return rs.getInt(columnLabel);
}
@@ -541,7 +541,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getLong(int)
*/
- protected final long getLong(int columnIndex) throws SQLException {
+ protected final long getLong(final int columnIndex) throws SQLException {
return rs.getLong(columnIndex);
}
@@ -551,7 +551,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getLong(java.lang.String)
*/
- protected final long getLong(String columnLabel) throws SQLException {
+ protected final long getLong(final String columnLabel) throws SQLException {
return rs.getLong(columnLabel);
}
@@ -570,7 +570,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNCharacterStream(int)
*/
- protected final Reader getNCharacterStream(int columnIndex) throws SQLException {
+ protected final Reader getNCharacterStream(final int columnIndex) throws SQLException {
return rs.getNCharacterStream(columnIndex);
}
@@ -580,7 +580,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNCharacterStream(java.lang.String)
*/
- protected final Reader getNCharacterStream(String columnLabel) throws SQLException {
+ protected final Reader getNCharacterStream(final String columnLabel) throws SQLException {
return rs.getNCharacterStream(columnLabel);
}
@@ -590,7 +590,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNClob(int)
*/
- protected final NClob getNClob(int columnIndex) throws SQLException {
+ protected final NClob getNClob(final int columnIndex) throws SQLException {
return rs.getNClob(columnIndex);
}
@@ -600,7 +600,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNClob(java.lang.String)
*/
- protected final NClob getNClob(String columnLabel) throws SQLException {
+ protected final NClob getNClob(final String columnLabel) throws SQLException {
return rs.getNClob(columnLabel);
}
@@ -610,7 +610,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNString(int)
*/
- protected final String getNString(int columnIndex) throws SQLException {
+ protected final String getNString(final int columnIndex) throws SQLException {
return rs.getNString(columnIndex);
}
@@ -620,7 +620,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getNString(java.lang.String)
*/
- protected final String getNString(String columnLabel) throws SQLException {
+ protected final String getNString(final String columnLabel) throws SQLException {
return rs.getNString(columnLabel);
}
@@ -631,7 +631,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getObject(int, java.util.Map)
*/
- protected final Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+ protected final Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {
return rs.getObject(columnIndex, map);
}
@@ -641,7 +641,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getObject(int)
*/
- protected final Object getObject(int columnIndex) throws SQLException {
+ protected final Object getObject(final int columnIndex) throws SQLException {
return rs.getObject(columnIndex);
}
@@ -652,7 +652,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
*/
- protected final Object getObject(String columnLabel, Map<String, Class<?>> map) throws SQLException {
+ protected final Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {
return rs.getObject(columnLabel, map);
}
@@ -662,7 +662,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getObject(java.lang.String)
*/
- protected final Object getObject(String columnLabel) throws SQLException {
+ protected final Object getObject(final String columnLabel) throws SQLException {
return rs.getObject(columnLabel);
}
@@ -672,7 +672,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getRef(int)
*/
- protected final Ref getRef(int columnIndex) throws SQLException {
+ protected final Ref getRef(final int columnIndex) throws SQLException {
return rs.getRef(columnIndex);
}
@@ -682,7 +682,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getRef(java.lang.String)
*/
- protected final Ref getRef(String columnLabel) throws SQLException {
+ protected final Ref getRef(final String columnLabel) throws SQLException {
return rs.getRef(columnLabel);
}
@@ -701,7 +701,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getRowId(int)
*/
- protected final RowId getRowId(int columnIndex) throws SQLException {
+ protected final RowId getRowId(final int columnIndex) throws SQLException {
return rs.getRowId(columnIndex);
}
@@ -711,7 +711,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getRowId(java.lang.String)
*/
- protected final RowId getRowId(String columnLabel) throws SQLException {
+ protected final RowId getRowId(final String columnLabel) throws SQLException {
return rs.getRowId(columnLabel);
}
@@ -721,7 +721,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getSQLXML(int)
*/
- protected final SQLXML getSQLXML(int columnIndex) throws SQLException {
+ protected final SQLXML getSQLXML(final int columnIndex) throws SQLException {
return rs.getSQLXML(columnIndex);
}
@@ -731,7 +731,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getSQLXML(java.lang.String)
*/
- protected final SQLXML getSQLXML(String columnLabel) throws SQLException {
+ protected final SQLXML getSQLXML(final String columnLabel) throws SQLException {
return rs.getSQLXML(columnLabel);
}
@@ -741,7 +741,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getShort(int)
*/
- protected final short getShort(int columnIndex) throws SQLException {
+ protected final short getShort(final int columnIndex) throws SQLException {
return rs.getShort(columnIndex);
}
@@ -751,7 +751,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getShort(java.lang.String)
*/
- protected final short getShort(String columnLabel) throws SQLException {
+ protected final short getShort(final String columnLabel) throws SQLException {
return rs.getShort(columnLabel);
}
@@ -770,7 +770,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getString(int)
*/
- protected final String getString(int columnIndex) throws SQLException {
+ protected final String getString(final int columnIndex) throws SQLException {
return rs.getString(columnIndex);
}
@@ -780,7 +780,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getString(java.lang.String)
*/
- protected final String getString(String columnLabel) throws SQLException {
+ protected final String getString(final String columnLabel) throws SQLException {
return rs.getString(columnLabel);
}
@@ -791,7 +791,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTime(int, java.util.Calendar)
*/
- protected final Time getTime(int columnIndex, Calendar cal) throws SQLException {
+ protected final Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
return rs.getTime(columnIndex, cal);
}
@@ -801,7 +801,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTime(int)
*/
- protected final Time getTime(int columnIndex) throws SQLException {
+ protected final Time getTime(final int columnIndex) throws SQLException {
return rs.getTime(columnIndex);
}
@@ -812,7 +812,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
*/
- protected final Time getTime(String columnLabel, Calendar cal) throws SQLException {
+ protected final Time getTime(final String columnLabel, final Calendar cal) throws SQLException {
return rs.getTime(columnLabel, cal);
}
@@ -822,7 +822,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTime(java.lang.String)
*/
- protected final Time getTime(String columnLabel) throws SQLException {
+ protected final Time getTime(final String columnLabel) throws SQLException {
return rs.getTime(columnLabel);
}
@@ -833,7 +833,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
*/
- protected final Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+ protected final Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {
return rs.getTimestamp(columnIndex, cal);
}
@@ -843,7 +843,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTimestamp(int)
*/
- protected final Timestamp getTimestamp(int columnIndex) throws SQLException {
+ protected final Timestamp getTimestamp(final int columnIndex) throws SQLException {
return rs.getTimestamp(columnIndex);
}
@@ -854,7 +854,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar)
*/
- protected final Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
+ protected final Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
return rs.getTimestamp(columnLabel, cal);
}
@@ -864,7 +864,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getTimestamp(java.lang.String)
*/
- protected final Timestamp getTimestamp(String columnLabel) throws SQLException {
+ protected final Timestamp getTimestamp(final String columnLabel) throws SQLException {
return rs.getTimestamp(columnLabel);
}
@@ -883,7 +883,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getURL(int)
*/
- protected final URL getURL(int columnIndex) throws SQLException {
+ protected final URL getURL(final int columnIndex) throws SQLException {
return rs.getURL(columnIndex);
}
@@ -893,7 +893,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#getURL(java.lang.String)
*/
- protected final URL getURL(String columnLabel) throws SQLException {
+ protected final URL getURL(final String columnLabel) throws SQLException {
return rs.getURL(columnLabel);
}
@@ -905,7 +905,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @see java.sql.ResultSet#getUnicodeStream(int)
*/
@Deprecated
- protected final InputStream getUnicodeStream(int columnIndex) throws SQLException {
+ protected final InputStream getUnicodeStream(final int columnIndex) throws SQLException {
return rs.getUnicodeStream(columnIndex);
}
@@ -917,7 +917,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
*/
@Deprecated
- protected final InputStream getUnicodeStream(String columnLabel) throws SQLException {
+ protected final InputStream getUnicodeStream(final String columnLabel) throws SQLException {
return rs.getUnicodeStream(columnLabel);
}
@@ -989,7 +989,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
*/
- protected final boolean isWrapperFor(Class<?> iface) throws SQLException {
+ protected final boolean isWrapperFor(final Class<?> iface) throws SQLException {
return rs.isWrapperFor(iface);
}
@@ -1050,7 +1050,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#relative(int)
*/
- protected final boolean relative(int rows) throws SQLException {
+ protected final boolean relative(final int rows) throws SQLException {
return rs.relative(rows);
}
@@ -1086,7 +1086,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#setFetchDirection(int)
*/
- protected final void setFetchDirection(int direction) throws SQLException {
+ protected final void setFetchDirection(final int direction) throws SQLException {
rs.setFetchDirection(direction);
}
@@ -1095,7 +1095,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#setFetchSize(int)
*/
- protected final void setFetchSize(int rows) throws SQLException {
+ protected final void setFetchSize(final int rows) throws SQLException {
rs.setFetchSize(rows);
}
@@ -1105,7 +1105,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.Wrapper#unwrap(java.lang.Class)
*/
- protected final <E> E unwrap(Class<E> iface) throws SQLException {
+ protected final <E> E unwrap(final Class<E> iface) throws SQLException {
return rs.unwrap(iface);
}
@@ -1115,7 +1115,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateArray(int, java.sql.Array)
*/
- protected final void updateArray(int columnIndex, Array x) throws SQLException {
+ protected final void updateArray(final int columnIndex, final Array x) throws SQLException {
rs.updateArray(columnIndex, x);
}
@@ -1125,7 +1125,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
*/
- protected final void updateArray(String columnLabel, Array x) throws SQLException {
+ protected final void updateArray(final String columnLabel, final Array x) throws SQLException {
rs.updateArray(columnLabel, x);
}
@@ -1136,7 +1136,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
*/
- protected final void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
+ protected final void updateAsciiStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
rs.updateAsciiStream(columnIndex, x, length);
}
@@ -1147,7 +1147,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long)
*/
- protected final void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
+ protected final void updateAsciiStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
rs.updateAsciiStream(columnIndex, x, length);
}
@@ -1157,7 +1157,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream)
*/
- protected final void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
+ protected final void updateAsciiStream(final int columnIndex, final InputStream x) throws SQLException {
rs.updateAsciiStream(columnIndex, x);
}
@@ -1168,7 +1168,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, int)
*/
- protected final void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
+ protected final void updateAsciiStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
rs.updateAsciiStream(columnLabel, x, length);
}
@@ -1179,7 +1179,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long)
*/
- protected final void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
+ protected final void updateAsciiStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
rs.updateAsciiStream(columnLabel, x, length);
}
@@ -1189,7 +1189,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream)
*/
- protected final void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
+ protected final void updateAsciiStream(final String columnLabel, final InputStream x) throws SQLException {
rs.updateAsciiStream(columnLabel, x);
}
@@ -1199,7 +1199,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
*/
- protected final void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+ protected final void updateBigDecimal(final int columnIndex, final BigDecimal x) throws SQLException {
rs.updateBigDecimal(columnIndex, x);
}
@@ -1209,7 +1209,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBigDecimal(java.lang.String, java.math.BigDecimal)
*/
- protected final void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
+ protected final void updateBigDecimal(final String columnLabel, final BigDecimal x) throws SQLException {
rs.updateBigDecimal(columnLabel, x);
}
@@ -1220,7 +1220,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
*/
- protected final void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
+ protected final void updateBinaryStream(final int columnIndex, final InputStream x, final int length) throws SQLException {
rs.updateBinaryStream(columnIndex, x, length);
}
@@ -1231,7 +1231,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long)
*/
- protected final void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
+ protected final void updateBinaryStream(final int columnIndex, final InputStream x, final long length) throws SQLException {
rs.updateBinaryStream(columnIndex, x, length);
}
@@ -1241,7 +1241,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream)
*/
- protected final void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
+ protected final void updateBinaryStream(final int columnIndex, final InputStream x) throws SQLException {
rs.updateBinaryStream(columnIndex, x);
}
@@ -1252,7 +1252,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, int)
*/
- protected final void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
+ protected final void updateBinaryStream(final String columnLabel, final InputStream x, final int length) throws SQLException {
rs.updateBinaryStream(columnLabel, x, length);
}
@@ -1263,7 +1263,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long)
*/
- protected final void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
+ protected final void updateBinaryStream(final String columnLabel, final InputStream x, final long length) throws SQLException {
rs.updateBinaryStream(columnLabel, x, length);
}
@@ -1273,7 +1273,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream)
*/
- protected final void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
+ protected final void updateBinaryStream(final String columnLabel, final InputStream x) throws SQLException {
rs.updateBinaryStream(columnLabel, x);
}
@@ -1283,7 +1283,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
*/
- protected final void updateBlob(int columnIndex, Blob x) throws SQLException {
+ protected final void updateBlob(final int columnIndex, final Blob x) throws SQLException {
rs.updateBlob(columnIndex, x);
}
@@ -1294,7 +1294,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long)
*/
- protected final void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException {
+ protected final void updateBlob(final int columnIndex, final InputStream inputStream, final long length) throws SQLException {
rs.updateBlob(columnIndex, inputStream, length);
}
@@ -1304,7 +1304,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(int, java.io.InputStream)
*/
- protected final void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
+ protected final void updateBlob(final int columnIndex, final InputStream inputStream) throws SQLException {
rs.updateBlob(columnIndex, inputStream);
}
@@ -1314,7 +1314,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
*/
- protected final void updateBlob(String columnLabel, Blob x) throws SQLException {
+ protected final void updateBlob(final String columnLabel, final Blob x) throws SQLException {
rs.updateBlob(columnLabel, x);
}
@@ -1325,7 +1325,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long)
*/
- protected final void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
+ protected final void updateBlob(final String columnLabel, final InputStream inputStream, final long length) throws SQLException {
rs.updateBlob(columnLabel, inputStream, length);
}
@@ -1335,7 +1335,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream)
*/
- protected final void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
+ protected final void updateBlob(final String columnLabel, final InputStream inputStream) throws SQLException {
rs.updateBlob(columnLabel, inputStream);
}
@@ -1345,7 +1345,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBoolean(int, boolean)
*/
- protected final void updateBoolean(int columnIndex, boolean x) throws SQLException {
+ protected final void updateBoolean(final int columnIndex, final boolean x) throws SQLException {
rs.updateBoolean(columnIndex, x);
}
@@ -1355,7 +1355,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
*/
- protected final void updateBoolean(String columnLabel, boolean x) throws SQLException {
+ protected final void updateBoolean(final String columnLabel, final boolean x) throws SQLException {
rs.updateBoolean(columnLabel, x);
}
@@ -1365,7 +1365,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateByte(int, byte)
*/
- protected final void updateByte(int columnIndex, byte x) throws SQLException {
+ protected final void updateByte(final int columnIndex, final byte x) throws SQLException {
rs.updateByte(columnIndex, x);
}
@@ -1375,7 +1375,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateByte(java.lang.String, byte)
*/
- protected final void updateByte(String columnLabel, byte x) throws SQLException {
+ protected final void updateByte(final String columnLabel, final byte x) throws SQLException {
rs.updateByte(columnLabel, x);
}
@@ -1385,7 +1385,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBytes(int, byte[])
*/
- protected final void updateBytes(int columnIndex, byte[] x) throws SQLException {
+ protected final void updateBytes(final int columnIndex, final byte[] x) throws SQLException {
rs.updateBytes(columnIndex, x);
}
@@ -1395,7 +1395,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
*/
- protected final void updateBytes(String columnLabel, byte[] x) throws SQLException {
+ protected final void updateBytes(final String columnLabel, final byte[] x) throws SQLException {
rs.updateBytes(columnLabel, x);
}
@@ -1406,7 +1406,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
*/
- protected final void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
+ protected final void updateCharacterStream(final int columnIndex, final Reader x, final int length) throws SQLException {
rs.updateCharacterStream(columnIndex, x, length);
}
@@ -1417,7 +1417,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long)
*/
- protected final void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+ protected final void updateCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
rs.updateCharacterStream(columnIndex, x, length);
}
@@ -1427,7 +1427,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader)
*/
- protected final void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
+ protected final void updateCharacterStream(final int columnIndex, final Reader x) throws SQLException {
rs.updateCharacterStream(columnIndex, x);
}
@@ -1438,7 +1438,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, int)
*/
- protected final void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
+ protected final void updateCharacterStream(final String columnLabel, final Reader reader, final int length) throws SQLException {
rs.updateCharacterStream(columnLabel, reader, length);
}
@@ -1449,7 +1449,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long)
*/
- protected final void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+ protected final void updateCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
rs.updateCharacterStream(columnLabel, reader, length);
}
@@ -1459,7 +1459,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader)
*/
- protected final void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
+ protected final void updateCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
rs.updateCharacterStream(columnLabel, reader);
}
@@ -1469,7 +1469,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
*/
- protected final void updateClob(int columnIndex, Clob x) throws SQLException {
+ protected final void updateClob(final int columnIndex, final Clob x) throws SQLException {
rs.updateClob(columnIndex, x);
}
@@ -1480,7 +1480,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(int, java.io.Reader, long)
*/
- protected final void updateClob(int columnIndex, Reader reader, long length) throws SQLException {
+ protected final void updateClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
rs.updateClob(columnIndex, reader, length);
}
@@ -1490,7 +1490,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(int, java.io.Reader)
*/
- protected final void updateClob(int columnIndex, Reader reader) throws SQLException {
+ protected final void updateClob(final int columnIndex, final Reader reader) throws SQLException {
rs.updateClob(columnIndex, reader);
}
@@ -1500,7 +1500,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
*/
- protected final void updateClob(String columnLabel, Clob x) throws SQLException {
+ protected final void updateClob(final String columnLabel, final Clob x) throws SQLException {
rs.updateClob(columnLabel, x);
}
@@ -1511,7 +1511,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long)
*/
- protected final void updateClob(String columnLabel, Reader reader, long length) throws SQLException {
+ protected final void updateClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
rs.updateClob(columnLabel, reader, length);
}
@@ -1521,7 +1521,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader)
*/
- protected final void updateClob(String columnLabel, Reader reader) throws SQLException {
+ protected final void updateClob(final String columnLabel, final Reader reader) throws SQLException {
rs.updateClob(columnLabel, reader);
}
@@ -1531,7 +1531,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateDate(int, java.sql.Date)
*/
- protected final void updateDate(int columnIndex, Date x) throws SQLException {
+ protected final void updateDate(final int columnIndex, final Date x) throws SQLException {
rs.updateDate(columnIndex, x);
}
@@ -1541,7 +1541,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
*/
- protected final void updateDate(String columnLabel, Date x) throws SQLException {
+ protected final void updateDate(final String columnLabel, final Date x) throws SQLException {
rs.updateDate(columnLabel, x);
}
@@ -1551,7 +1551,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateDouble(int, double)
*/
- protected final void updateDouble(int columnIndex, double x) throws SQLException {
+ protected final void updateDouble(final int columnIndex, final double x) throws SQLException {
rs.updateDouble(columnIndex, x);
}
@@ -1561,7 +1561,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateDouble(java.lang.String, double)
*/
- protected final void updateDouble(String columnLabel, double x) throws SQLException {
+ protected final void updateDouble(final String columnLabel, final double x) throws SQLException {
rs.updateDouble(columnLabel, x);
}
@@ -1571,7 +1571,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateFloat(int, float)
*/
- protected final void updateFloat(int columnIndex, float x) throws SQLException {
+ protected final void updateFloat(final int columnIndex, final float x) throws SQLException {
rs.updateFloat(columnIndex, x);
}
@@ -1581,7 +1581,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateFloat(java.lang.String, float)
*/
- protected final void updateFloat(String columnLabel, float x) throws SQLException {
+ protected final void updateFloat(final String columnLabel, final float x) throws SQLException {
rs.updateFloat(columnLabel, x);
}
@@ -1591,7 +1591,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateInt(int, int)
*/
- protected final void updateInt(int columnIndex, int x) throws SQLException {
+ protected final void updateInt(final int columnIndex, final int x) throws SQLException {
rs.updateInt(columnIndex, x);
}
@@ -1601,7 +1601,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateInt(java.lang.String, int)
*/
- protected final void updateInt(String columnLabel, int x) throws SQLException {
+ protected final void updateInt(final String columnLabel, final int x) throws SQLException {
rs.updateInt(columnLabel, x);
}
@@ -1611,7 +1611,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateLong(int, long)
*/
- protected final void updateLong(int columnIndex, long x) throws SQLException {
+ protected final void updateLong(final int columnIndex, final long x) throws SQLException {
rs.updateLong(columnIndex, x);
}
@@ -1621,7 +1621,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateLong(java.lang.String, long)
*/
- protected final void updateLong(String columnLabel, long x) throws SQLException {
+ protected final void updateLong(final String columnLabel, final long x) throws SQLException {
rs.updateLong(columnLabel, x);
}
@@ -1632,7 +1632,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long)
*/
- protected final void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
+ protected final void updateNCharacterStream(final int columnIndex, final Reader x, final long length) throws SQLException {
rs.updateNCharacterStream(columnIndex, x, length);
}
@@ -1642,7 +1642,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader)
*/
- protected final void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
+ protected final void updateNCharacterStream(final int columnIndex, final Reader x) throws SQLException {
rs.updateNCharacterStream(columnIndex, x);
}
@@ -1653,7 +1653,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long)
*/
- protected final void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
+ protected final void updateNCharacterStream(final String columnLabel, final Reader reader, final long length) throws SQLException {
rs.updateNCharacterStream(columnLabel, reader, length);
}
@@ -1663,7 +1663,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader)
*/
- protected final void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
+ protected final void updateNCharacterStream(final String columnLabel, final Reader reader) throws SQLException {
rs.updateNCharacterStream(columnLabel, reader);
}
@@ -1673,7 +1673,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(int, java.sql.NClob)
*/
- protected final void updateNClob(int columnIndex, NClob nClob) throws SQLException {
+ protected final void updateNClob(final int columnIndex, final NClob nClob) throws SQLException {
rs.updateNClob(columnIndex, nClob);
}
@@ -1684,7 +1684,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long)
*/
- protected final void updateNClob(int columnIndex, Reader reader, long length) throws SQLException {
+ protected final void updateNClob(final int columnIndex, final Reader reader, final long length) throws SQLException {
rs.updateNClob(columnIndex, reader, length);
}
@@ -1694,7 +1694,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(int, java.io.Reader)
*/
- protected final void updateNClob(int columnIndex, Reader reader) throws SQLException {
+ protected final void updateNClob(final int columnIndex, final Reader reader) throws SQLException {
rs.updateNClob(columnIndex, reader);
}
@@ -1704,7 +1704,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob)
*/
- protected final void updateNClob(String columnLabel, NClob nClob) throws SQLException {
+ protected final void updateNClob(final String columnLabel, final NClob nClob) throws SQLException {
rs.updateNClob(columnLabel, nClob);
}
@@ -1715,7 +1715,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader, long)
*/
- protected final void updateNClob(String columnLabel, Reader reader, long length) throws SQLException {
+ protected final void updateNClob(final String columnLabel, final Reader reader, final long length) throws SQLException {
rs.updateNClob(columnLabel, reader, length);
}
@@ -1725,7 +1725,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader)
*/
- protected final void updateNClob(String columnLabel, Reader reader) throws SQLException {
+ protected final void updateNClob(final String columnLabel, final Reader reader) throws SQLException {
rs.updateNClob(columnLabel, reader);
}
@@ -1735,7 +1735,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNString(int, java.lang.String)
*/
- protected final void updateNString(int columnIndex, String nString) throws SQLException {
+ protected final void updateNString(final int columnIndex, final String nString) throws SQLException {
rs.updateNString(columnIndex, nString);
}
@@ -1745,7 +1745,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String)
*/
- protected final void updateNString(String columnLabel, String nString) throws SQLException {
+ protected final void updateNString(final String columnLabel, final String nString) throws SQLException {
rs.updateNString(columnLabel, nString);
}
@@ -1754,7 +1754,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNull(int)
*/
- protected final void updateNull(int columnIndex) throws SQLException {
+ protected final void updateNull(final int columnIndex) throws SQLException {
rs.updateNull(columnIndex);
}
@@ -1763,7 +1763,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateNull(java.lang.String)
*/
- protected final void updateNull(String columnLabel) throws SQLException {
+ protected final void updateNull(final String columnLabel) throws SQLException {
rs.updateNull(columnLabel);
}
@@ -1774,7 +1774,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
*/
- protected final void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException {
+ protected final void updateObject(final int columnIndex, final Object x, final int scaleOrLength) throws SQLException {
rs.updateObject(columnIndex, x, scaleOrLength);
}
@@ -1784,7 +1784,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateObject(int, java.lang.Object)
*/
- protected final void updateObject(int columnIndex, Object x) throws SQLException {
+ protected final void updateObject(final int columnIndex, final Object x) throws SQLException {
rs.updateObject(columnIndex, x);
}
@@ -1795,7 +1795,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, int)
*/
- protected final void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException {
+ protected final void updateObject(final String columnLabel, final Object x, final int scaleOrLength) throws SQLException {
rs.updateObject(columnLabel, x, scaleOrLength);
}
@@ -1805,7 +1805,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
*/
- protected final void updateObject(String columnLabel, Object x) throws SQLException {
+ protected final void updateObject(final String columnLabel, final Object x) throws SQLException {
rs.updateObject(columnLabel, x);
}
@@ -1815,7 +1815,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
*/
- protected final void updateRef(int columnIndex, Ref x) throws SQLException {
+ protected final void updateRef(final int columnIndex, final Ref x) throws SQLException {
rs.updateRef(columnIndex, x);
}
@@ -1825,7 +1825,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
*/
- protected final void updateRef(String columnLabel, Ref x) throws SQLException {
+ protected final void updateRef(final String columnLabel, final Ref x) throws SQLException {
rs.updateRef(columnLabel, x);
}
@@ -1843,7 +1843,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateRowId(int, java.sql.RowId)
*/
- protected final void updateRowId(int columnIndex, RowId x) throws SQLException {
+ protected final void updateRowId(final int columnIndex, final RowId x) throws SQLException {
rs.updateRowId(columnIndex, x);
}
@@ -1853,7 +1853,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId)
*/
- protected final void updateRowId(String columnLabel, RowId x) throws SQLException {
+ protected final void updateRowId(final String columnLabel, final RowId x) throws SQLException {
rs.updateRowId(columnLabel, x);
}
@@ -1863,7 +1863,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML)
*/
- protected final void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
+ protected final void updateSQLXML(final int columnIndex, final SQLXML xmlObject) throws SQLException {
rs.updateSQLXML(columnIndex, xmlObject);
}
@@ -1873,7 +1873,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML)
*/
- protected final void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {
+ protected final void updateSQLXML(final String columnLabel, final SQLXML xmlObject) throws SQLException {
rs.updateSQLXML(columnLabel, xmlObject);
}
@@ -1883,7 +1883,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateShort(int, short)
*/
- protected final void updateShort(int columnIndex, short x) throws SQLException {
+ protected final void updateShort(final int columnIndex, final short x) throws SQLException {
rs.updateShort(columnIndex, x);
}
@@ -1893,7 +1893,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateShort(java.lang.String, short)
*/
- protected final void updateShort(String columnLabel, short x) throws SQLException {
+ protected final void updateShort(final String columnLabel, final short x) throws SQLException {
rs.updateShort(columnLabel, x);
}
@@ -1903,7 +1903,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateString(int, java.lang.String)
*/
- protected final void updateString(int columnIndex, String x) throws SQLException {
+ protected final void updateString(final int columnIndex, final String x) throws SQLException {
rs.updateString(columnIndex, x);
}
@@ -1913,7 +1913,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
*/
- protected final void updateString(String columnLabel, String x) throws SQLException {
+ protected final void updateString(final String columnLabel, final String x) throws SQLException {
rs.updateString(columnLabel, x);
}
@@ -1923,7 +1923,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateTime(int, java.sql.Time)
*/
- protected final void updateTime(int columnIndex, Time x) throws SQLException {
+ protected final void updateTime(final int columnIndex, final Time x) throws SQLException {
rs.updateTime(columnIndex, x);
}
@@ -1933,7 +1933,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
*/
- protected final void updateTime(String columnLabel, Time x) throws SQLException {
+ protected final void updateTime(final String columnLabel, final Time x) throws SQLException {
rs.updateTime(columnLabel, x);
}
@@ -1943,7 +1943,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
*/
- protected final void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+ protected final void updateTimestamp(final int columnIndex, final Timestamp x) throws SQLException {
rs.updateTimestamp(columnIndex, x);
}
@@ -1953,7 +1953,7 @@ public abstract class BaseResultSetHandler<T> implements ResultSetHandler<T> {
* @throws SQLException
* @see java.sql.ResultSet#updateTimestamp(java.lang.String, java.sql.Timestamp)
*/
- protected final void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
+ protected final void updateTimestamp(final String columnLabel, final Timestamp x) throws SQLException {
rs.updateTimestamp(columnLabel, x);
}