Log attempts to override fraction-digits
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / type / DecimalTypeEffectiveStatementImpl.java
index e867e4c569d0c8f1153ea4c76b100ff23532e4c8..536cdebc8c37b0a774317f8d961a13f856ef9116 100644 (file)
@@ -19,10 +19,12 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.DeclaredEffectiveStatementBase;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.FractionDigitsEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnknownEffectiveStatementImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public final class DecimalTypeEffectiveStatementImpl extends DeclaredEffectiveStatementBase<String, TypeStatement>
         implements TypeEffectiveStatement<TypeStatement> {
-
+    private static final Logger LOG = LoggerFactory.getLogger(Decimal64SpecificationEffectiveStatementImpl.class);
     private final DecimalTypeDefinition typeDefinition;
 
     public DecimalTypeEffectiveStatementImpl(
@@ -42,11 +44,15 @@ public final class DecimalTypeEffectiveStatementImpl extends DeclaredEffectiveSt
             }
             if (stmt instanceof FractionDigitsEffectiveStatementImpl) {
                 final Integer digits = ((FractionDigitsEffectiveStatementImpl)stmt).argument();
-// FIXME: activate this and fix models
-//                if (!baseType.getFractionDigits().equals(digits)) {
-//                    throw new SourceException(String.format("Cannot override fraction-digits from base type %s",
-//                        baseType), ctx.getStatementSourceReference());
-//                }
+
+                if (!baseType.getFractionDigits().equals(digits)) {
+                    LOG.warn("Ignoring attempt to override fraction-digits to {} at {}, base type is {}", digits,
+                        ctx.getStatementSourceReference(), baseType);
+
+                    // FIXME: promote to a full error once our models are fixed
+                    // throw new SourceException(String.format("Cannot override fraction-digits from base type %s",
+                    // baseType), ctx.getStatementSourceReference());
+                }
             }
         }