diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-10-16 12:08:26 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-10-16 12:08:26 +0200 |
commit | 43697566da8bc57708eef3befa20bfe984ffec85 (patch) | |
tree | 4bb271c28ffe21d84ccaba06aebee08a8f36b1b4 | |
parent | 8fe5e2bb110b1a99523fda8214c32e1333b57351 (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>
-rw-r--r-- | aai-parent/pom.xml | 2 | ||||
-rw-r--r-- | aai-schema-ingest/src/main/java/org/onap/aai/setup/AAIConfigTranslator.java | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/aai-parent/pom.xml b/aai-parent/pom.xml index 52bedfda..b4cf13e6 100644 --- a/aai-parent/pom.xml +++ b/aai-parent/pom.xml @@ -57,7 +57,7 @@ limitations under the License. <commons.text.version>1.10.0</commons.text.version> <docker.fabric.version>0.40.2</docker.fabric.version> <easy.mock.version>5.0.0</easy.mock.version> - <eclipse.persistence.version>2.7.11</eclipse.persistence.version> + <eclipse.persistence.version>2.7.15</eclipse.persistence.version> <eelf.core.version>2.0.0-oss</eelf.core.version> <freemarker.version>2.3.31</freemarker.version> <google.guava.version>31.1-jre</google.guava.version> 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() |