diff --git a/src/main/java/org/opensearch/securityanalytics/services/STIX2IOCFetchService.java b/src/main/java/org/opensearch/securityanalytics/services/STIX2IOCFetchService.java index 17995a571..a541b3b16 100644 --- a/src/main/java/org/opensearch/securityanalytics/services/STIX2IOCFetchService.java +++ b/src/main/java/org/opensearch/securityanalytics/services/STIX2IOCFetchService.java @@ -270,7 +270,8 @@ public void downloadFromUrlAndIndexIOCs(SATIFSourceConfig saTifSourceConfig, Act } break; default: - // if the feed type doesn't match any of the supporting feed types, throw an exception + log.error("unsupported feed format for url download:" + source.getFeedFormat()); + listener.onFailure(new UnsupportedOperationException("unsupported feed format for url download:" + source.getFeedFormat())); } } diff --git a/src/main/java/org/opensearch/securityanalytics/threatIntel/common/SourceConfigDtoValidator.java b/src/main/java/org/opensearch/securityanalytics/threatIntel/common/SourceConfigDtoValidator.java index bcf0b6567..6cb4450e4 100644 --- a/src/main/java/org/opensearch/securityanalytics/threatIntel/common/SourceConfigDtoValidator.java +++ b/src/main/java/org/opensearch/securityanalytics/threatIntel/common/SourceConfigDtoValidator.java @@ -58,10 +58,10 @@ public List validateSourceConfigDto(SATIFSourceConfigDto sourceConfigDto break; case URL_DOWNLOAD: if (sourceConfigDto.getSchedule() == null) { - errorMsgs.add("Must pass in schedule for URL_DONWLOAD source type"); + errorMsgs.add("Must pass in schedule for URL_DOWNLOAD source type"); } if (sourceConfigDto.getSource() != null && sourceConfigDto.getSource() instanceof UrlDownloadSource == false) { - errorMsgs.add("Source must be URL_DONWLOAD source type"); + errorMsgs.add("Source must be URL_DOWNLOAD source type"); } break; } diff --git a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/DefaultTifSourceConfigLoaderService.java b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/DefaultTifSourceConfigLoaderService.java index f488bbaf3..4114a9526 100644 --- a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/DefaultTifSourceConfigLoaderService.java +++ b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/DefaultTifSourceConfigLoaderService.java @@ -46,7 +46,7 @@ public DefaultTifSourceConfigLoaderService(BuiltInTIFMetadataLoader tifMetadataL } /** - * check if the default + * check if the default tif source configs are loaded. if not, try create them from the feedMetadata.json file. */ public void createDefaultTifConfigsIfNotExists(ActionListener listener) { List tifMetadataList = tifMetadataLoader.getTifMetadataList(); @@ -135,7 +135,8 @@ public void onFailure(Exception e) { null, null, true, - List.of(iocType) + List.of(iocType), + true ), null, RestRequest.Method.POST, diff --git a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/SATIFSourceConfigManagementService.java b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/SATIFSourceConfigManagementService.java index 1f10dc3c0..de3b0891b 100644 --- a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/SATIFSourceConfigManagementService.java +++ b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/SATIFSourceConfigManagementService.java @@ -48,10 +48,8 @@ import java.util.Map; import java.util.Set; import java.util.SortedMap; - import java.util.stream.Collectors; -import static org.opensearch.securityanalytics.services.STIX2IOCFeedStore.getIocIndexAlias; import static org.opensearch.securityanalytics.threatIntel.common.SourceConfigType.IOC_UPLOAD; /** diff --git a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/TIFJobUpdateService.java b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/TIFJobUpdateService.java index eb90415b4..ab6ed9915 100644 --- a/src/main/java/org/opensearch/securityanalytics/threatIntel/service/TIFJobUpdateService.java +++ b/src/main/java/org/opensearch/securityanalytics/threatIntel/service/TIFJobUpdateService.java @@ -187,7 +187,7 @@ public void onFailure(Exception e) { } break; default: - // if the feed type doesn't match any of the supporting feed types, throw an exception + onFailure(new UnsupportedOperationException("Not a supported feed format : " + tifMetadata.getFeedType())); } } } catch (IOException ex) {