joseluisll opened a new pull request, #8995:
URL: https://github.com/apache/hadoop/pull/8995

   ### Description of PR
   
   JIRA: [HADOOP-20088](https://issues.apache.org/jira/browse/HADOOP-20088)
   
   This PR fixes by code 10 of the 19 SpotBugs warnings that the nightly qbt 
builds (JDK 17 and JDK 21) report in `hadoop-tools/hadoop-distcp`. It is the 
code half of the solution; the other half (narrow module-level exclusions for 
the 9 warnings whose behaviour is intended) is in 
[HADOOP-20017](https://issues.apache.org/jira/browse/HADOOP-20017) / PR #8818, 
following the review feedback there.
   
   | # | Class | Warning | Resolution |
   |---|---|---|---|
   | 1 | `SimpleCopyListing` | SS_SHOULD_BE_STATIC `maxRetries` | `private 
static final int MAX_RETRIES = 3` |
   | 2 | `DiffInfo` | CT_CONSTRUCTOR_THROW `<init>` | package-private class 
made `final` |
   | 3 | `DynamicInputChunk` | CT_CONSTRUCTOR_THROW `<init>` | package-private 
class made `final` |
   | 4 | `DynamicInputChunkContext` | CT_CONSTRUCTOR_THROW `<init>` | 
package-private class made `final` |
   | 5 | `CopyListingFileStatus` | EI_EXPOSE_REP2 `setAclEntries` | copies the 
list, keeping null as null |
   | 6 | `CopyListingFileStatus` | EI_EXPOSE_REP2 `setXAttrs` | copies into a 
`LinkedHashMap`, keeping null as null and the iteration order |
   | 7 | `DistCpContext` | EI_EXPOSE_REP2 `setSourcePaths` | copies the list, 
keeping null as null |
   | 8 | `DistCpContext` | EI_EXPOSE_REP `getSourcePaths` | returns an 
unmodifiable view, or null |
   | 9 | `DistCpOptions$Builder` | EI_EXPOSE_REP2 `<init>` | copies the source 
path list. `DistCpOptions` is documented as immutable, and `getSourcePaths()` 
already returns an unmodifiable copy |
   | 10 | `DistCpOptionSwitch` | EI_EXPOSE_REP `getOption` | returns a clone of 
the enum's shared, JVM-wide CLI `Option`. The only caller is `OptionsParser`, 
which just adds it to `Options` |
   
   No public method signature changes. There are two small behaviour changes 
for callers that kept and later changed a collection they passed in. Changes 
made to the list after `new DistCpOptions.Builder(list, target)` are no longer 
seen, which matches the documented immutability of `DistCpOptions`. Changing 
the list returned by `DistCpContext.getSourcePaths()` now throws 
`UnsupportedOperationException`; when the paths came from `DistCpOptions` it 
already did. Nothing in the repository depends on either behaviour.
   
   Note: the Yetus spotbugs vote on the patch column will report the 9 warnings 
excluded in #8818 as unchanged until that PR merges. With both PRs applied the 
module reports 0 warnings.
   
   ### How was this patch tested?
   
   - SpotBugs on `hadoop-distcp` (`mvn -pl hadoop-tools/hadoop-distcp 
spotbugs:spotbugs` / `spotbugs:check`):
     - before: **21** BugInstances on trunk.
     - with this patch alone: the 10 warnings above are fixed, and the 9 
remaining ones are the intended-behaviour warnings excluded in #8818.
     - with this patch plus #8818: **0** (`BugInstance size is 0`, 
`spotbugs:check` passes).
   - Checkstyle (`checkstyle:checkstyle`): no new violations.
   - New unit tests cover the behaviour changes. They all fail against the 
pre-fix code and pass with it:
     - `TestCopyListingFileStatus#testAclEntriesAndXAttrsAreCopied`
     - `TestDistCpOptions#testBuilderCopiesSourcePaths`
     - `TestDistCpOptions#testContextSourcePaths`
     - `TestDistCpOptions#testOptionSwitchReturnsCopyOfOption`
   - The full `hadoop-distcp` unit test suite passes locally (Maven 3.9.15, JDK 
21), with 0 failures and 0 errors. The 2 skips are the large-file tests in 
`TestHDFSContractDistCp`, which are skipped by default.
   - The same code and tests ran on Yetus precommit (JDK 17 and 21) as part of 
PR #8818: `+1` for test4tests, compile, javac, checkstyle, javadoc, mvnsite, 
shadedclient and the hadoop-distcp unit tests (401 run, 0 failures, 0 errors).
   
   ### For code changes:
   
   - [x] Does the title of this PR start with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: Have the integration tests been executed and the 
endpoint
         declared according to the connector-specific documentation? *Not 
applicable: no object store connector changes.*
   - [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? *No new 
dependencies.*
   - [x] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files? *Not applicable.*
   
   ### AI Tooling
   
   If an AI tool was used:
   
   - [x] The PR includes the phrase "Contains content generated by Claude Code"
         where <tool> is the name of the AI tool used.
   - [x] My use of AI contributions follows the ASF legal policy
         https://www.apache.org/legal/generative-tooling.html
   
   Contains content generated by Claude Code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to