NPE in EclipseXmlFormatterStepImpl.java / PREFERENCE_FACTORY is null
See original GitHub issueNPE in EclipseXmlFormatterStepImpl.java at line 64
Saw this on one of our build machines, but could not reproduce locally on a 4-core laptop. Happened after a retrigger of the build (due to environmental issues). Reproduced twice in a row (retriggering the Jenkins build), and a third time after submitting a new patch. Only seen it in one repo so far, we have other repos (around 10) where XML formatting works like a charm
Command line used from Jenkins is
gradle --parallel build check -PuniqueSchema=true --info
08:35:06 ------------------------------------------------------------
08:35:06 Gradle 5.6.3
08:35:06 ------------------------------------------------------------
08:35:06
08:35:06 Build time: 2019-10-18 00:28:36 UTC
08:35:06 Revision: bd168bbf5d152c479186a897f2cea494b7875d13
08:35:06
08:35:06 Kotlin: 1.3.41
08:35:06 Groovy: 2.5.4
08:35:06 Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
08:35:06 JVM: 1.8.0_221 (Oracle Corporation 25.221-b11)
08:35:06 OS: Linux 3.10.0-1062.el7.x86_64 amd64
Judging from the code (albeit only checked master), PREFERENCE_FACTORY is null, meaning that the static method setupFramework() either has not been called (yet), or SpotlessEclipseFramework.setup() returned false for some reason
This is the spotless version: classpath group: ‘com.diffplug.spotless’, name: ‘spotless-plugin-gradle’, version: ‘3.24.2’
This is the spotless configuration:
spotless {
java {
googleJavaFormat('1.7')
licenseHeaderFile file("$project.rootProject.projectDir/config/license.java")
}
format 'gradle', {
target '**/*.gradle'
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
format 'xml', {
target fileTree('.') {
include 'tests/**/*.xml'
exclude '**/build/**'
}
eclipseWtp('xml').configFile("$project.rootProject.projectDir/config/spotless.xml.prefs")
}
}
The xml prefs are standard eclipse prefs:
user@host> cat config/spotless.xml.prefs
eclipse.preferences.version=1
indentationChar=space
indentationSize=2
lineWidth=200
user@host>
08:35:28 Step 'eclipse wtp formatters - XML' found problem in 'some-repo/some-file.xml':
08:35:28 null
08:35:28 java.lang.reflect.InvocationTargetException
08:35:28 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
08:35:28 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
08:35:28 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
08:35:28 at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
08:35:28 at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.applyWithFile(EclipseWtpFormatterStep.java:121)
08:35:28 at com.diffplug.spotless.extra.wtp.EclipseWtpFormatterStep.lambda$createBuilder$0(EclipseWtpFormatterStep.java:52)
08:35:28 at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:76)
08:35:28 at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:76)
08:35:28 at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
08:35:28 at com.diffplug.spotless.Formatter.isClean(Formatter.java:167)
08:35:28 at com.diffplug.gradle.spotless.SpotlessTask.check(SpotlessTask.java:309)
08:35:28 at com.diffplug.gradle.spotless.SpotlessTask.performAction(SpotlessTask.java:250)
08:35:28 at sun.reflect.GeneratedMethodAccessor323.invoke(Unknown Source)
08:35:28 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
08:35:28 at java.lang.reflect.Method.invoke(Method.java:498)
08:35:28 at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
08:35:28 at org.gradle.api.internal.project.taskfactory.IncrementalTaskInputsTaskAction.doExecute(IncrementalTaskInputsTaskAction.java:47)
08:35:28 at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
08:35:28 at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
08:35:28 at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:476)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
08:35:28 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:461)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:444)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:93)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:237)
08:35:28 at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$0(ExecuteStep.java:32)
08:35:28 at java.util.Optional.map(Optional.java:215)
08:35:28 at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:32)
08:35:28 at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
08:35:28 at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
08:35:28 at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
08:35:28 at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
08:35:28 at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
08:35:28 at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
08:35:28 at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
08:35:28 at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
08:35:28 at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
08:35:28 at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
08:35:28 at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
08:35:28 at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
08:35:28 at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:208)
08:35:28 at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
08:35:28 at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
08:35:28 at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
08:35:28 at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
08:35:28 at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
08:35:28 at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
08:35:28 at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
08:35:28 at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
08:35:28 at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
08:35:28 at java.util.Optional.map(Optional.java:215)
08:35:28 at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
08:35:28 at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
08:35:28 at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
08:35:28 at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
08:35:28 at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
08:35:28 at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
08:35:28 at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
08:35:28 at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
08:35:28 at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:69)
08:35:28 at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:47)
08:35:28 at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
08:35:28 at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:140)
08:35:28 at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
08:35:28 at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
08:35:28 at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
08:35:28 at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
08:35:28 at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
08:35:28 at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
08:35:28 at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
08:35:28 at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
08:35:28 at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
08:35:28 at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
08:35:28 at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
08:35:28 at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
08:35:28 at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
08:35:28 at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
08:35:28 at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
08:35:28 at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
08:35:28 at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
08:35:28 at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
08:35:28 at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
08:35:28 at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
08:35:28 at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
08:35:28 at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
08:35:28 at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
08:35:28 at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
08:35:28 at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
08:35:28 at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
08:35:28 at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
08:35:28 at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
08:35:28 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
08:35:28 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
08:35:28 at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
08:35:28 at java.lang.Thread.run(Thread.java:748)
08:35:28 Caused by: java.lang.NullPointerException
08:35:28 at com.diffplug.spotless.extra.eclipse.wtp.EclipseXmlFormatterStepImpl.<init>(EclipseXmlFormatterStepImpl.java:64)
08:35:28 ... 107 more
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks for the GitHub trick, @nedtwigg! I’ll see if I can try out the “quick-n-dirty” solution on our build machines on Monday (just adding a synchronized modifier). I’d be happy to share thoughts about redesign of the initialization parts, if @fvgh becomes available, just ping me in this case. Thanks for unleashing spotless onto the world 😃
Published in x.26.1