aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 13:27:51 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-05-30 13:27:51 +0200
commitdcc0783e3529e59a42552ac33ded31c4b162e8a8 (patch)
treeb50f41606966c03a359953c6fb8da3e1ca474bcf /sonar-batch/src
parenta49b0c598c69d3b4b095f5b583368db4b6708282 (diff)
downloadsonarqube-dcc0783e3529e59a42552ac33ded31c4b162e8a8.tar.gz
sonarqube-dcc0783e3529e59a42552ac33ded31c4b162e8a8.zip
SONAR-4334 Fix issue when last snapshot is null
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java5
1 files changed, 2 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
index 40d12a7fd28..1d022191c91 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
@@ -82,11 +82,10 @@ public class ProjectConfigurator implements BatchComponent {
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."
);
}
}