Here is the stacktrace I got when using Livedoc v4.3.2 which uses therapi-runtime-javadoc 0.4.0:
java.lang.NullPointerException: null
at com.github.therapi.runtimejavadoc.RuntimeJavadoc.getJavadoc(RuntimeJavadoc.java:41) ~[therapi-runtime-javadoc-0.4.0.jar:na]
at com.github.therapi.runtimejavadoc.RuntimeJavadoc.getJavadoc(RuntimeJavadoc.java:32) ~[therapi-runtime-javadoc-0.4.0.jar:na]
at com.github.therapi.runtimejavadoc.RuntimeJavadoc.getJavadoc(RuntimeJavadoc.java:75) ~[therapi-runtime-javadoc-0.4.0.jar:na]
It looks like RuntimeJavadoc crashes at line 41:
try (InputStream is = classLoader.getResourceAsStream(resourceName)) {
My bet is that the classloader is null, which is possible as the doc states:
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.
One solution would be to directly use the getResourceAsStream() method on the class itself rather than on its ClassLoader. I understand that the getJavadoc(String, ClassLoader) overload is needed for tests, but it should be easy to just extract the code properly to maximize code reuse while avoiding using the classloader overload in production code.
Here is the stacktrace I got when using Livedoc v4.3.2 which uses therapi-runtime-javadoc 0.4.0:
It looks like
RuntimeJavadoc
crashes at line 41:My bet is that the classloader is null, which is possible as the doc states:
One solution would be to directly use the
getResourceAsStream()
method on the class itself rather than on its ClassLoader. I understand that thegetJavadoc(String, ClassLoader)
overload is needed for tests, but it should be easy to just extract the code properly to maximize code reuse while avoiding using the classloader overload in production code.