GeezerVison is showing github.com — IllegalStateException in logging framework when executing a script · Issue #410 · scijava/scijava-common
IllegalStateException in logging framework when executing a script #410Activityimagejan commented on Nov 30, 2020 What was the script run from the TextEditor to trigger this issue? ctrueden commented on Nov 30, 2020 ctrueden commented on Nov 30, 2020 imagejan commented on Nov 30, 2020 FWIW, I can reproduce the ClassNotFoundException (that presumably leads to this issue here) using the following Groovy script:
stackTrace = Thread.currentThread().getStackTrace()
className = stackTrace[1].getClassName()
println className
clazz = Class.forName(className)
println clazz
which throws:
java.lang.ClassNotFoundException: java_lang_Thread$getStackTrace$0
ctrueden commented on Nov 30, 2020 Ahh! I missed that Class.forName was being called. Yeah, that's not good. Thanks for catching that, @imagejan.
If we really need to do dynamic class lookup there, we should change it to Context.getClassLoader().findClass(className). maarzt commented on Dec 3, 2020 I would suggest this fix #411
I failed to reproduce the problem. I therefor couldn't make sure that the fix really works. skalarproduktraum commented on Dec 3, 2020 Thanks for the fix @maarzt! @kephale's Linux box is possessed by a mean-spirited entity that causes random errors, I suggested to him repeatedly to start fresh with it, therefore I am not totally surprised this is not reproducible 😏 maarzt commented on Dec 4, 2020
mean-spirited entity
Sounds like a conspiracy...
I could confirm that #411 fixes the bug. The exception can be triggered by the following script:
@LogService log
log.setLevel("net.imagej", 2)
log.warn("Hello World!")maarzt commented on Dec 4, 2020 @ctrueden I needed to change the parameter annotation in the script from @LogService log to #@LogService log when I used the latest version of scijava-common. Is this intentional? imagejan commented on Dec 4, 2020 @maarzt the syntax is either @LogService in a comment (i.e. # or // depending on the script language; that's the "old" syntax), or language-independently #@ LogService (without space between # and @; that's the recommended syntax since 3 years). The latter has the advantage that it can be used anywhere in the script, not only in the script header (so e.g. after a license header etc.).
It's possible that before #403, @LogService without a comment would actually work, but this option was never documented neither intended.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|