build(pom): Bump modernizer-maven-plugin from 2.7.0 to 3.5.0 - #919
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's GuideThis 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.resolveRelativesequenceDiagram
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
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe 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. ChangesJava API modernization
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
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 winAdd JavaDoc for the changed public methods.
src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.java#L115-L151: DocumentstartDataSet,endDataSet, andstartTable.src/main/java/org/dbunit/dataset/csv/CsvProducer.java#L96-L96: Documentproduce.src/main/java/org/dbunit/dataset/csv/CsvURLProducer.java#L107-L107: Documentproduce.src/main/java/org/dbunit/dataset/xml/FlatDtdProducer.java#L329-L334: DocumentendDTD.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 winClose the
FileChannel.
FileChannel.open(controlFile.toPath())opens this parser, butparse(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 winAdd 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 winSplit the chained path operations.
The modified methods combine path creation with conversion or stream opening, such as
Paths.get(...).toFile()andFiles.newBufferedReader(Paths.get(...), ...). Assign each path to a finalPathlocal, 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 winSplit 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
Pathlocals for path resolution, then perform conversion, opening, or writing in separate statements.
src/test/java/org/dbunit/testutil/TestUtils.java#L53-L80: assignPaths.get(...)results to finalPathlocals before callingtoFile(),Files.newBufferedReader(...), orFiles.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 finalPathlocals before converting them toFile.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
📒 Files selected for processing (71)
pom.xmlsrc/changes/changes.xmlsrc/main/java/org/dbunit/ant/Export.javasrc/main/java/org/dbunit/ant/Operation.javasrc/main/java/org/dbunit/database/DatabaseTableMetaData.javasrc/main/java/org/dbunit/database/statement/BatchStatementDecorator.javasrc/main/java/org/dbunit/dataset/DataSetUtils.javasrc/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.javasrc/main/java/org/dbunit/dataset/csv/CsvParserImpl.javasrc/main/java/org/dbunit/dataset/csv/CsvProducer.javasrc/main/java/org/dbunit/dataset/csv/CsvURLProducer.javasrc/main/java/org/dbunit/dataset/datatype/BytesDataType.javasrc/main/java/org/dbunit/dataset/excel/XlsDataSet.javasrc/main/java/org/dbunit/dataset/json/JsonProducer.javasrc/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.javasrc/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlProducer.javasrc/main/java/org/dbunit/dataset/xml/FlatDtdProducer.javasrc/main/java/org/dbunit/dataset/yaml/YamlProducer.javasrc/main/java/org/dbunit/util/Base64.javasrc/main/java/org/dbunit/util/FileHelper.javasrc/main/java/org/dbunit/util/concurrent/PropertyChangeMulticaster.javasrc/test/java/org/dbunit/DatabaseEnvironment.javasrc/test/java/org/dbunit/DatabaseProfile.javasrc/test/java/org/dbunit/DdlExecutor.javasrc/test/java/org/dbunit/DerbyEnvironment.javasrc/test/java/org/dbunit/H2Environment.javasrc/test/java/org/dbunit/HypersonicEnvironment.javasrc/test/java/org/dbunit/Main.javasrc/test/java/org/dbunit/ant/DbUnitTaskIT.javasrc/test/java/org/dbunit/ant/ExportTest.javasrc/test/java/org/dbunit/ant/adapter/BuildFileExtension.javasrc/test/java/org/dbunit/assertion/DbUnitValueComparerAssertIT.javasrc/test/java/org/dbunit/dataset/CachedDataSetTest.javasrc/test/java/org/dbunit/dataset/CaseInsensitiveTableTest.javasrc/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.javasrc/test/java/org/dbunit/dataset/CompositeDataSetTest.javasrc/test/java/org/dbunit/dataset/FilteredDataSetTest.javasrc/test/java/org/dbunit/dataset/LowerCaseDataSetTest.javasrc/test/java/org/dbunit/dataset/ReplacementDataSetTest.javasrc/test/java/org/dbunit/dataset/TableDecoratorDataSetTest.javasrc/test/java/org/dbunit/dataset/csv/CsvDataSetTest.javasrc/test/java/org/dbunit/dataset/csv/CsvDataSetWriterTest.javasrc/test/java/org/dbunit/dataset/csv/CsvParserTest.javasrc/test/java/org/dbunit/dataset/csv/CsvProducerTest.javasrc/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.javasrc/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.javasrc/test/java/org/dbunit/dataset/excel/XlsDataSetTest.javasrc/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.javasrc/test/java/org/dbunit/dataset/excel/XlsTableTimezoneOffsetTest.javasrc/test/java/org/dbunit/dataset/excel/XlsTableWriteTest.javasrc/test/java/org/dbunit/dataset/json/JsonDataSetTest.javasrc/test/java/org/dbunit/dataset/json/JsonTableTest.javasrc/test/java/org/dbunit/dataset/stream/StreamingDataSetTest.javasrc/test/java/org/dbunit/dataset/stream/StreamingTableTest.javasrc/test/java/org/dbunit/dataset/xml/FlatDtdDataSetIT.javasrc/test/java/org/dbunit/dataset/xml/FlatDtdProducerTest.javasrc/test/java/org/dbunit/dataset/xml/FlatXmlDataSetTest.javasrc/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.javasrc/test/java/org/dbunit/dataset/xml/XmlDataSetTest.javasrc/test/java/org/dbunit/dataset/xml/XmlTableTest.javasrc/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.javasrc/test/java/org/dbunit/dataset/yaml/YmlDataSetTest.javasrc/test/java/org/dbunit/dataset/yaml/YmlTableTest.javasrc/test/java/org/dbunit/operation/CompositeOperationIT.javasrc/test/java/org/dbunit/operation/DeleteOperationIT.javasrc/test/java/org/dbunit/operation/InsertOperationIT.javasrc/test/java/org/dbunit/operation/TransactionOperationIT.javasrc/test/java/org/dbunit/operation/UpdateOperationIT.javasrc/test/java/org/dbunit/testutil/FileAsserts.javasrc/test/java/org/dbunit/testutil/TestUtils.javasrc/test/java/org/dbunit/util/FileHelperTest.java
482fc7c to
0793756
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/org/dbunit/dataset/csv/CsvParserImpl.java (1)
104-105: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse 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 callingtoByteArray.src/main/java/org/dbunit/dataset/datatype/BytesDataType.java#L154-L154: assign theURIbefore callingtoURL.src/main/java/org/dbunit/dataset/datatype/BytesDataType.java#L375-L375: assign the file stream before callingtoByteArray.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
📒 Files selected for processing (23)
src/main/java/org/dbunit/dataset/csv/CsvDataSetWriter.javasrc/main/java/org/dbunit/dataset/csv/CsvParserImpl.javasrc/main/java/org/dbunit/dataset/csv/CsvProducer.javasrc/main/java/org/dbunit/dataset/csv/CsvURLProducer.javasrc/main/java/org/dbunit/dataset/datatype/BytesDataType.javasrc/main/java/org/dbunit/dataset/sqlloader/SqlLoaderControlParserImpl.javasrc/main/java/org/dbunit/dataset/xml/FlatDtdProducer.javasrc/test/java/org/dbunit/DatabaseEnvironment.javasrc/test/java/org/dbunit/Main.javasrc/test/java/org/dbunit/dataset/CompositeDataSetIterationIT.javasrc/test/java/org/dbunit/dataset/ReplacementDataSetTest.javasrc/test/java/org/dbunit/dataset/csv/CsvDataSetTest.javasrc/test/java/org/dbunit/dataset/csv/CsvProducerTest.javasrc/test/java/org/dbunit/dataset/csv/CsvURLProducerTest.javasrc/test/java/org/dbunit/dataset/datatype/BytesDataTypeTest.javasrc/test/java/org/dbunit/dataset/excel/XlsDataSetWriterTest.javasrc/test/java/org/dbunit/dataset/json/JsonTableTest.javasrc/test/java/org/dbunit/dataset/xml/FlatXmlTableWriteTest.javasrc/test/java/org/dbunit/dataset/xml/XmlTableWriteTest.javasrc/test/java/org/dbunit/operation/CompositeOperationIT.javasrc/test/java/org/dbunit/operation/UpdateOperationIT.javasrc/test/java/org/dbunit/testutil/TestUtils.javasrc/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
Update lots of code to comply. Refs: 732
0793756 to
1011291
Compare
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:
Build:
Documentation:
Tests:
Summary by CodeRabbit
Bug Fixes
Chores