daniellcoellho opened a new pull request, #1708: URL: https://github.com/apache/commons-lang/pull/1708
Fix CT_CONSTRUCTOR_THROW (BAD_PRACTICE) in Range constructor SpotBugs detected CT_CONSTRUCTOR_THROW in Range: when a constructor throws an exception before completing initialization, the partially constructed object may be exploited via finalizer attacks. This fix moves the null validation of fromInclusive and toInclusive from the Range constructor to the static factory method of(T, T, Comparator), which is the single entry point for all other factory methods (of, is, between). The constructor no longer throws exceptions. Unit tests were added to RangeTest to verify that NullPointerException is thrown from the factory method for null arguments. - [x] Read the contribution guidelines. - [x] Read the ASF Generative Tooling Guidance. - [x] I used AI (Claude by Anthropic) to assist in identifying and implementing this fix. - [x] Run a successful build with `mvn`. - [x] Unit tests added to RangeTest. - [x] Pull request description written above. -- 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]
