diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java index bd049b2dfb..9c33c1b97f 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/YamlValidatorUtil.java @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openecomp.sdc.validation.impl.util; import org.openecomp.sdc.common.errors.Messages; @@ -21,29 +20,25 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import org.yaml.snakeyaml.parser.ParserException; public class YamlValidatorUtil { - private YamlValidatorUtil() { - - } - - public static String getParserExceptionReason(Exception exception) { - String reason = null; + private YamlValidatorUtil() { + } - if (exception.getCause() instanceof MarkedYAMLException) { - if (exception.getCause() != null) { - if (exception.getCause().getCause() instanceof ParserException) { - reason = exception.getCause().getCause().getMessage(); + public static String getParserExceptionReason(Exception exception) { + String reason = null; + if (exception.getCause() instanceof MarkedYAMLException) { + if (exception.getCause() != null) { + if (exception.getCause().getCause() instanceof ParserException) { + reason = exception.getCause().getCause().getMessage(); + } else { + reason = exception.getCause().getMessage(); + } + } + } else if (exception instanceof MarkedYAMLException) { + reason = exception.getMessage(); } else { - reason = exception.getCause().getMessage(); + reason = Messages.GENERAL_YAML_PARSER_ERROR.getErrorMessage(); } - } - } else if (exception instanceof MarkedYAMLException) { - - reason = exception.getMessage(); - - } else { - reason = Messages.GENERAL_YAML_PARSER_ERROR.getErrorMessage(); + return reason; } - return reason; - } } |