Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while looking for class java/lang/Thread$UncaughtExceptionHandler #73

Open
talios opened this issue Apr 4, 2018 · 4 comments

Comments

@talios
Copy link

talios commented Apr 4, 2018

Under Java 9, both findbugs and spotbugs seem to fail when running the findbugs-slf4j checks on our usage of Thread.UncaughtExceptionHandler with the following:

private static final UncaughtExceptionHandler uncaughtExceptionHandler =
    (t, e) -> LOG.error(format("Unhandled thread exception %s: %s", t.getName(), e.getMessage()), e);

The exception is:

 [java] Exception in thread "main" java.lang.AssertionError: java.lang.ClassNotFoundException: Exception while looking for class java/lang/Thread$UncaughtExceptionHandler
 [java] 	at jp.skypencil.findbugs.slf4j.IllegalPassedClassDetector.memorizeResultOfGetClassMethod(IllegalPassedClassDetector.java:64)
 [java] 	at jp.skypencil.findbugs.slf4j.IllegalPassedClassDetector.afterOpcode(IllegalPassedClassDetector.java:32)
 [java] 	at edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit(DismantleBytecode.java:884)
 [java] 	at edu.umd.cs.findbugs.visitclass.BetterVisitor.visitCode(BetterVisitor.java:218)
 [java] 	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitCode(PreorderVisitor.java:243)
 [java] 	at edu.umd.cs.findbugs.bcel.OpcodeStackDetector.visitCode(OpcodeStackDetector.java:65)
 [java] 	at org.apache.bcel.classfile.Code.accept(Code.java:132)
 [java] 	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:315)
 [java] 	at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:403)
@talios
Copy link
Author

talios commented Apr 9, 2018

Actually - this seems to be triggering under Java 8 as well.

@talios
Copy link
Author

talios commented Apr 17, 2018

So... thumbs up - what does that mean? Is this a known issue? Any idea how it could be resolved ( is it a bug in the plugin, or possibly my project? )?

@mattnelson
Copy link

I've been able to reliably reproduce this with a parallel build and disabling spotbugs forking.

mvn clean verify -T 1C -Dspotbugs.fork=false

Caused by: java.lang.AssertionError: java.lang.ClassNotFoundException: Exception while looking for class com/company/project/Service
    at jp.skypencil.findbugs.slf4j.IllegalPassedClassDetector.memorizeResultOfGetClassMethod (IllegalPassedClassDetector.java:80)
    at jp.skypencil.findbugs.slf4j.IllegalPassedClassDetector.afterOpcode (IllegalPassedClassDetector.java:42)
    at edu.umd.cs.findbugs.visitclass.DismantleBytecode.visit (DismantleBytecode.java:884)

@KengoTODA
Copy link
Owner

1.4.1 has related fix, that stops throwing exception: 042a74c

But this doesn't solve root problem. I cannot reproduce this issue for now. I guest it is caused by thread unsafety of Apache BCEL.

KengoTODA added a commit that referenced this issue Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants