]> source.dussan.org Git - sonarqube.git/commitdiff
do not keep in cache violations in DecoratorContext
authorsimonbrandhof <simon.brandhof@gmail.com>
Fri, 24 Sep 2010 09:49:34 +0000 (09:49 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Fri, 24 Sep 2010 09:49:34 +0000 (09:49 +0000)
sonar-batch/src/main/java/org/sonar/batch/DefaultDecoratorContext.java

index 05314d3040e02664f3796be3686117b5e9ff4195..f812bd0e8fefabfcf7425ec017605719a32fc92b 100644 (file)
@@ -43,7 +43,6 @@ public class DefaultDecoratorContext implements DecoratorContext {
   private boolean readOnly = false;
 
   private List<DecoratorContext> childrenContexts;
-  private List<Violation> violations;
   private ViolationsDao violationsDao;
 
   public DefaultDecoratorContext(Resource resource,
@@ -60,7 +59,6 @@ public class DefaultDecoratorContext implements DecoratorContext {
 
   public DefaultDecoratorContext setReadOnly(boolean b) {
     readOnly = b;
-    violations = null;
     childrenContexts = null;
     return this;
   }
@@ -125,13 +123,12 @@ public class DefaultDecoratorContext implements DecoratorContext {
 
 
   public List<Violation> getViolations() {
-    if (violations == null) {
       Bucket bucket = index.getBucket(resource);
       if (bucket != null && bucket.getSnapshotId() != null) {
-        violations = violationsDao.getViolations(resource, bucket.getSnapshotId());
+        return violationsDao.getViolations(resource, bucket.getSnapshotId());
       }
-    }
-    return violations;
+
+    return null;
   }
 
   public Dependency saveDependency(Dependency dependency) {