YANG sub module linking + unsupported yang construct + defect fix
Change-Id: I224c8c14ee2111f6844278cb540c48651544f59b
diff --git a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
index 08edab1..e0a51df 100644
--- a/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
+++ b/utils/yangutils/src/main/java/org/onosproject/yangutils/parser/impl/listeners/EnumListener.java
@@ -146,7 +146,14 @@
boolean isValuePresent = false;
for (YangEnum curEnum : yangEnumeration.getEnumSet()) {
- if (maxValue <= curEnum.getValue()) {
+ if (curEnum.getValue() == Integer.MAX_VALUE) {
+ ParserException parserException = new ParserException("YANG file error : "
+ + "An enum value MUST be specified for enum substatements following the one"
+ + "with the current highest value");
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
+ throw parserException;
+ } else if (maxValue <= curEnum.getValue()) {
maxValue = curEnum.getValue();
isValuePresent = true;
}
@@ -161,8 +168,8 @@
} catch (DataModelException e) {
ParserException parserException = new ParserException(constructExtendedListenerErrorMessage(
DUPLICATE_ENTRY, ENUM_DATA, ctx.string().getText(), EXIT, e.getMessage()));
- parserException.setLine(ctx.string().STRING(0).getSymbol().getLine());
- parserException.setCharPosition(ctx.string().STRING(0).getSymbol().getCharPositionInLine());
+ parserException.setLine(ctx.getStart().getLine());
+ parserException.setCharPosition(ctx.getStart().getCharPositionInLine());
throw parserException;
}
break;
@@ -173,8 +180,7 @@
}
} else {
throw new ParserException(
- constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUM_DATA, ctx.string().getText(),
- EXIT));
+ constructListenerErrorMessage(MISSING_CURRENT_HOLDER, ENUM_DATA, ctx.string().getText(), EXIT));
}
}
}