summaryrefslogtreecommitdiffstats
path: root/aai-schema-ingest
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-16 12:08:26 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-16 12:08:26 +0200
commit43697566da8bc57708eef3befa20bfe984ffec85 (patch)
tree4bb271c28ffe21d84ccaba06aebee08a8f36b1b4 /aai-schema-ingest
parent8fe5e2bb110b1a99523fda8214c32e1333b57351 (diff)
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 <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-schema-ingest')
-rw-r--r--aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java14
1 files changed, 9 insertions, 5 deletions
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<String> getVersionFiles(String startDirectory, SchemaVersion schemaVersion,
Supplier<Stream<String>> inclusionPattern, Supplier<Stream<String>> exclusionPattern) {
- final File versionDirectory = new File(startDirectory + "/" + schemaVersion.toString());
- final List<String> 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<String> container = Arrays.stream(versionFiles)
+ .filter(Objects::nonNull)
.map(File::getName)
.filter(versionFileName -> inclusionPattern
.get()