diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-30 13:27:51 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-30 13:27:51 +0200 |
commit | dcc0783e3529e59a42552ac33ded31c4b162e8a8 (patch) | |
tree | b50f41606966c03a359953c6fb8da3e1ca474bcf /sonar-batch/src | |
parent | a49b0c598c69d3b4b095f5b583368db4b6708282 (diff) | |
download | sonarqube-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.java | 5 |
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." ); } } |