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 / TypeDefEffectiveStatementImpl.java
index b2eaea3e6105782e8156409aaf87c2335a39c455..01db20da00173f877453a9ee61815f8a42f8a262 100644 (file)
@@ -64,16 +64,11 @@ public final class TypeDefEffectiveStatementImpl extends AbstractEffectiveSchema
             }
         }
 
-        try {
-            SourceException
-                    .throwIf(TypeUtils.hasDefaultValueMarkedWithIfFeature(ctx.getRootVersion(), typeEffectiveStmt,
-                            defaultValue), ctx.getStatementSourceReference(),
-                            "Typedef '%s' has default value '%s' marked with an if-feature statement.", ctx
-                                    .getStatementArgument(), defaultValue);
-        } catch (final IllegalStateException e) {
-            throw new SourceException(ctx.getStatementSourceReference(), e,
-                    "Unable to find a default value for typedef '%s'", ctx.getStatementArgument());
-        }
+        SourceException.throwIf(
+                TypeUtils.hasDefaultValueMarkedWithIfFeature(ctx.getRootVersion(), typeEffectiveStmt, defaultValue),
+                ctx.getStatementSourceReference(),
+                "Typedef '%s' has default value '%s' marked with an if-feature statement.", ctx.getStatementArgument(),
+                defaultValue);
 
         typeDefinition = builder.build();
     }