From 43697566da8bc57708eef3befa20bfe984ffec85 Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Wed, 16 Oct 2024 12:08:26 +0200 Subject: Add more meaningful exception when path to schema files is wrong - throw runtime exception when schema files cannot be found - update eclipse persistence (2.7.11 -> 2.7.15) Issue-ID: AAI-4018 Change-Id: Id3a91fbddd903433413e0409c64deac360c80365 Signed-off-by: Fiete Ostkamp --- .../main/java/org/onap/aai/setup/AAIConfigTranslator.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'aai-schema-ingest') diff --git a/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java b/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java index 66ffcf88..ca5eed39 100644 --- a/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java +++ b/aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java @@ -48,7 +48,7 @@ public class AAIConfigTranslator extends ConfigTranslator { /* * (non-Javadoc) - * + * * @see org.onap.aai.setup.ConfigTranslator#getNodeFiles() */ @Override @@ -70,7 +70,7 @@ public class AAIConfigTranslator extends ConfigTranslator { /* * (non-Javadoc) - * + * * @see org.onap.aai.setup.ConfigTranslator#getEdgeFiles() */ @Override @@ -94,9 +94,13 @@ public class AAIConfigTranslator extends ConfigTranslator { private List getVersionFiles(String startDirectory, SchemaVersion schemaVersion, Supplier> inclusionPattern, Supplier> exclusionPattern) { - final File versionDirectory = new File(startDirectory + "/" + schemaVersion.toString()); - final List container = Arrays.stream(versionDirectory.listFiles()) - .filter(Objects::nonNull) + final File versionDirectory = new File(startDirectory + "/" + schemaVersion.toString()); + File[] versionFiles = versionDirectory.listFiles(); + if(versionFiles == null) { + throw new RuntimeException("No files found in directory: " + versionDirectory.getAbsolutePath()); + } + final List container = Arrays.stream(versionFiles) + .filter(Objects::nonNull) .map(File::getName) .filter(versionFileName -> inclusionPattern .get() -- cgit 1.2.3-korg