]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17287 Fix conversion of flow types
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 12 Sep 2022 16:56:31 +0000 (11:56 -0500)
committersonartech <sonartech@sonarsource.com>
Fri, 16 Sep 2022 20:03:14 +0000 (20:03 +0000)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/TrackerRawInputFactory.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/issue/TextRangeResponseFormatter.java
sonar-scanner-engine/src/main/java/org/sonar/scanner/issue/IssuePublisher.java

index c824e40efa1e3c8566d374b74d124ebfab509b53..d101ebf4250103ee30921834017c1ed3d77f4e48 100644 (file)
@@ -263,8 +263,10 @@ public class TrackerRawInputFactory {
           return Optional.of(DbIssues.FlowType.DATA);
         case EXECUTION:
           return Optional.of(DbIssues.FlowType.EXECUTION);
-        default:
+        case UNDEFINED:
           return Optional.empty();
+        default:
+          throw new IllegalArgumentException("Unrecognized type: " + flowType);
       }
     }
 
index d105c4e533ce0b97180b997f3704d7a623f7d4bb..42473599f39570afbc68d0c61776ca3bd9485d8b 100644 (file)
@@ -71,8 +71,10 @@ public class TextRangeResponseFormatter {
         return Optional.of(Common.FlowType.DATA);
       case EXECUTION:
         return Optional.of(Common.FlowType.EXECUTION);
+      case UNDEFINED:
+        // we should only get this value if no type was set (since it's the default value of the enum), in which case this method shouldn't be called.
       default:
-        return Optional.empty();
+        throw new IllegalArgumentException("Unrecognized flow type: " + flowType);
     }
   }
 
index f9b38d860cbaa6596685e5204edb6cbfa9298d58..965600c0a22f267007dea9c9deff4faa54dd794e 100644 (file)
@@ -195,8 +195,10 @@ public class IssuePublisher {
         return ScannerReport.FlowType.EXECUTION;
       case DATA:
         return ScannerReport.FlowType.DATA;
-      default:
+      case UNDEFINED:
         return ScannerReport.FlowType.UNDEFINED;
+      default:
+        throw new IllegalArgumentException("Unrecognized flow type: " + flowType);
     }
   }