X-Git-Url: http://plrg.eecs.uci.edu/git/?p=iot2.git;a=blobdiff_plain;f=iotjava%2Fiotpolicy%2Ftree%2FCapabilityDecl.java;h=a12cf13e54d70eccc1acd284487ec265ff5c0c70;hp=7b2f923a823f162403d4cf34e5e14f1795541c4b;hb=4951f81458fa28e4db26f568df9f30e7afdecf0c;hpb=4b928ccacd87cf190fb7a1b7ff5649a96487d09b diff --git a/iotjava/iotpolicy/tree/CapabilityDecl.java b/iotjava/iotpolicy/tree/CapabilityDecl.java index 7b2f923..a12cf13 100644 --- a/iotjava/iotpolicy/tree/CapabilityDecl.java +++ b/iotjava/iotpolicy/tree/CapabilityDecl.java @@ -110,6 +110,13 @@ public class CapabilityDecl extends Declaration { public List getMethods(String cap) { int index = listCapabs.indexOf(cap); + // If index=-1, it means that it's not found. + // There is perhaps a discrepancy in the policy file + // between the list of capabilities and requires + // sections + if (index == -1) + throw new Error("CapabilityDecl: Capability " + cap + + " does not exist in this interface! Please check your (requires) policy file..."); return listMethods.get(index); } }