summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
index 0394073e57..9f3dd0790f 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
@@ -26,6 +26,7 @@ import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.ErrorMessageCode;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.api.Logger;
@@ -55,7 +56,6 @@ public class ToscaValidationServiceImpl implements ToscaValidationService {
private static final String SDCPARSER_JTOSCA_VALIDATIONISSUE_CONFIG =
"SDCParser_jtosca-validation-issue-configuration.yaml";
private static final String SDCPARSER_ERROR_CONFIG = "SDCParser_error-configuration.yaml";
- private static final String TOSCA_DEFINITION_VERSION = "tosca_definitions_version";
static {
// Override default SDC Parser configuration
@@ -119,17 +119,17 @@ public class ToscaValidationServiceImpl implements ToscaValidationService {
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
- private boolean isToscaYaml(String filePath) {
+ private boolean isToscaYaml(final String filePath) {
boolean retValue = false;
- try (InputStream input = new BufferedInputStream(new FileInputStream(new File(filePath)));) {
- Yaml yaml = new Yaml();
- LinkedHashMap<String,Object> data = (LinkedHashMap) yaml.load(input);
- if(data.get(TOSCA_DEFINITION_VERSION) != null) {
+ try (final InputStream input = new BufferedInputStream(new FileInputStream(new File(filePath)));) {
+ final Yaml yaml = new Yaml();
+ final LinkedHashMap<String,Object> data = (LinkedHashMap) yaml.load(input);
+ if(data.get(ToscaTagNamesEnum.TOSCA_VERSION.getElementName()) != null) {
retValue = true;
}
}
- catch(Exception e){
+ catch(final Exception e){
LOGGER.info("Ignore the exception as the input file may not be a Tosca Yaml; let the " +
"default value return", e);
}