Type.doc() says:
Type.doc()
Return the raw fandoc for this type or null if not available.
Which is great, and I test the value of doc to see if it is null or not. Only the method has a nasty side effect, see doc() in ClassType.java:
doc
null
doc()
ClassType.java
try { InputStream in = pod.fpod.store.read("doc/" + name + ".apidoc"); if (in != null) { try { new FDoc(in, this).read(); } finally { in.close(); } } } catch (Exception e) { e.printStackTrace(); } docLoaded = true;
When doc returns null it also prints out a stack trace.
I'm calling this in a test runner where std out / std err is an important output. And currently it looks like all my tests are failing!
std out
std err
Is that e.printStackTrace() really needed? If so, could it not be logged instead so I have the option of turning it off?
e.printStackTrace()
What the exception? That shouldn't happen unless something is really wrong - its sort of a last ditch just so that an error is silently ignored
I get a NullErr when the .apidoc file doesn't exist.
NullErr
.apidoc
java.lang.NullPointerException at fan.sys.ClassType.doc(ClassType.java:247) ...
Happens when a class is run as a script, pod.fpod.store comes back as null.
pod.fpod.store
When running individual test classes with fant, they're always compiled as a script.
fant
That is a bug, we should handle that better. I pushed a fix
Thanks! :)
Login or Signup to reply.
SlimerDude Tue 26 Aug 2014
Type.doc()
says:Which is great, and I test the value of
doc
to see if it isnull
or not. Only the method has a nasty side effect, seedoc()
inClassType.java
:When
doc
returnsnull
it also prints out a stack trace.I'm calling this in a test runner where
std out
/std err
is an important output. And currently it looks like all my tests are failing!Is that
e.printStackTrace()
really needed? If so, could it not be logged instead so I have the option of turning it off?brian Tue 26 Aug 2014
What the exception? That shouldn't happen unless something is really wrong - its sort of a last ditch just so that an error is silently ignored
SlimerDude Tue 26 Aug 2014
I get a
NullErr
when the.apidoc
file doesn't exist.Happens when a class is run as a script,
pod.fpod.store
comes back asnull
.When running individual test classes with
fant
, they're always compiled as a script.brian Tue 26 Aug 2014
That is a bug, we should handle that better. I pushed a fix
SlimerDude Tue 26 Aug 2014
Thanks! :)