]> source.dussan.org Git - sonarqube.git/commitdiff
quality model API: removeCharacteristic() must support disabled characteristics
authorsimonbrandhof <simon.brandhof@gmail.com>
Mon, 4 Oct 2010 14:34:48 +0000 (14:34 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Mon, 4 Oct 2010 14:34:48 +0000 (14:34 +0000)
sonar-plugin-api/src/main/java/org/sonar/api/qualitymodel/Model.java

index fb5b5ad6b43738250603ec295492f9eb11a17595..874d64bf68d1ff371613d9f23dd2af54a8b469f7 100644 (file)
@@ -177,7 +177,14 @@ public final class Model implements Comparable<Model> {
   }
 
   public Model removeCharacteristic(Characteristic characteristic) {
-    characteristic.setEnabled(false);
+    if (characteristic.getId() == null) {
+      characteristics.remove(characteristic);
+      for (Characteristic parent : characteristic.getParents()) {
+        parent.removeChild(characteristic);
+      }
+    } else {
+      characteristic.setEnabled(false);
+    }
     for (Characteristic child : characteristic.getChildren()) {
       removeCharacteristic(child);
     }