From: Teryk Bellahsene Date: Fri, 5 Dec 2014 08:49:12 +0000 (+0100) Subject: fix purge task when trying to delete a non existant component X-Git-Tag: 5.0-RC1~54 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=781301a7ee5520efb5a00cc3ee99302abfaabf00;p=sonarqube.git fix purge task when trying to delete a non existant component --- diff --git a/sonar-core/src/main/java/org/sonar/server/computation/dbcleaner/DefaultPurgeTask.java b/sonar-core/src/main/java/org/sonar/server/computation/dbcleaner/DefaultPurgeTask.java index df991fe48a9..4324aedd7eb 100644 --- a/sonar-core/src/main/java/org/sonar/server/computation/dbcleaner/DefaultPurgeTask.java +++ b/sonar-core/src/main/java/org/sonar/server/computation/dbcleaner/DefaultPurgeTask.java @@ -56,8 +56,11 @@ public class DefaultPurgeTask implements PurgeTask { @Override public DefaultPurgeTask delete(long resourceId) { - ResourceDto project = resourceDao.getResource(resourceId); - purgeDao.deleteResourceTree(new IdUuidPair(project.getId(), project.getUuid())); + ResourceDto resource = resourceDao.getResource(resourceId); + if (resource != null) { + purgeDao.deleteResourceTree(new IdUuidPair(resource.getId(), resource.getUuid())); + } + return this; }