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

Null pointer during analysis with sb-contrib 7.4.5 (no problem with 7.4.3) #343

Closed
Dichotomia opened this issue May 11, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@Dichotomia
Copy link
Contributor

commented May 11, 2019

For information we use SpotBugs 4.0.0 beta1

[INFO] Fork Value is true
[java] The following errors occurred during analysis:
[java] Exception analyzing com.mac.custom.interfacesmac.parametres.MacParametragesInterfaces using detector com.mebigfatguy.fbcontrib.detect.DubiousListCollection
[java] java.lang.NullPointerException
[java] At edu.umd.cs.findbugs.SuppressionMatcher.match(SuppressionMatcher.java:65)
[java] At edu.umd.cs.findbugs.FilterBugReporter.reportBug(FilterBugReporter.java:44)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.reportBugs(DubiousListCollection.java:253)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.visitClassContext(DubiousListCollection.java:131)
[java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1080)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:281)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:394)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1185)
[java] Exception analyzing com.mac.custom.services.beans.MacCheckOrdersServicesBean using detector com.mebigfatguy.fbcontrib.detect.DubiousListCollection
[java] java.lang.NullPointerException
[java] At edu.umd.cs.findbugs.SuppressionMatcher.match(SuppressionMatcher.java:65)
[java] At edu.umd.cs.findbugs.FilterBugReporter.reportBug(FilterBugReporter.java:44)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.reportBugs(DubiousListCollection.java:253)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.visitClassContext(DubiousListCollection.java:131)
[java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1080)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:281)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:394)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1185)
[java] Exception analyzing com.mac.custom.form.MacVueTableauDeBordCommandesForm using detector com.mebigfatguy.fbcontrib.detect.DubiousListCollection
[java] java.lang.NullPointerException
[java] At edu.umd.cs.findbugs.SuppressionMatcher.match(SuppressionMatcher.java:65)
[java] At edu.umd.cs.findbugs.FilterBugReporter.reportBug(FilterBugReporter.java:44)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.reportBugs(DubiousListCollection.java:253)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.visitClassContext(DubiousListCollection.java:131)
[java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1080)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:281)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:394)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1185)
[java] Exception analyzing com.mac.reprise.services.beans.SupplierImportDataServicesBean using detector com.mebigfatguy.fbcontrib.detect.DubiousListCollection
[java] java.lang.NullPointerException
[java] At edu.umd.cs.findbugs.SuppressionMatcher.match(SuppressionMatcher.java:65)
[java] At edu.umd.cs.findbugs.FilterBugReporter.reportBug(FilterBugReporter.java:44)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.reportBugs(DubiousListCollection.java:253)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.visitClassContext(DubiousListCollection.java:131)
[java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1080)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:281)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:394)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1185)
[java] Exception analyzing com.mac.custom.action.MacRemoveDetailPostSaleService using detector com.mebigfatguy.fbcontrib.detect.DubiousListCollection
[java] java.lang.NullPointerException
[java] At edu.umd.cs.findbugs.SuppressionMatcher.match(SuppressionMatcher.java:65)
[java] At edu.umd.cs.findbugs.FilterBugReporter.reportBug(FilterBugReporter.java:44)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.reportBugs(DubiousListCollection.java:253)
[java] At com.mebigfatguy.fbcontrib.detect.DubiousListCollection.visitClassContext(DubiousListCollection.java:131)
[java] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1080)
[java] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:281)
[java] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:394)
[java] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1185)
[INFO] Done SpotBugs Analysis....

At the end we have this:
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:check (default) on project mac-bc360-custom: failed with 1539 bugs and 5 errors -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:3.1.11:check (default) on project mac-bc360-custom: failed with 1539 bugs and 5 errors
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:200)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:196)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.maven.plugin.MojoExecutionException: failed with 1539 bugs and 5 errors
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance (Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke (CachedConstructor.java:83)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke (CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor (ConstructorSite.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor (CallSiteArray.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor (AbstractCallSite.java:237)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor (AbstractCallSite.java:249)
at org.codehaus.mojo.spotbugs.SpotbugsViolationCheckMojo.execute (SpotbugsViolationCheckMojo.groovy:533)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:200)
at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:196)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
at java.lang.Thread.run (Thread.java:748)

@Dichotomia Dichotomia changed the title Null pointer during analysis Null pointer during analysis with sb-contrib 7.4.5 (no problem with 7.4.3) May 11, 2019

@Dichotomia

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

Same problem in single thread maven build

Caused by: org.apache.maven.plugin.MojoExecutionException: failed with 1539 bugs and 5 errors
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance (Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke (CachedConstructor.java:83)
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke (CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor (ConstructorSite.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor (CallSiteArray.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor (AbstractCallSite.java:237)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor (AbstractCallSite.java:249)
at org.codehaus.mojo.spotbugs.SpotbugsViolationCheckMojo.execute (SpotbugsViolationCheckMojo.groovy:533)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)

@Dichotomia

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

Same problem with spotbugs 3.1.12

@mebigfatguy

This comment has been minimized.

Copy link
Owner

commented May 12, 2019

odd, the line in spotbugs in question is

ClassAnnotation clazz = b.getPrimaryClass().getTopLevelClass();

which means either b or b.getPrimaryClass() is null

b can't possibly be null, as it's called via

				bugReporter.reportBug(**new BugInstance**(this, BugType.DLC_DUBIOUS_LIST_COLLECTION.name(),
						(major >= Const.MAJOR_1_4) ? NORMAL_PRIORITY : LOW_PRIORITY)
								.addSourceLine(fi.getSourceLineAnnotation()));

So i assume it must be getPrimaryClass()

mebigfatguy added a commit that referenced this issue May 12, 2019

@mebigfatguy

This comment has been minimized.

Copy link
Owner

commented May 12, 2019

thanks, was a bad merge from the findbugs branch

@Dichotomia

This comment has been minimized.

Copy link
Contributor Author

commented May 23, 2019

Thanks for the fix.

Is it possible to release a version with this fix?

Or is it possible to use the snapshot version? I don't know if you publish snaspshot versions on a maven repository.

@Vampire

This comment has been minimized.

Copy link

commented May 25, 2019

While I would also prefer an official release, we could in the meantime use a JitPack build, but the problem, is that the build is failing due to two spotbugs findings: https://jitpack.io/com/github/mebigfatguy/fb-contrib/spotbugs-SNAPSHOT/build.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.