RFR : 8220382 : Cleanup doclet instantiation

Jonathan Gibbons jonathan.gibbons at oracle.com
Tue Apr 16 19:11:28 UTC 2019


Mostly OK, but ...

This may have always been a possible issue, but now is a good time to 
fix it.  On "new" line 728, `getClass().getClassLoader()`can 
theoretically return null. See 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getClassLoader()

> publicClassLoader  <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassLoader.html>  getClassLoader()
> Returns the class loader for the class. Some implementations may use 
> null to represent the bootstrap class loader. This method will return 
> null in such implementations if this class was loaded by the bootstrap 
> class loader.
This raises the potential for an NPE on line 755.  That line should be 
rewritten as follows:

     return classLoader == null ? Class.forName(docletName) : 
classloader.loadClass(docletName);

No need to rev-review if that is the only change you make and all 
appropriate tests pass.

-- Jon

On 4/5/19 3:42 AM, Priya Lakshmi Muthuswamy wrote:
> Hi,
>
> Kindly review the fix for 
> https://bugs.openjdk.java.net/browse/JDK-8220382
> webrev : http://cr.openjdk.java.net/~pmuthuswamy/8220382/webrev.00/
>
> Thanks,
> Priya
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/javadoc-dev/attachments/20190416/101fc977/attachment.html>


More information about the javadoc-dev mailing list