Skip to content

build(pom): Bump modernizer-maven-plugin from 2.7.0 to 3.5.0 - #919

Merged
jeffjensen merged 1 commit into
mainfrom
jj-bump-modernizer
Aug 8, 2026
Merged

jeffjensen merged 1 commit into
mainfrom
jj-bump-modernizer

Conversation

@jeffjensen

@jeffjensen jeffjensen commented Aug 8, 2026

Copy link
Copy Markdown
Member

Update lots of code to comply.

Summary by Sourcery

Modernize file, URL, and SQL handling across core CSV/XML/Excel/YAML utilities and tests to comply with updated static analysis rules, and bump the modernizer Maven plugin version.

Enhancements:

  • Replace legacy java.io File* and stream usage with java.nio.file Paths/Files APIs throughout core code for safer resource handling.
  • Introduce a robust URL resolution helper for CSV producers that avoids deprecated URL constructors and correctly supports jar: URLs and opaque bases.
  • Simplify string tokenization logic (SQL fragments, CSV, DTD models, config properties) using String.split and modern collections APIs, and adjust primary-key sorting to use Comparator-based List.sort.
  • Tighten type handling and exception mapping around bytes and Base64 utilities, including updated file/URL loading and Boolean boxing.

Build:

  • Update org.gaul:modernizer-maven-plugin from 2.7.0 to 3.5.0 in the Maven build configuration.

Documentation:

  • Record the modernizer-maven-plugin upgrade in the changes.xml release notes.

Tests:

  • Refresh a wide range of tests to use Paths/Files, UTF-8 readers/writers, and updated URL handling, ensuring compatibility with the modernized core APIs and preventing resource leaks.

Summary by CodeRabbit

  • Bug Fixes

    • Improved CSV dataset loading from relative, hierarchical, and archive-based URLs.
    • Ensured CSV, XML, JSON, YAML, and spreadsheet file handling consistently supports UTF-8 encoding.
    • Improved path resolution and file access reliability across import, export, and dataset operations.
    • Improved handling of text values that resemble invalid file paths.
  • Chores

    • Updated the Modernizer build tooling to a newer version.
    • Refined SQL, DTD, and configuration parsing while preserving existing behavior.

@jeffjensen jeffjensen linked an issue Aug 8, 2026 that may be closed by this pull request
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai

sourcery-ai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR bumps modernizer-maven-plugin to 3.5.0 and updates the codebase to comply with newer modernizer rules by replacing legacy java.io usage with java.nio.file APIs, removing deprecated URL and StringTokenizer patterns, tightening exception and collection handling, and adjusting tests/utilities accordingly.

Sequence diagram for CSV URL resolution using CsvProducer.resolveRelative

sequenceDiagram
    actor Client
    participant CsvURLProducer
    participant CsvProducer
    participant URL

    Client->>CsvURLProducer: produce(base, tableList)
    CsvURLProducer->>CsvProducer: getTables(base, tableList)
    CsvProducer->>CsvProducer: resolveRelative(base, tableList)
    CsvProducer->>URL: openStream()
    URL-->>CsvProducer: InputStream tableListStream
    CsvProducer-->>CsvURLProducer: List orderedNames

    loop for each table in orderedNames
        CsvURLProducer->>CsvProducer: resolveRelative(base, table + ".csv")
        CsvProducer-->>CsvURLProducer: URL tableUrl
        CsvURLProducer->>CsvURLProducer: produceFromURL(tableUrl)
    end
Loading

File-Level Changes

Change Details Files
Replace legacy File/FileInputStream/FileOutputStream/FileReader/FileWriter usage with java.nio.file Paths/Files and charset-aware Readers/Writers across main code and tests, improving modern API usage and resource handling.
  • Construct File instances via Paths.get(...).toFile() instead of new File(...).
  • Open streams and channels with Files.newInputStream, Files.newOutputStream, and FileChannel.open(path) instead of FileInputStream/FileOutputStream.
  • Create temp files/directories using Files.createTempFile and then toFile() instead of File.createTempFile/new File.
  • Use Files.newBufferedReader with explicit StandardCharsets.UTF_8 where text is read or written, replacing FileReader/FileWriter.
  • Update utility helpers (TestUtils, FileHelper, FileAsserts, Export, CsvDataSetWriter, etc.) to centralize the new path/stream usage.
