ResourceModel persistedProject = databaseSession.getSingleResult(ResourceModel.class, "key", projectKey, "enabled", true);
if (persistedProject != null) {
Snapshot lastSnapshot = databaseSession.getSingleResult(Snapshot.class, "resourceId", persistedProject.getId(), "last", true);
- Date lastSnapshotCreationDate = lastSnapshot.getCreatedAt();
- if (lastSnapshot != null && !lastSnapshotCreationDate.before(analysisDate)) {
+ if (lastSnapshot != null && !lastSnapshot.getCreatedAt().before(analysisDate)) {
throw new IllegalArgumentException(
"'sonar.projectDate' property cannot be older than the date of the last known quality snapshot on this project. Value: '"+ settings.getString(CoreProperties.PROJECT_DATE_PROPERTY) + "'. " +
- "Latest quality snapshot: '"+ DateUtils.formatDate(lastSnapshotCreationDate) +"'. This property may only be used to rebuild the past in a chronological order."
+ "Latest quality snapshot: '"+ DateUtils.formatDate(lastSnapshot.getCreatedAt()) +"'. This property may only be used to rebuild the past in a chronological order."
);
}
}