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 2025/02/09 20:05:16 UTC
(commons-io) 09/14: Add Checkstyle ExplicitInitialization
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit 9dde9e3e94ccab163043ddc6667db7bbf29191b6
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 9 14:01:01 2025 -0500
Add Checkstyle ExplicitInitialization
---
src/conf/checkstyle.xml | 1 +
.../apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java | 3 ++-
.../org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java | 3 ++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 9c76b1612..8926a7f22 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -42,6 +42,7 @@ limitations under the License.
<property name="option" value="text" />
</module>
<module name="EqualsHashCode" />
+ <module name="ExplicitInitialization" />
<module name="FinalLocalVariable" />
<module name="ImportOrder">
<property name="option" value="top"/>
diff --git a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
index d2e969caf..f98906388 100644
--- a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedInputStreamTest.java
@@ -297,7 +297,8 @@ public void test_read() throws IOException {
assertTrue(new String(buf1, 0, buf1.length).equals(DATA.substring(3000, 3100)), "Failed to read correct data");
try (UnsynchronizedBufferedInputStream bufin = builder().setInputStream(new InputStream() {
- int size = 2, pos = 0;
+ int size = 2;
+ int pos;
byte[] contents = new byte[size];
diff --git a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java
index 6f6ed3fdb..a4b595550 100644
--- a/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java
+++ b/src/test/java/org/apache/commons/io/input/UnsynchronizedBufferedReaderTest.java
@@ -383,7 +383,8 @@ public void testReadArray() throws IOException {
assertTrue(new String(buf, 50, 500).equals(testString.substring(0, 500)));
try (UnsynchronizedBufferedReader bufin = new UnsynchronizedBufferedReader(new Reader() {
- int size = 2, pos = 0;
+ int size = 2;
+ int pos;
char[] contents = new char[size];