src/main/java/org/dbunit/dataset/csv/CsvProducer.java
src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
src/main/java/org/dbunit/dataset/datatype/BytesDataType.java
src/main/java/org/dbunit/testutil/TestUtils.java
src/main/java/org/dbunit/util/FileHelper.java
src/main/java/org/dbunit/util/Base64.java
src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java
src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java
src/main/java/org/dbunit/ant/Export.java
src/main/java/org/dbunit/ant/Operation.java
src/test/java/org/dbunit/testutil/FileAsserts.java
src/test/java/org/dbunit/util/FileHelperTest.java
src/test/java/org/dbunit/dataset/xml/XmlDataSetTest.java
src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java
src/test/java/org/dbunit/operation/UpdateOperationIT.java
src/test/java/org/dbunit/dataset/excel/XlsTableWriteTest.java
src/test/java/org/dbunit/dataset/json/JsonDataSetTest.java
src/test/java/org/dbunit/dataset/yaml/YmlDataSetTest.java
src/test/java/org/dbunit/operation/DeleteOperationIT.java
src/test/java/org/dbunit/operation/InsertOperationIT.java
src/test/java/org/dbunit/operation/TransactionOperationIT.java
src/test/java/org/dbunit/DdlExecutor.java
src/test/java/org/dbunit/ant/ExportTest.java
src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java
src/test/java/org/dbunit/dataset/xml/FlatDtdDataSetIT.java
src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java
src/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.java
src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java
src/test/java/org/dbunit/dataset/excel/XlsDataSetTest.java
src/test/java/org/dbunit/dataset/csv/CsvDataSetWriterTest.java
src/test/java/org/dbunit/dataset/xml/FlatXmlDataSetTest.java
src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java
src/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.java
src/test/java/org/dbunit/dataset/CachedDataSetTest.java
src/test/java/org/dbunit/dataset/stream/StreamingTableTest.java
src/test/java/org/dbunit/dataset/CaseInsensitiveTableTest.java
src/test/java/org/dbunit/dataset/TableDecoratorDataSetTest.java
src/test/java/org/dbunit/operation/CompositeOperationIT.java
src/test/java/org/dbunit/DatabaseEnvironment.java
src/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.java
src/test/java/org/dbunit/dataset/LowerCaseDataSetTest.java
src/test/java/org/dbunit/dataset/stream/StreamingDataSetTest.java
src/test/java/org/dbunit/dataset/xml/XmlTableTest.java
src/test/java/org/dbunit/dataset/yaml/YmlTableTest.java
src/test/java/org/dbunit/dataset/json/JsonTableTest.java
src/test/java/org/dbunit/dataset/xml/FlatDtdProducerTest.java
src/test/java/org/dbunit/ant/DbUnitTaskIT.java
src/test/java/org/dbunit/ant/adapter/BuildFileExtension.java
src/test/java/org/dbunit/DerbyEnvironment.java
src/test/java/org/dbunit/H2Environment.java
src/test/java/org/dbunit/HypersonicEnvironment.java
Eliminate deprecated or problematic URL and URI usage, adding robust relative-resolution helpers and jar URL handling for CSV producers.
  • Replace new URL(base, spec) with a new resolveRelative(URL, String) helper that uses URI.resolve for hierarchical URLs and manual scheme-specific-part concatenation for opaque jar: URLs.
  • Update CsvProducer.getTables and CsvURLProducer.produce to call resolveRelative when constructing table list and table CSV URLs.
  • Construct jar: URLs in tests via new URI(...).toURL() instead of string-based URL construction.
  • Wrap URI syntax issues when parsing URL strings in BytesDataType.loadURL as MalformedURLException with cause preserved.
