Closed DSEyers closed 4 years ago
There is nothing I can see from this stack trace within the control of this plugin. The error appears internal to the OpenClover library implementation. I think you need to raise this as an issue with OpenClover instead.
Caused by: java.lang.NullPointerException at clover.org.jfree.chart.axis.ValueAxis.findMaximumTickLabelWidth(ValueAxis.java:916)
Code:
>>> FontMetrics fm = g2.getFontMetrics(font);
A problem with graphics, maybe? A DISPLAY is missing? A font is missing?
There is a very easy fix for this issue. Add the following to your gradle.properties
systemProp.java.awt.headless=true
Neither Gradle tools and plugins nor this plugin really need an actual graphics display to perform their work. I use this in my build and eliminate the problem.
Since this is a common kind of failure when advanced options are used I will take the time to add a documentation pointer to this solution.
Afraid didn't work.
Build time: 2017-12-20 15:45:23 UTC Revision: 10ed9dc355dc39f6307cc98fbd8cea314bdd381c
Groovy: 2.4.12 Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017 JVM: 1.8.0_242 (Eclipse OpenJ9 openj9-0.18.1) OS: Mac OS X 10.15.3 x86_64
Error [ant:clover-report] null java.lang.NullPointerException at com.atlassian.clover.reporters.html.RenderFileAction.call(RenderFileAction.java:111) at com.atlassian.clover.util.CloverExecutors$LoggingCallable.call(CloverExecutors.java:91) 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:821)
Build.gradle (snippets with clover in only) plugins { id 'com.bmuschko.clover' version '2.2.0' // Add coverage reporting: https://github.com/bmuschko/gradle-clover-plugin }
dependencies { clover 'org.openclover:clover:4.2.0' }
On Thu, 27 Feb 2020 at 17:28, Alexander Volanis (HPE) < notifications@github.com> wrote:
Since this is a common kind of failure when advanced options are used I will take the time to add a documentation pointer to this solution.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146?email_source=notifications&email_token=AED2WD2KM5B6WW4TBDWBEJDRE7Z4NA5CNFSM4KQ7TET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENFG55Y#issuecomment-592080631, or unsubscribe https://github.com/notifications/unsubscribe-auth/AED2WD3FYEGBNETOOJUVUNDRE7Z4NANCNFSM4KQ7TETQ .
Nothing more I can do for you, this failure is inside the shaded library org.jfree.chart within the OpenClover tools. You might want to try also setting GRADLE_OPTS=-Djava.awt.headless=true
com.atlassian.clover.reporters.html.RenderFileAction.call( RenderFileAction.java:111)
Corresponds to
So it has to throw NPE on columnsTL. Check how many rendering threads you use and please try with one thread whether it helps.
In Ant it is named "numThreads" see http://openclover.org/doc/manual/latest/ant--clover-report.html
I don't know if gradle plugin has corresponding option...
Also please check what columns you have defined - maybe they're empty and this is a cause of NPE?
On Fri, Feb 28, 2020, 17:20 Alexander Volanis (HPE) < notifications@github.com> wrote:
Nothing more I can do for you, this failure is inside the shaded library org.jfree.chart within the OpenClover tools. You might want to try also setting GRADLE_OPTS=-Djava.awt.headless=true
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146?email_source=notifications&email_token=AFH6KQLWHRZB4774EO4Q4BTRFE2TVA5CNFSM4KQ7TET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENJCNTI#issuecomment-592586445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFH6KQJX4I26BZVGE4CSZYDRFE2TVANCNFSM4KQ7TETQ .
Also, did you try with the latest OpenClover version i.e. 4.4.1? I see 4.2.0 and 4.3.1 in logs...
On Fri, Feb 28, 2020, 17:28 Marek Parfianowicz marek.parfianowicz@gmail.com wrote:
com.atlassian.clover.reporters.html.RenderFileAction.call( RenderFileAction.java:111)
Corresponds to
So it has to throw NPE on columnsTL. Check how many rendering threads you use and please try with one thread whether it helps.
In Ant it is named "numThreads" see http://openclover.org/doc/manual/latest/ant--clover-report.html
I don't know if gradle plugin has corresponding option...
Also please check what columns you have defined - maybe they're empty and this is a cause of NPE?
On Fri, Feb 28, 2020, 17:20 Alexander Volanis (HPE) < notifications@github.com> wrote:
Nothing more I can do for you, this failure is inside the shaded library org.jfree.chart within the OpenClover tools. You might want to try also setting GRADLE_OPTS=-Djava.awt.headless=true
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146?email_source=notifications&email_token=AFH6KQLWHRZB4774EO4Q4BTRFE2TVA5CNFSM4KQ7TET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENJCNTI#issuecomment-592586445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFH6KQJX4I26BZVGE4CSZYDRFE2TVANCNFSM4KQ7TETQ .
For Gradle you can use --max-workers=1
to avoid running parallel tests that get Clover rendering in trouble.
If this is is an option for the Ant tasks I can add it to the Gradle plugin, we are using Ant tasks for integration. Thanks @marek-parfianowicz
Exception is thrown during report generation, I'm talking about Clover's HTML rendering threads. So probably
you can use --max-workers=1 to avoid running parallel tests
won't help here.
On Fri, Feb 28, 2020, 17:37 Alexander Volanis (HPE) < notifications@github.com> wrote:
For Gradle you can use --max-workers=1 to avoid running parallel tests that get Clover rendering in trouble.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146?email_source=notifications&email_token=AFH6KQPLHATC55O322LJIR3RFE4VDA5CNFSM4KQ7TET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENJEIVQ#issuecomment-592594006, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFH6KQIG47WYUEU2TWQ5KXDRFE4VDANCNFSM4KQ7TETQ .
None of the solutions worked. Going to file ticker with OpenClover group and thanks for all your help.
If I have time this week I will try to expose the maxThreads option for report generation so you can try that approach as well.
Yes, it would be great to add a maxThreads option, at least we could check if the workaround works.
What Java version do you use to execute Gradle? I'm asking, because Clover was tested up to JDK 9 and probably won't run on newer JDK.
If the NPE is thrown from the columnsTL.get()
then resetThreadLocals must have been called (as it sets the field to null, by default it's new ThreadLocal<List<Column>>()
). It's being called on cleanup, see https://bitbucket.org/openclover/clover/src/24bfea8880f06e225e95a341813056b664dd3a1f/clover-core/src/main/java/com/atlassian/clover/reporters/html/HtmlReporter.java?at=default#lines-315
Maybe the Timeout of XXX reached during report generation. Please increase this value and try again.
was reached? Could you check logs, please?
I added the timeout interval and numThreads options in the 2.2.5 version. It should appear in the plugins portal within 24 hours.
Perhaps either or both of these options will make a difference.
Java 1.8.232 have been using
On Mon, 9 Mar 2020, 17:39 Marek Parfianowicz, notifications@github.com wrote:
1.
Yes, it would be great to add a maxThreads option, at least we could check if the workaround works. 2.
What Java version do you use to execute Gradle? I'm asking, because Clover was tested up to JDK 9 and probably won't run on newer JDK. 3.
If the NPE is thrown from the columnsTL.get() then resetThreadLocals must have been called (as it sets the field to null, by default it's new ThreadLocal<List
>()). It's being called on cleanup, see https://bitbucket.org/openclover/clover/src/24bfea8880f06e225e95a341813056b664dd3a1f/clover-core/src/main/java/com/atlassian/clover/reporters/html/HtmlReporter.java?at=default#lines-315 Maybe the Timeout of XXX reached during report generation. Please increase this value and try again. was reached? Could you check logs, please?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146?email_source=notifications&email_token=AED2WD4DTBAOANOHGQU4X53RGUSULA5CNFSM4KQ7TET2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOIIVLA#issuecomment-596675244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AED2WD4MHZ6FFHTIRMB2Z4TRGUSULANCNFSM4KQ7TETQ .
I tried a few things, but not able to get the updated plugin seen.
Tried:
And in a lank new folder creating and running build.grade with full contents of:
buildscript { repositories { jcenter() }
dependencies {
classpath 'com.bmuschko:gradle-clover-plugin:2.2.5'
}
}
Also just incrementing version in the project and running Gradle. We using Gradle 4.4.1 and plugin syntax used is:
plugins { id 'com.bmuschko.clover' version '2.2.5' }
repositories { mavenCentral() jcenter() }
There was an issue with the Gradle plugin portal. The Gradle team is fixing it. The release will be available from there soon I hope.
If you are trying it locally you need to add mavenLocal() to the repositories. You only have mavenCentral() and jcenter()
When you use the plugins closure DSL to load it you also need to add mavenLocal() to the settings.gradle under pluginManagement closure.
Plugin 2.2.5 is now available at the Gradle portal. Try it out with the suggestions @marek-parfianowicz made.
This is how you configure them
clover {
report {
numThreads = 1
timeout = '30 seconds'
}
}
Default timeout is no-timeout so it is unlikely you reached a timeout. numThreads = 0 according to OpenClover docs disables multithreading, I suppose it is probably better in some ways than 1 thread.
Afraid still get NPE issue
On earlier update around installing locally thanks info on gradle.settings file.
When trying to generate the plugin was showing on the console as:
Configure project : Reckoned version: 0.0.1-milestone.0.0+20200312T173042Z
A resolution was to add version o file build.gradle. gradlePlugin { plugins { gradleCloverPlugin { id = 'com.bmuschko.clover'
On Fri, 13 Mar 2020 at 00:12, Alexander Volanis (HPE) < notifications@github.com> wrote:
Plugin 2.2.5 is now available at the Gradle portal. Try it out with the suggestions @marek-parfianowicz https://github.com/marek-parfianowicz made.
This is how you configure them
clover { report { numThreads = 1 timeout = '30 seconds' } }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bmuschko/gradle-clover-plugin/issues/146#issuecomment-598486305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AED2WDYUEUJVEHR2KPHNKC3RHF255ANCNFSM4KQ7TETQ .
We use the reckon plugin to discover the version assuming you are cloning the git repository which brings in the release tags. You did not clone the repository which means you did not get the git tags therefore your version was 0.0.1.
Sorry this did not make your problem better. This is unique and completely within the OpenClover library so I cannot tell why you get this. Did you actually change the clover configuration as suggested above? That is how it would work, the new version would not be the fix, the configuration change would be the fix.
Getting NPE when request Clover to generate HTML file. If set to false can get XML file fine.
MacOS Catalina - version 10.15.3
build.gradle snippet // Declare Gradle plugins to be used plugins { id 'eclipse' // Add support for Eclipse id 'findbugs' // FindBugs plugin: http://findbugs.sourceforge.net/ id 'java-library' // Add support for building Java libraries id 'com.bmuschko.clover' version '2.2.4' // Add coverage reporting }
dependencies { // Project resources implementation( // External resources 'org.apache.commons:commons-lang3:3.9', 'org.apache.logging.log4j:log4j-api:2.8.2', 'org.apache.logging.log4j:log4j-core:2.8.2', 'org.json:json:20171018', 'org.ini4j:ini4j:0.5.4', 'mysql:mysql-connector-java:8.0.18', 'com.google.code.findbugs:annotations:3.0.1', ) // Test resources testImplementation( // External resources 'junit:junit:4.12', 'org.junit.jupiter:junit-jupiter-api:5.5.0', 'org.powermock:powermock-api-mockito:1.6.4', 'org.powermock:powermock-module-junit4:1.6.4', ) clover 'org.openclover:clover:4.3.1' }
// Settings for the Clover coverage report -- not a task; See cloverGenerateReport clover { enabled = true
}
Stacktrace What went wrong: Execution failed for task ':cloverGenerateReport'.
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':cloverGenerateReport'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) Caused by: : com.atlassian.clover.api.CloverException: java.lang.NullPointerException at com.atlassian.clover.ant.tasks.CloverReportTask.cloverExecute(CloverReportTask.java:398) at com.atlassian.clover.ant.tasks.AbstractCloverTask.execute(AbstractCloverTask.java:57) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.gradle.api.internal.project.ant.BasicAntBuilder.nodeCompleted(BasicAntBuilder.java:78) at org.gradle.api.internal.project.ant.BasicAntBuilder.doInvokeMethod(BasicAntBuilder.java:103) at com.bmuschko.gradle.clover.CloverReportTask.writeReport(CloverReportTask.groovy:182) at com.bmuschko.gradle.clover.CloverReportTask.writeReports(CloverReportTask.groovy:154) at com.bmuschko.gradle.clover.GenerateCoverageReportTask.generateReport(GenerateCoverageReportTask.groovy:59) at com.bmuschko.gradle.clover.GenerateCoverageReportTask.generateCodeCoverage(GenerateCoverageReportTask.groovy:43) at com.bmuschko.gradle.clover.CloverReportTask.start(CloverReportTask.groovy:257) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) ... 29 more Caused by: com.atlassian.clover.api.CloverException: java.lang.NullPointerException at com.atlassian.clover.reporters.html.HtmlReporter.executeImpl(HtmlReporter.java:196) at com.atlassian.clover.reporters.CloverReporter.execute(CloverReporter.java:38) at com.atlassian.clover.ant.tasks.CloverReportTask.generateReports(CloverReportTask.java:435) at com.atlassian.clover.ant.tasks.CloverReportTask.cloverExecute(CloverReportTask.java:395) ... 52 more Caused by: java.lang.NullPointerException at clover.org.jfree.chart.axis.ValueAxis.findMaximumTickLabelWidth(ValueAxis.java:916) at clover.org.jfree.chart.axis.ValueAxis.reserveSpace(ValueAxis.java:828) at clover.org.jfree.chart.plot.XYPlot.calculateRangeAxisSpace(XYPlot.java:3077) at clover.org.jfree.chart.plot.XYPlot.calculateAxisSpace(XYPlot.java:2988) at clover.org.jfree.chart.plot.XYPlot.draw(XYPlot.java:3132) at clover.org.jfree.chart.JFreeChart.draw(JFreeChart.java:1229) at clover.org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1399) at clover.org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:211) at clover.org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:341) at com.atlassian.clover.reporters.util.CloverChartFactory.generateHistogramChart(CloverChartFactory.java:156) at com.atlassian.clover.reporters.html.HtmlReporter.executeCurrentReport(HtmlReporter.java:266) at com.atlassian.clover.reporters.html.HtmlReporter.executeImpl(HtmlReporter.java:188) ... 55 more