Skip to content

Commit

Permalink
Don't initialize an instance or static variable to its default value
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 27, 2023
1 parent d6db61a commit 39a6a83
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/conf/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

<module name="TreeWalker">

<module name="ExplicitInitializationCheck" />
<!-- ************************************************************** -->
<!-- Checks that are different from the sun coding conventions ones -->
<!-- ************************************************************** -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class AbstractQueryRunner {
* Is {@link ParameterMetaData#getParameterType(int)} broken (have we tried
* it yet)?
*/
private volatile boolean pmdKnownBroken = false;
private volatile boolean pmdKnownBroken;

/**
* The DataSource to retrieve connections from.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/dbutils/OutParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class OutParameter<T> {
private final int sqlType;
private final Class<T> javaType;
private T value = null;
private T value;

/**
* Construct an {@code OutParameter} for the given JDBC SQL type and
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/apache/commons/dbutils/BaseTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ public class BaseTestCase extends TestCase {
/**
* The ResultSet all test methods will use.
*/
protected ResultSet rs = null;
protected ResultSet rs;

/**
* A ResultSet with 0 rows.
*/
protected ResultSet emptyResultSet = null;
protected ResultSet emptyResultSet;

/**
* Creates a freshly initialized ResultSet.
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/apache/commons/dbutils/MockResultSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public static ResultSet create(final ResultSetMetaData metaData,

private Object[] currentRow = null;

private Iterator<Object[]> iter = null;
private Iterator<Object[]> iter;

private ResultSetMetaData metaData = null;
private ResultSetMetaData metaData;

private Boolean wasNull = Boolean.FALSE;

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/apache/commons/dbutils/TestBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ public enum Ordinal {

}

private String one = null;
private String one;

private String two = null;
private String two;

private Ordinal three = null;
private Ordinal three;

private int intTest = 0;
private int intTest;

private Integer integerTest = Integer.valueOf(0);

// UNUSED private Timestamp timestamp = null;
// UNUSED private Timestamp timestamp;

private String doNotSet = "not set";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private static void assertArrayEquals(final byte[] expected, final byte[] actual
}
}

private SqlNullCheckedResultSet rs2 = null;
private SqlNullCheckedResultSet rs2;

/**
* Sets up instance variables required by this test case.
Expand Down

0 comments on commit 39a6a83

Please sign in to comment.