src/main/java/org/dbunit/dataset/csv/CsvProducer.java
src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java
src/main/java/org/dbunit/dataset/datatype/BytesDataType.java
src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java
Replace legacy StringTokenizer usage and manual string processing with String.split and modern collection utilities, clarifying token handling and edge cases.
  • Use String.split(",") when parsing column lists in SqlLoaderControlParserImpl and guard against empty tokens.
  • Replace StringTokenizer-based quote escaping in DataSetUtils.getSqlValueString with a simpler stringValue.replace("'", "''") approach.
  • Parse comma-separated unsupported feature lists in DatabaseProfile using String.split and ignore empty entries.
  • Split root element models and SQL statements using String.split plus trimming instead of StringTokenizer in FlatDtdProducer and DdlExecutor.
  • Simplify BatchStatementDecorator template construction by using sql.split("\?", -1) to preserve trailing empty segments.
src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
src/main/java/org/dbunit/dataset/DataSetUtils.java
src/test/java/org/dbunit/DatabaseProfile.java
src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
src/test/java/org/dbunit/dataset/xml/FlatDtdProducerTest.java
src/test/java/org/dbunit/DdlExecutor.java
src/main/java/org/dbunit/database/statement/BatchStatementDecorator.java
Tighten miscellaneous APIs and behaviors to match modern expectations (collections, boxing, URL/file resolution) and ensure tests match the new behavior.
  • Sort primary key name lists via list.sort(Comparator.naturalOrder()) instead of Collections.sort in DatabaseTableMetaData.
  • Avoid redundant Boolean boxing in PropertyChangeMulticaster by passing primitive boolean values directly to PropertyChangeEvent.
  • Resolve FileSet entries and various paths via baseDir.toPath().resolve(...) or Paths.get(...), improving path correctness in Ant operations and environments.
  • Adjust CsvParserImpl and CsvParserTest to open sample files via Files.newInputStream and ensure consistent encoding handling.
  • Update CompositeDataSet and DbUnitValueComparerAssert tests to throw IOException rather than FileNotFoundException in signatures, reflecting modern I/O usage.
src/main/java/org/dbunit/database/DatabaseTableMetaData.java
src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java
src/main/java/org/dbunit/ant/Operation.java
src/test/java/org/dbunit/DerbyEnvironment.java
src/test/java/org/dbunit/H2Environment.java
src/test/java/org/dbunit/HypersonicEnvironment.java
src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java
src/test/java/org/dbunit/dataset/csv/CsvParserTest.java
src/test/java/org/dbunit/dataset/CompositeDataSetTest.java
src/test/java/org/dbunit/assertion/DbUnitValueComparerAssertIT.java
Update build metadata and change logs to reflect the modernizer plugin bump and ensure release notes track the dependency change.
  • Bump the modernizer-maven-plugin property in pom.xml from 2.7.0 to 3.5.0.
  • Add a changes.xml release note entry documenting the modernizer-maven-plugin version update as issue 732.
pom.xml
src/changes/changes.xml

Assessment against linked issues

Issue Objective Addressed Explanation
#732 Update the build configuration to bump modernizer-maven-plugin from version 2.7.0 to 3.5.0.
#732 Refactor code to resolve all issues reported by the newer modernizer plugin (e.g., deprecated APIs, outdated patterns) so the project complies with the updated plugin.
#732 Update project documentation/changelog to reflect the modernizer-maven-plugin version bump.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jeffjensen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 92f382c1-7d62-4d16-a92e-7370980d59fb

📥 Commits

Reviewing files that changed from the base of the PR and between 0793756 and 1011291.

📒 Files selected for processing (1)
  • src/test/java/org/dbunit/Main.java
📝 Walkthrough

Walkthrough

The pull request upgrades the Modernizer Maven Plugin to 3.5.0 and replaces legacy Java file, URL, tokenizer, and boxing APIs with NIO, URI, explicit UTF-8 handling, direct string splitting, and primitive values.

Changes

Java API modernization

