Bug 8831 - Yang 1.1 default values are not checked correctly
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / LeafEffectiveStatementImpl.java
index 93d2cfc87ca294bf54e1c6c9a47ab14cdf6d5533..605d6782cab38637a196ffcbc992a18e9be27a08 100644 (file)
@@ -57,15 +57,10 @@ public final class LeafEffectiveStatementImpl extends AbstractEffectiveDataSchem
             }
         }
 
-        try {
-            SourceException.throwIf(TypeUtils.hasDefaultValueMarkedWithIfFeature(ctx.getRootVersion(), typeStmt, dflt),
-                    ctx.getStatementSourceReference(),
-                    "Leaf '%s' has default value '%s' marked with an if-feature statement.",
-                    ctx.getStatementArgument(), dflt);
-        } catch (final IllegalStateException e) {
-            throw new SourceException(ctx.getStatementSourceReference(), e,
-                    "Unable to find a default value for leaf '%s'", ctx.getStatementArgument());
-        }
+        SourceException.throwIf(TypeUtils.hasDefaultValueMarkedWithIfFeature(ctx.getRootVersion(), typeStmt, dflt),
+                ctx.getStatementSourceReference(),
+                "Leaf '%s' has default value '%s' marked with an if-feature statement.", ctx.getStatementArgument(),
+                dflt);
 
         defaultStr = dflt;
         unitsStr = units;