X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fcode-generator%2Fyang-model-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fparser%2Futil%2FParserListenerUtils.java;h=f139af8e3f406e57bc0ad86abbd80b6abbe063ea;hb=refs%2Fchanges%2F79%2F579%2F2;hp=d913f5b87fbd25798d1938add82aba073ea00cda;hpb=c04f8eba6fd7e6939e022071deba887bbbddffee;p=controller.git diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserListenerUtils.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserListenerUtils.java index d913f5b87f..f139af8e3f 100644 --- a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserListenerUtils.java +++ b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserListenerUtils.java @@ -1080,6 +1080,7 @@ public final class ParserListenerUtils { public static TypeDefinition parseTypeWithBody(final String moduleName, final String typeName, final Type_body_stmtsContext typeBody, final List actualPath, final URI namespace, final Date revision, final String prefix, final Builder parent) { + final int line = typeBody.getStart().getLine(); TypeDefinition baseType = null; Integer fractionDigits = getFractionDigits(typeBody); @@ -1087,7 +1088,7 @@ public final class ParserListenerUtils { List patternStatements = getPatternConstraint(typeBody); List rangeStatements = getRangeConstraints(typeBody); - TypeConstraints constraints = new TypeConstraints(moduleName, typeBody.getStart().getLine()); + TypeConstraints constraints = new TypeConstraints(moduleName, line); constraints.addFractionDigits(fractionDigits); constraints.addLengths(lengthStatements); constraints.addPatterns(patternStatements); @@ -1115,6 +1116,9 @@ public final class ParserListenerUtils { } else if ("int64".equals(typeName)) { intType = new Int64(baseTypePath); } + if(intType == null) { + throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName); + } constraints.addRanges(intType.getRangeStatements()); baseType = intType; } else if (typeName.startsWith("uint")) { @@ -1128,6 +1132,9 @@ public final class ParserListenerUtils { } else if ("uint64".equals(typeName)) { uintType = new Uint64(baseTypePath); } + if(uintType == null) { + throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName); + } constraints.addRanges(uintType.getRangeStatements()); baseType = uintType; } else if ("enumeration".equals(typeName)) {