aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/SnapshotCache.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/SnapshotCacheTest.java15
3 files changed, 1 insertions, 18 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
index e6a9734d501..625d6480aa2 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
@@ -67,7 +67,7 @@ public final class DefaultResourcePersister implements ResourcePersister {
}
private void addToCache(Resource resource, Snapshot snapshot) {
- if (snapshot != null && !ResourceUtils.isLibrary(resource)) {
+ if (snapshot != null) {
snapshotsByResource.put(resource, snapshot);
resourceCache.add(resource);
snapshotCache.put(resource.getEffectiveKey(), snapshot);
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/SnapshotCache.java b/sonar-batch/src/main/java/org/sonar/batch/index/SnapshotCache.java
index e758b0420bb..6e7e1f6eb7b 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/SnapshotCache.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/SnapshotCache.java
@@ -19,7 +19,6 @@
*/
package org.sonar.batch.index;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import org.sonar.api.BatchComponent;
import org.sonar.api.database.model.Snapshot;
@@ -36,7 +35,6 @@ public class SnapshotCache implements BatchComponent {
}
public SnapshotCache put(String componentKey, Snapshot snapshot) {
- Preconditions.checkState(!snapshots.containsKey(componentKey), "Component is already registered: " + componentKey);
snapshots.put(componentKey, snapshot);
return this;
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/SnapshotCacheTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/SnapshotCacheTest.java
index 29df021f0c8..aa279bd5fe9 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/SnapshotCacheTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/SnapshotCacheTest.java
@@ -23,7 +23,6 @@ import org.junit.Test;
import org.sonar.api.database.model.Snapshot;
import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.assertions.Fail.fail;
import static org.mockito.Mockito.mock;
public class SnapshotCacheTest {
@@ -38,18 +37,4 @@ public class SnapshotCacheTest {
assertThat(cache.get(componentKey)).isSameAs(snapshot);
assertThat(cache.get("other")).isNull();
}
-
- @Test
- public void should_fail_if_put_twice() throws Exception {
- SnapshotCache cache = new SnapshotCache();
- String componentKey = "org.apache.struts:struts-core";
- cache.put(componentKey, snapshot);
- try {
- cache.put(componentKey, mock(Snapshot.class));
- fail();
- } catch (IllegalStateException e) {
- // success
- assertThat(e).hasMessage("Component is already registered: org.apache.struts:struts-core");
- }
- }
}