Layer / File(s) Summary
Build and core logic modernization
pom.xml, src/changes/changes.xml, src/main/java/org/dbunit/database/..., src/main/java/org/dbunit/dataset/DataSetUtils.java, src/main/java/org/dbunit/database/statement/...
The Modernizer plugin is upgraded. Core sorting, SQL template parsing, SQL literal escaping, path construction, and event creation use modern Java APIs.
Production file and URL access
src/main/java/org/dbunit/ant/..., src/main/java/org/dbunit/dataset/..., src/main/java/org/dbunit/util/...
Production code replaces legacy file streams and path construction with NIO APIs. CSV URL resolution supports hierarchical and opaque URLs. CSV output and CSV input use UTF-8.
Test environment and dataset access
src/test/java/org/dbunit/Database*, src/test/java/org/dbunit/ant/..., src/test/java/org/dbunit/dataset/...
Tests use NIO paths and streams. XML and SQL readers use explicit UTF-8 decoding.
Format and integration test migration
src/test/java/org/dbunit/dataset/{csv,excel,json,stream,xml,yaml}/..., src/test/java/org/dbunit/operation/...
Format and operation tests use NIO file creation, reading, writing, temporary-file APIs, and URI construction.
Shared test utility updates
src/test/java/org/dbunit/testutil/..., src/test/java/org/dbunit/util/FileHelperTest.java
Test utility methods now return general reader and input-stream types and declare IOException. Path resolution uses NIO APIs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary build change: upgrading the Modernizer Maven Plugin from 2.7.0 to 3.5.0.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jj-bump-modernizer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java" line_range="148-150" />
<code_context>
      */
     public List parse(URL url) throws IOException, SqlLoaderControlParserException {
         logger.debug("parse(url={}) - start", url);
-        return parse(new File(url.toString()));
+        return parse(Paths.get(url.toString()).toFile());
     }

</code_context>
<issue_to_address>
**issue (bug_risk):** Using Paths.get(url.toString()) is likely incorrect for non-file URLs and even for file: URLs.

This change introduces a new failure mode: a `file:` URL like `file:/tmp/foo.ctl` becomes the literal path `"file:/tmp/foo.ctl"`, which `Paths.get` may reject with `InvalidPathException`. For HTTP or other non-file URLs, interpreting them as filesystem paths is also incorrect. If this method is meant to handle `file:` URLs, use `Paths.get(url.toURI()).toFile()`. If it must handle arbitrary URLs, prefer resolving via `url.openStream()` and a corresponding `parse(InputStream)` overload instead of path-based resolution.
</issue_to_address>

### Comment 2
<location path="src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java" line_range="169-171" />
<code_context>
-        FileInputStream fis = new FileInputStream(controlFile);
-
-        FileChannel fc = fis.getChannel();
+        FileChannel fc = FileChannel.open(controlFile.toPath());

         MappedByteBuffer mbf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
         byte[] barray = new byte[(int) (fc.size())];
</code_context>
<issue_to_address>
**issue (bug_risk):** FileChannel opened from the control file is never closed, leading to a resource leak.

Because `FileChannel.open` is used directly, the channel is no longer closed when the old `FileInputStream` was closed. As written, `fc` is never closed, which can leak file descriptors and leave the control file locked. Please wrap the channel in a try-with-resources block (e.g. `try (FileChannel fc = FileChannel.open(...)) { ... }`) so it is always closed after use.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java Outdated
Comment thread src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java (1)

115-151: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add JavaDoc for the changed public methods.

  • src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java#L115-L151: Document startDataSet, endDataSet, and startTable.
  • src/main/java/org/dbunit/dataset/csv/CsvProducer.java#L96-L96: Document produce.
  • src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java#L107-L107: Document produce.
  • src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java#L329-L334: Document endDTD.

As per coding guidelines, write JavaDoc comments on all public classes and methods; use complete sentences beginning with a capital letter and ending with a period.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java` around lines 115
- 151, src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java lines 115-151:
Add complete-sentence JavaDoc to the public methods startDataSet, endDataSet,
and startTable. Add equivalent JavaDoc to produce in
src/main/java/org/dbunit/dataset/csv/CsvProducer.java lines 96-96 and
src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java lines 107-107, and to
endDTD in src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java lines
329-334; each comment must begin with a capital letter and end with a period.

Source: Coding guidelines

src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java (1)

169-173: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Close the FileChannel.

FileChannel.open(controlFile.toPath()) opens this parser, but parse(File) never closes it after reading the control file. Wrap the open/channels in try-with-resources so repeated parses do not leak file descriptors and keep files locked.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java`
around lines 169 - 173, Update parse(File) to manage the FileChannel opened for
controlFile with try-with-resources, keeping the map and byte-array reading
inside the resource scope. Preserve the existing parsing behavior while ensuring
the channel is closed on both successful and exceptional paths.
🧹 Nitpick comments (3)
src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java (1)

