Reverting type resolution in C++ to Java types, e.g. byte and char instead of just...
[iot2.git] / iotjava / iotpolicy / tree / CapabilityDecl.java
index 7b2f923a823f162403d4cf34e5e14f1795541c4b..a12cf13e54d70eccc1acd284487ec265ff5c0c70 100644 (file)
@@ -110,6 +110,13 @@ public class CapabilityDecl extends Declaration {
        public List<String> 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);
        }
 }