| 1 | package fr.sii.ogham.template.exception; | |
| 2 | ||
| 3 | import static fr.sii.ogham.core.CoreConstants.SERIAL_VERSION_UID; | |
| 4 | ||
| 5 | import fr.sii.ogham.core.exception.template.ParseException; | |
| 6 | import fr.sii.ogham.core.message.content.Variant; | |
| 7 | import fr.sii.ogham.core.resource.path.ResourcePath; | |
| 8 | import fr.sii.ogham.core.template.context.Context; | |
| 9 | ||
| 10 | /** | |
| 11 | * When a {@link ResourcePath} references a template, the path may be partial to | |
| 12 | * be able to load a template that has variants. A variant may be a specific | |
| 13 | * format (HTML, text, ...) or could also be for a language or anything else. | |
| 14 | * | |
| 15 | * This exception is thrown when resolving variant for a template is not found | |
| 16 | * or can't be read/accessed or any other reason. | |
| 17 | * | |
| 18 | * This exception is general and has subclasses to identify specific reasons. | |
| 19 | * | |
| 20 | * | |
| 21 | * @author Aurélien Baudet | |
| 22 | * | |
| 23 | * @see TemplateVariantNotFoundException | |
| 24 | * @see UnknownVariantException | |
| 25 | */ | |
| 26 | @SuppressWarnings({ "squid:MaximumInheritanceDepth" }) // Object, Throwable and | |
| 27 | // Exception are counted | |
| 28 | // but this is stupid | |
| 29 | public class VariantResolutionException extends ParseException { | |
| 30 | private static final long serialVersionUID = SERIAL_VERSION_UID; | |
| 31 | ||
| 32 | private final transient Variant variant; | |
| 33 | ||
| 34 | public VariantResolutionException(String message, ResourcePath template, Context context, Variant variant) { | |
| 35 | super(message, template, context); | |
| 36 | this.variant = variant; | |
| 37 | } | |
| 38 | ||
| 39 | public Variant getVariant() { | |
| 40 |
1
1. getVariant : replaced return value with null for fr/sii/ogham/template/exception/VariantResolutionException::getVariant → NO_COVERAGE |
return variant; |
| 41 | } | |
| 42 | } | |
Mutations | ||
| 40 |
1.1 |