62-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an AssertJ failure description at Line 62.

The assertion has no .as() message. Add a message that ends with a period.

Proposed assertion
-        assertThat(dataSet.isCaseSensitiveTableNames()).isTrue();
+        assertThat(dataSet.isCaseSensitiveTableNames())
+                .as("ReplacementDataSet must preserve case-sensitive table names.")
+                .isTrue();

As per coding guidelines, add .as() failure messages ending with a period.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java` at line 62, Add
an AssertJ .as() failure description to the isCaseSensitiveTableNames()
assertion, using a clear message that ends with a period.

Source: Coding guidelines

src/test/java/org/dbunit/testutil/TestUtils.java (2)

53-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split the chained path operations.

The modified methods combine path creation with conversion or stream opening, such as Paths.get(...).toFile() and Files.newBufferedReader(Paths.get(...), ...). Assign each path to a final Path local, then convert or open it in a separate statement.

As per coding guidelines, prefer separate local variables and single statements instead of nested compound calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/java/org/dbunit/testutil/TestUtils.java` around lines 53 - 80, Split
the chained path operations in getFileForDatabaseEnvironment, getFileReader, and
getFileInputStream by assigning each Paths.get(...) result to a final Path
local, then perform toFile(), newBufferedReader(...), or newInputStream(...) in
a separate statement. Preserve the existing profile-file fallback and UTF-8
reader behavior.

Source: Coding guidelines


53-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Split nested path operations into named locals across the shared test utilities.

The same readability violation appears in the utility and both test setups. Use final Path locals for path resolution, then perform conversion, opening, or writing in separate statements.

  • src/test/java/org/dbunit/testutil/TestUtils.java#L53-L80: assign Paths.get(...) results to final Path locals before calling toFile(), Files.newBufferedReader(...), or Files.newInputStream(...).
  • src/test/java/org/dbunit/util/FileHelperTest.java#L40-L43: assign temporary, source, destination, and content values to final locals before conversion and writing.
  • src/test/java/org/dbunit/util/FileHelperTest.java#L56-L61: assign source and destination-directory paths to final Path locals before converting them to File.

As per coding guidelines, prefer separate local variables and single statements instead of nested compound calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/test/java/org/dbunit/testutil/TestUtils.java` around lines 53 - 80, Split
nested path operations into final local variables at TestUtils.java:53-80, using
Path locals in getFileForDatabaseEnvironment, getFileReader, and
getFileInputStream before converting or opening files; apply the same
separate-local pattern at FileHelperTest.java:40-43 for temporary, source,
destination, and content values, and at FileHelperTest.java:56-61 for source and
destination-directory paths before converting to File. Preserve existing
behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java`:
- Around line 125-129: Update CsvProducer.getTables() to construct
InputStreamReader with StandardCharsets.UTF_8 when reading the table-ordering
file, matching the UTF-8 encoding written by CsvDataSetWriter.endDataSet().

In `@src/main/java/org/dbunit/dataset/datatype/BytesDataType.java`:
- Line 300: Update the catch handling around loadFile in BytesDataType so only
NoSuchFileException triggers the missing-file Base64/UTF-8 literal fallback;
allow other IOException failures, including directory, read, and permission
errors, to propagate to the existing conversion result instead of persisting
stringValue as blob content.

In `@src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java`:
- Line 150: Update the URL-based parse flow in SqlLoaderControlParserImpl to
convert file URLs with url.toURI() before creating the Path, wrapping any
URISyntaxException as IOException. Ensure the FileChannel opened for mapping the
control file is closed via try-with-resources before returning the parsed
result, and add coverage using
SqlLoaderControlParserImpl.parse(controlFile.toURI().toURL()).

In `@src/test/java/org/dbunit/DatabaseEnvironment.java`:
- Line 188: Wrap the reader created in DatabaseEnvironment’s XmlDataSet
initialization with try-with-resources so it is closed after construction. Also
update CompositeDataSetIterationIT’s FlatXmlDataSet.write call to wrap the
Files.newOutputStream resource in try-with-resources and close it after writing;
apply the changes at both affected sites.

