aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-27 14:52:10 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-27 14:52:10 +0000
commit4193099ff2d1baa0e687b98763e3556b91f6fea6 (patch)
tree0bb6e4d2b8e81dd6442b508d45732665add40f7f /sonar-batch
parenta6071ca39f147f61cfb1dec136d484cba814eba5 (diff)
downloadsonarqube-4193099ff2d1baa0e687b98763e3556b91f6fea6.tar.gz
sonarqube-4193099ff2d1baa0e687b98763e3556b91f6fea6.zip
SONAR-1711 temporarily log warnings instead of throwing an exception when saving measures/violations on unknown resources
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/indexer/DefaultSonarIndex.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/indexer/DefaultSonarIndexTest.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/indexer/DefaultSonarIndex.java b/sonar-batch/src/main/java/org/sonar/batch/indexer/DefaultSonarIndex.java
index e6c2c21cd7b..14b6f015d4a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/indexer/DefaultSonarIndex.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/indexer/DefaultSonarIndex.java
@@ -177,8 +177,8 @@ public class DefaultSonarIndex extends SonarIndex {
return bucket;
}
- if (mustExist && lock.isLocked() && !ResourceUtils.isLibrary(resource)) {
- throw new SonarException("The following resource has not been registered before saving violation/measure/event: " + resource);
+ if (mustExist && lock.isLocked() && !ResourceUtils.isLibrary(resource)) {
+ LOG.warn("The following resource has not been registered before saving violation/measure/event: " + resource);
}
prepareResource(resource);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/indexer/DefaultSonarIndexTest.java b/sonar-batch/src/test/java/org/sonar/batch/indexer/DefaultSonarIndexTest.java
index c818de86ad5..4e2387319d0 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/indexer/DefaultSonarIndexTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/indexer/DefaultSonarIndexTest.java
@@ -19,6 +19,7 @@
*/
package org.sonar.batch.indexer;
+import org.junit.Ignore;
import org.junit.Test;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
@@ -60,6 +61,7 @@ public class DefaultSonarIndexTest extends AbstractDbUnitTestCase {
}
@Test(expected = SonarException.class)
+ @Ignore("Temporarily log warnings instead of throwing an exception")
public void failIfLockedAndAddingMeasureOnUnknownResource() {
DefaultResourceCreationLock lock = new DefaultResourceCreationLock();
lock.lock();