Skip to content

Commit 81fdf95

Browse files
committed
Add methods to get tenant settings and check if IDE scans enabled
1 parent 09c3138 commit 81fdf95

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/java/com/checkmarx/ast/wrapper/CxWrapper.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,15 @@ public List<LearnMore> learnMore(String queryId) throws CxException, IOException
375375
}
376376

377377
public boolean ideScansEnabled() throws CxException, IOException, InterruptedException {
378-
return tenantSettings().stream()
379-
.filter(t -> t.getKey().equals(CxConstants.IDE_SCANS_KEY))
380-
.findFirst()
381-
.map(t -> Boolean.parseBoolean(t.getValue()))
382-
.orElse(false);
378+
List<TenantSetting> tenantSettings = tenantSettings();
379+
if (tenantSettings == null) {
380+
throw new CxException(1, "Unable to parse tenant settings");
381+
}
382+
return tenantSettings.stream()
383+
.filter(t -> t.getKey().equals(CxConstants.IDE_SCANS_KEY))
384+
.findFirst()
385+
.map(t -> Boolean.parseBoolean(t.getValue()))
386+
.orElse(false);
383387
}
384388

385389
public List<TenantSetting> tenantSettings() throws CxException, IOException, InterruptedException {

0 commit comments

Comments
 (0)