In `@src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java`:
- Around line 27-28: Update CsvDataSetTest temporary-directory setup to use
Files.createTempDirectory("CsvDataSetTest").toFile() directly, replacing the
createTempFile/delete/mkdir sequence and preserving the resulting directory
usage.

In `@src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java`:
- Around line 237-242: Update the AssertJ descriptions in the test around
ordersFile and ordersRowFile so each is a complete sentence ending with a
period, and correct “does not exists” to “does not exist.”

In `@src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java`:
- Around line 81-85: Update
testProduceFromJar_withJarFileUrl_returnsTwoTablesWithCorrectRowCounts to build
the JAR URI using file.toURI() instead of the deprecated file.toURL(),
preserving the existing jar URL structure and test behavior.

In `@src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java`:
- Around line 52-53: Close all test-owned I/O resources with try-with-resources:
in src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java lines 52-53,
keep the OutputStream open through XlsDataSet.write(...); in
src/test/java/org/dbunit/operation/CompositeOperationIT.java lines 50-51, keep
the Reader open through operation.execute(...); and in
src/test/java/org/dbunit/operation/UpdateOperationIT.java lines 266-267,
277-278, 287-288, and 325-326, keep each XML Reader open through its read or
DatabaseOperation.UPDATE.execute(...) call. Use the existing test operations
without other behavioral changes.

In `@src/test/java/org/dbunit/dataset/json/JsonTableTest.java`:
- Around line 51-53: Update the createDataSet method to wrap the JSON fixture
InputStream in try-with-resources, ensuring it is closed after constructing the
JsonDataSet; follow the existing pattern in JsonDataSetTest.createDataSet.

In `@src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java`:
- Around line 94-95: Update the temporary-file creation in FlatXmlTableWriteTest
to pass the suffix ".xml" instead of "xml", preserving the expected XML filename
extension while leaving the writer setup unchanged.

---

Outside diff comments:
In `@src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java`:
- Around line 115-151:
src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java lines 115-151: Add
complete-sentence JavaDoc to the public methods startDataSet, endDataSet, and
startTable. Add equivalent JavaDoc to produce in
src/main/java/org/dbunit/dataset/csv/CsvProducer.java lines 96-96 and
src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java lines 107-107, and to
endDTD in src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java lines
329-334; each comment must begin with a capital letter and end with a period.

In `@src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java`:
- Around line 169-173: Update parse(File) to manage the FileChannel opened for
controlFile with try-with-resources, keeping the map and byte-array reading
inside the resource scope. Preserve the existing parsing behavior while ensuring
the channel is closed on both successful and exceptional paths.

---

Nitpick comments:
In `@src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java`:
- Line 62: Add an AssertJ .as() failure description to the
isCaseSensitiveTableNames() assertion, using a clear message that ends with a
period.

In `@src/test/java/org/dbunit/testutil/TestUtils.java`:
- Around line 53-80: Split the chained path operations in
getFileForDatabaseEnvironment, getFileReader, and getFileInputStream by
assigning each Paths.get(...) result to a final Path local, then perform
toFile(), newBufferedReader(...), or newInputStream(...) in a separate
statement. Preserve the existing profile-file fallback and UTF-8 reader
behavior.
- Around line 53-80: Split nested path operations into final local variables at
TestUtils.java:53-80, using Path locals in getFileForDatabaseEnvironment,
getFileReader, and getFileInputStream before converting or opening files; apply
the same separate-local pattern at FileHelperTest.java:40-43 for temporary,
source, destination, and content values, and at FileHelperTest.java:56-61 for
source and destination-directory paths before converting to File. Preserve
existing behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fbc43ceb-0796-4508-b981-69af6c28d652

📥 Commits

Reviewing files that changed from the base of the PR and between 1f0d883 and 482fc7c.

