ADDITIONAL SYSTEM INFORMATION : Operating System: darwin 24.6.0 (macOS) JDK Version: openjdk version "21" 2023-09-19 LTS Build: OpenJDK Runtime Environment (build 21+35-LTS) Architecture: x86_64 Additional Information: - Working on OpenJDK JDK repository - Testing with jtreg test framework A DESCRIPTION OF THE PROBLEM : I would like to contribute to OpenJDK by adding explicit null checks using Objects.requireNonNull to improve defensive programming and provide clearer error messages. Motivation: Some public API methods currently throw NullPointerException when null is passed, but the error message is not clear. Using Objects.requireNonNull provides a clearer error message and makes the API contract explicit. Proposed Changes: - Add Objects.requireNonNull check in DataOutputStream.writeBytes(String s) - This will provide a clear error message when null is passed Target File: src/java.base/share/classes/java/io/DataOutputStream.java Testing: I will add test cases to verify that null checks work correctly and provide appropriate error messages. This is my first contribution to OpenJDK. I'm ready to submit a pull request once a JBS issue is created.
|