]> source.dussan.org Git - sonarqube.git/commitdiff
Fix merge of protocol buffers branch
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 2 Feb 2015 16:15:21 +0000 (17:15 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 2 Feb 2015 16:27:47 +0000 (17:27 +0100)
sonar-batch/src/main/java/org/sonar/batch/report/ComponentsPublisher.java

index f8f44fc7a3d9657b927e4ca142a1be3f4e01de04..797a479a2dc21032a9d0a813bc59387737843904 100644 (file)
@@ -63,12 +63,18 @@ public class ComponentsPublisher implements ReportPublisher {
 
     // non-null fields
     builder.setRef(batchResource.batchId());
-    builder.setSnapshotId(batchResource.snapshotId());
-    builder.setUuid(r.getUuid());
     builder.setType(getType(r));
 
     // protocol buffers does not accept null values
 
+    String uuid = r.getUuid();
+    if (uuid != null) {
+      builder.setUuid(uuid);
+    }
+    Integer sid = batchResource.snapshotId();
+    if (sid != null) {
+      builder.setSnapshotId(sid);
+    }
     if (ResourceUtils.isFile(r)) {
       builder.setIsTest(ResourceUtils.isUnitTestClass(r));
     }