📒 Files selected for processing (71)
  • pom.xml
  • src/changes/changes.xml
  • src/main/java/org/dbunit/ant/Export.java
  • src/main/java/org/dbunit/ant/Operation.java
  • src/main/java/org/dbunit/database/DatabaseTableMetaData.java
  • src/main/java/org/dbunit/database/statement/BatchStatementDecorator.java
  • src/main/java/org/dbunit/dataset/DataSetUtils.java
  • src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java
  • src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java
  • src/main/java/org/dbunit/dataset/csv/CsvProducer.java
  • src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java
  • src/main/java/org/dbunit/dataset/datatype/BytesDataType.java
  • src/main/java/org/dbunit/dataset/excel/XlsDataSet.java
  • src/main/java/org/dbunit/dataset/json/JsonProducer.java
  • src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
  • src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.java
  • src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
  • src/main/java/org/dbunit/dataset/yaml/YamlProducer.java
  • src/main/java/org/dbunit/util/Base64.java
  • src/main/java/org/dbunit/util/FileHelper.java
  • src/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.java
  • src/test/java/org/dbunit/DatabaseEnvironment.java
  • src/test/java/org/dbunit/DatabaseProfile.java
  • src/test/java/org/dbunit/DdlExecutor.java
  • src/test/java/org/dbunit/DerbyEnvironment.java
  • src/test/java/org/dbunit/H2Environment.java
  • src/test/java/org/dbunit/HypersonicEnvironment.java
  • src/test/java/org/dbunit/Main.java
  • src/test/java/org/dbunit/ant/DbUnitTaskIT.java
  • src/test/java/org/dbunit/ant/ExportTest.java
  • src/test/java/org/dbunit/ant/adapter/BuildFileExtension.java
  • src/test/java/org/dbunit/assertion/DbUnitValueComparerAssertIT.java
  • src/test/java/org/dbunit/dataset/CachedDataSetTest.java
  • src/test/java/org/dbunit/dataset/CaseInsensitiveTableTest.java
  • src/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.java
  • src/test/java/org/dbunit/dataset/CompositeDataSetTest.java
  • src/test/java/org/dbunit/dataset/FilteredDataSetTest.java
  • src/test/java/org/dbunit/dataset/LowerCaseDataSetTest.java
  • src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java
  • src/test/java/org/dbunit/dataset/TableDecoratorDataSetTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvDataSetWriterTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvParserTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java
  • src/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsDataSetTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsTableTimezoneOffsetTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsTableWriteTest.java
  • src/test/java/org/dbunit/dataset/json/JsonDataSetTest.java
  • src/test/java/org/dbunit/dataset/json/JsonTableTest.java
  • src/test/java/org/dbunit/dataset/stream/StreamingDataSetTest.java
  • src/test/java/org/dbunit/dataset/stream/StreamingTableTest.java
  • src/test/java/org/dbunit/dataset/xml/FlatDtdDataSetIT.java
  • src/test/java/org/dbunit/dataset/xml/FlatDtdProducerTest.java
  • src/test/java/org/dbunit/dataset/xml/FlatXmlDataSetTest.java
  • src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java
  • src/test/java/org/dbunit/dataset/xml/XmlDataSetTest.java
  • src/test/java/org/dbunit/dataset/xml/XmlTableTest.java
  • src/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.java
  • src/test/java/org/dbunit/dataset/yaml/YmlDataSetTest.java
  • src/test/java/org/dbunit/dataset/yaml/YmlTableTest.java
  • src/test/java/org/dbunit/operation/CompositeOperationIT.java
  • src/test/java/org/dbunit/operation/DeleteOperationIT.java
  • src/test/java/org/dbunit/operation/InsertOperationIT.java
  • src/test/java/org/dbunit/operation/TransactionOperationIT.java
  • src/test/java/org/dbunit/operation/UpdateOperationIT.java
  • src/test/java/org/dbunit/testutil/FileAsserts.java
  • src/test/java/org/dbunit/testutil/TestUtils.java
  • src/test/java/org/dbunit/util/FileHelperTest.java

Comment thread src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java
Comment thread src/main/java/org/dbunit/dataset/datatype/BytesDataType.java Outdated
Comment thread src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java Outdated
Comment thread src/test/java/org/dbunit/DatabaseEnvironment.java Outdated
Comment thread src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java Outdated
Comment thread src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java Outdated
Comment thread src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java Outdated
Comment thread src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java Outdated
Comment thread src/test/java/org/dbunit/dataset/json/JsonTableTest.java Outdated
Comment thread src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java (1)

104-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use separate local variables for the new nested calls.

