BUG-8043: correct RangeConstraint definition
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / type / IntegerTypeEffectiveStatementImpl.java
index b98b8928d82da548be6d000702f06e2b2681de6f..64db59535fce613c214eab4a3f2ac71f2df3c9c4 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.TypeStatement;
 import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.util.type.InvalidRangeConstraintException;
 import org.opendaylight.yangtools.yang.model.util.type.RangeRestrictedTypeBuilder;
 import org.opendaylight.yangtools.yang.model.util.type.RestrictedTypes;
@@ -38,7 +37,8 @@ public final class IntegerTypeEffectiveStatementImpl extends
 
         for (EffectiveStatement<?, ?> stmt : effectiveSubstatements()) {
             if (stmt instanceof RangeEffectiveStatementImpl) {
-                builder.setRangeAlternatives(((RangeEffectiveStatementImpl)stmt).argument());
+                final RangeEffectiveStatementImpl range = (RangeEffectiveStatementImpl) stmt;
+                builder.setRangeConstraint(range, range.argument());
             }
             if (stmt instanceof UnknownEffectiveStatementImpl) {
                 builder.addUnknownSchemaNode((UnknownEffectiveStatementImpl)stmt);
@@ -48,9 +48,8 @@ public final class IntegerTypeEffectiveStatementImpl extends
         try {
             typeDefinition = builder.build();
         } catch (InvalidRangeConstraintException e) {
-            final RangeConstraint c = e.getOffendingConstraint();
-            throw new SourceException(ctx.getStatementSourceReference(), e, "Invalid range constraint: <%s, %s>",
-                c.getMin(), c.getMax());
+            throw new SourceException(ctx.getStatementSourceReference(), e, "Invalid range constraint: %s",
+                e.getOffendingRanges());
         }
     }