| 1 | package fr.sii.ogham.core.exception.template; | |
| 2 | ||
| 3 | import static fr.sii.ogham.core.CoreConstants.SERIAL_VERSION_UID; | |
| 4 | ||
| 5 | import fr.sii.ogham.core.exception.MessagingException; | |
| 6 | import fr.sii.ogham.core.resource.path.ResourcePath; | |
| 7 | import fr.sii.ogham.core.template.context.Context; | |
| 8 | import fr.sii.ogham.core.template.parser.TemplateParser; | |
| 9 | import fr.sii.ogham.template.exception.VariantResolutionException; | |
| 10 | ||
| 11 | /** | |
| 12 | * General exception to indicate that the {@link TemplateParser} couldn't parse | |
| 13 | * the template. | |
| 14 | * | |
| 15 | * It may happen in several cases: | |
| 16 | * <ul> | |
| 17 | * <li>The template doesn't exist</li> | |
| 18 | * <li>The template is not readable</li> | |
| 19 | * <li>The template exists but it is malformed</li> | |
| 20 | * <li>The template is well-formed but the data (context) doesn't provide the | |
| 21 | * right variables</li> | |
| 22 | * <li>...</li> | |
| 23 | * </ul> | |
| 24 | * | |
| 25 | * This exception wraps the original cause. It also has several subclasses to | |
| 26 | * indicate specific reasons for some failures. | |
| 27 | * | |
| 28 | * @author Aurélien Baudet | |
| 29 | * | |
| 30 | * @see VariantResolutionException | |
| 31 | */ | |
| 32 | public class ParseException extends MessagingException { | |
| 33 | private static final long serialVersionUID = SERIAL_VERSION_UID; | |
| 34 | ||
| 35 | private final transient ResourcePath templatePath; | |
| 36 | private final transient Context context; | |
| 37 | ||
| 38 | public ParseException(String message, ResourcePath templatePath, Context context, Throwable cause) { | |
| 39 | super(message, cause); | |
| 40 | this.templatePath = templatePath; | |
| 41 | this.context = context; | |
| 42 | } | |
| 43 | ||
| 44 | public ParseException(String message, ResourcePath templatePath, Context context) { | |
| 45 | super(message); | |
| 46 | this.templatePath = templatePath; | |
| 47 | this.context = context; | |
| 48 | } | |
| 49 | ||
| 50 | public ParseException(ResourcePath templatePath, Context context, Throwable cause) { | |
| 51 | super(cause); | |
| 52 | this.templatePath = templatePath; | |
| 53 | this.context = context; | |
| 54 | } | |
| 55 | ||
| 56 | public ResourcePath getTemplatePath() { | |
| 57 |
2
1. getTemplatePath : replaced return value with null for fr/sii/ogham/core/exception/template/ParseException::getTemplatePath → NO_COVERAGE 2. getTemplatePath : replaced return value with null for fr/sii/ogham/core/exception/template/ParseException::getTemplatePath → KILLED |
return templatePath; |
| 58 | } | |
| 59 | ||
| 60 | public Context getContext() { | |
| 61 |
1
1. getContext : replaced return value with null for fr/sii/ogham/core/exception/template/ParseException::getContext → NO_COVERAGE |
return context; |
| 62 | } | |
| 63 | } | |
Mutations | ||
| 57 |
1.1 2.2 |
|
| 61 |
1.1 |