The same readability issue appears in both production files.

  • src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java#L104-L105: assign the input stream, reader, and buffered reader separately.
  • src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java#L117-L118: assign the URL stream, reader, and buffered reader separately.
  • src/main/java/org/dbunit/dataset/datatype/BytesDataType.java#L138-L138: assign the file stream before calling toByteArray.
  • src/main/java/org/dbunit/dataset/datatype/BytesDataType.java#L154-L154: assign the URI before calling toURL.
  • src/main/java/org/dbunit/dataset/datatype/BytesDataType.java#L375-L375: assign the file stream before calling toByteArray.

As per coding guidelines, prefer clear, readable Java code: use separate local variables and single statements instead of nested compound calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java` around lines 104 -
105, Replace nested resource and conversion calls with separate local-variable
assignments: in CsvParserImpl at lines 104-105, split input stream, reader, and
buffered reader creation; at lines 117-118, split URL stream, reader, and
buffered reader creation. In BytesDataType at lines 138 and 375, assign the file
stream before toByteArray; at line 154, assign the URI before toURL. Preserve
existing resource handling and behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/test/java/org/dbunit/Main.java`:
- Around line 123-126: Update testFlatXmlWriter, testXmlWriter, oldMain, and
writeXls to manage every opened Reader, Writer, and OutputStream with
try-with-resources, ensuring cleanup occurs on exceptions; preserve the existing
write/flush behavior while eliminating manual close-only-on-success paths, and
use separate Path locals for Files operations.

---

Nitpick comments:
In `@src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java`:
- Around line 104-105: Replace nested resource and conversion calls with
separate local-variable assignments: in CsvParserImpl at lines 104-105, split
input stream, reader, and buffered reader creation; at lines 117-118, split URL
stream, reader, and buffered reader creation. In BytesDataType at lines 138 and
375, assign the file stream before toByteArray; at line 154, assign the URI
before toURL. Preserve existing resource handling and behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8651b51d-4ba3-4579-a80a-4f24ac8d777e

📥 Commits

Reviewing files that changed from the base of the PR and between 482fc7c and 0793756.

📒 Files selected for processing (23)
  • src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java
  • src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java
  • src/main/java/org/dbunit/dataset/csv/CsvProducer.java
  • src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java
  • src/main/java/org/dbunit/dataset/datatype/BytesDataType.java
  • src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
  • src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
  • src/test/java/org/dbunit/DatabaseEnvironment.java
  • src/test/java/org/dbunit/Main.java
  • src/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.java
  • src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java
  • src/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java
  • src/test/java/org/dbunit/dataset/json/JsonTableTest.java
  • src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java
  • src/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.java
  • src/test/java/org/dbunit/operation/CompositeOperationIT.java
  • src/test/java/org/dbunit/operation/UpdateOperationIT.java
  • src/test/java/org/dbunit/testutil/TestUtils.java
  • src/test/java/org/dbunit/util/FileHelperTest.java
🚧 Files skipped from review as they are similar to previous changes (20)
  • src/test/java/org/dbunit/dataset/json/JsonTableTest.java
  • src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java
  • src/test/java/org/dbunit/util/FileHelperTest.java
  • src/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.java
  • src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java
  • src/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.java
  • src/test/java/org/dbunit/operation/UpdateOperationIT.java
  • src/test/java/org/dbunit/operation/CompositeOperationIT.java
  • src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java
  • src/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.java
  • src/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.java
  • src/test/java/org/dbunit/dataset/csv/CsvProducerTest.java
  • src/test/java/org/dbunit/DatabaseEnvironment.java
  • src/test/java/org/dbunit/dataset/ReplacementDataSetTest.java
  • src/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.java
  • src/main/java/org/dbunit/dataset/csv/CsvProducer.java
  • src/test/java/org/dbunit/dataset/csv/CsvDataSetTest.java
  • src/test/java/org/dbunit/testutil/TestUtils.java
  • src/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.java
  • src/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.java

Comment thread src/test/java/org/dbunit/Main.java Outdated
Update lots of code to comply.

Refs: 732
@jeffjensen
jeffjensen merged commit 5cf36d0 into main Aug 8, 2026
29 checks passed
@jeffjensen
jeffjensen deleted the jj-bump-modernizer branch August 8, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bump modernizer plugin and resolve all code issues

1 participant