8067801: Enforce null check for underlying I/O streams
brian.burkhalter at oracle.com
Wed Jul 17 19:46:41 UTC 2019
> On Jul 17, 2019, at 12:35 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>> I might consider adding the NPE message to the individual classes as it is easy to miss in the java.io <http://java.io/> <http://java.io/ <http://java.io/>> package but that is just a suggestion. Especially with the new search feature of javadoc, I usually go straight to the method so would never see the info in the package comments.
> It might be better but I don’t know where else in java.io <http://java.io/> an NPE is thrown without being documented on the ctor/method itself. If there are other places then a general inspection might be in order.
I looked through some of the other classes and there are not-locally-documented NPEs in a number of constructors including all the Readers and Writers. I think for now I’d rather leave it as is.
> Note that the practice of using the package-level doc occurs also in java.nio:
> "Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown."
>> Did you give any thought of using TestNG/assertThrows? Not a big deal, I just a personal preference :-)
> I don’t see how that would work in this case as we do *not* expect an exception.
Sorry: I had it backwards - d’oh! You are correct, that would work. I’ll look into revising it.
What I was actually wondering about with respect to the tests is whether one can have the same bug ID in two different tests. Also I was not sure whether there might be a location where the two merged into a single test would be appropriate.
More information about the core-libs-dev