On Wed, 27 May 2026 17:30:57 GMT, Phil Race <[email protected]> wrote:
> A fix for a theoretical NPE because a method might return null and it is used. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java line 205: > 203: try (InputStream is = getInputStream()) { > 204: if (is == null) { > 205: throw new IOException("null stream"); This was the actual complaint src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java line 322: > 320: > 321: try (InputStream is = getInputStream(); > 322: DataInputStream dis = new DataInputStream(is)) But I also noticed this case which I decided to fix too. However the DataInputStream constructor accepts null .. but the readFully() call will throw an NPE so I had to handle it there since it was not so obvious how to check for null inside the try(..) I also filed a bug against DataInputStream https://bugs.openjdk.org/browse/JDK-8385487 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31299#discussion_r3312638038 PR Review Comment: https://git.openjdk.org/jdk/pull/31299#discussion_r3312657449
