Skip to content

Commit 1708cfc

Browse files
Copilothmiguim
andcommitted
Fix NullPointerException: Initialize jobStats field with new JobStats() instead of null
Co-authored-by: hmiguim <1252710+hmiguim@users.noreply.github.com>
1 parent 1085230 commit 1708cfc

File tree

1 file changed

+2
-2
lines changed
  • roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs

1 file changed

+2
-2
lines changed

roda-common/roda-common-data/src/main/java/org/roda/core/data/v2/jobs/Job.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public enum JOB_STATE {
117117

118118
// Transient jobStats field for backwards compatibility with existing code
119119
@Transient
120-
private JobStats jobStats = null;
120+
private JobStats jobStats = new JobStats();
121121

122122
// plugin full class (e.g. org.roda.core.plugins.plugins.base.FixityPlugin)
123123
@Column(name = "plugin")
@@ -174,7 +174,7 @@ public Job(Job job) {
174174
this.pluginParameters = new HashMap<>(job.getPluginParameters());
175175
this.sourceObjects = job.getSourceObjects();
176176
if (sourceObjects instanceof SelectedItemsList) {
177-
jobStats.setSourceObjectsCount(((SelectedItemsList<?>) sourceObjects).getIds().size());
177+
getJobStats().setSourceObjectsCount(((SelectedItemsList<?>) sourceObjects).getIds().size());
178178
}
179179
this.instanceId = job.getInstanceId();
180180
this.instanceName = job.getInstanceName();

0 commit comments

Comments
 (0)