Skip to content

Commit

Permalink
error handling on null values
Browse files Browse the repository at this point in the history
  • Loading branch information
notshivansh committed Nov 7, 2023
1 parent e4ca90d commit a77abb4
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.akto.dto.testing.TestResult;
import com.akto.dto.testing.TestingRunResult;
import com.akto.dto.testing.sources.TestSourceConfig;
import com.akto.log.LoggerMaker;
import com.akto.log.LoggerMaker.LogDb;
import com.akto.util.enums.GlobalEnums;
import com.akto.util.enums.GlobalEnums.Severity;
import com.akto.util.enums.GlobalEnums.TestCategory;
Expand All @@ -36,6 +38,9 @@
import static com.akto.util.enums.GlobalEnums.*;

public class IssuesAction extends UserAction {

private static final LoggerMaker loggerMaker = new LoggerMaker(IssuesAction.class);

private List<TestingRunIssues> issues;
private TestingIssuesId issueId;
private List<TestingIssuesId> issueIdArray;
Expand Down Expand Up @@ -222,9 +227,14 @@ public String fetchAllSubCategories() {
Map<String, TestConfig> testConfigMap = YamlTemplateDao.instance.fetchTestConfigMap(true, fetchOnlyActive);
subCategories = new ArrayList<>();
for (Map.Entry<String, TestConfig> entry : testConfigMap.entrySet()) {
BasicDBObject infoObj = createSubcategoriesInfoObj(entry.getValue());
if (infoObj != null) {
subCategories.add(infoObj);
try {
BasicDBObject infoObj = createSubcategoriesInfoObj(entry.getValue());
if (infoObj != null) {
subCategories.add(infoObj);
}
} catch (Exception e) {
String err = "Error while fetching subcategories for " + entry.getKey();
loggerMaker.errorAndAddToDb(err, LogDb.DASHBOARD);
}
}

Expand Down

0 comments on commit a77abb4

Please sign in to comment.