MPLS-related bug fixes:
- Use subtype() instead of type() inside method ModMplsLabelInstruction.toString() - Check whether the MPLS value is negative inside the MplsLabel() constructor. Change-Id: I770194774219f0c919474928803e078226f2005d
Showing
2 changed files
with
5 additions
and
3 deletions
... | @@ -305,7 +305,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -305,7 +305,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
305 | 305 | ||
306 | @Override | 306 | @Override |
307 | public String toString() { | 307 | public String toString() { |
308 | - return toStringHelper(type().toString()) | 308 | + return toStringHelper(subtype().toString()) |
309 | .add("mpls", mplsLabel).toString(); | 309 | .add("mpls", mplsLabel).toString(); |
310 | } | 310 | } |
311 | 311 | ... | ... |
... | @@ -32,8 +32,10 @@ public class MplsLabel { | ... | @@ -32,8 +32,10 @@ public class MplsLabel { |
32 | 32 | ||
33 | public static MplsLabel mplsLabel(int value) { | 33 | public static MplsLabel mplsLabel(int value) { |
34 | 34 | ||
35 | - if (value > MAX_MPLS) { | 35 | + if (value < 0 || value > MAX_MPLS) { |
36 | - throw new IllegalArgumentException("value exceeds allowed maximum MPLS label value (0xFFFFF)"); | 36 | + String errorMsg = "MPLS label value " + value + |
37 | + " is not in the interval [0, 0xFFFFF]"; | ||
38 | + throw new IllegalArgumentException(errorMsg); | ||
37 | } | 39 | } |
38 | return new MplsLabel(value); | 40 | return new MplsLabel(value); |
39 | } | 41 | } | ... | ... |
-
Please register or login to post a comment