| Summary: | Throw an exception when creating a RuleApplication with "null" as the rule | ||
|---|---|---|---|
| Product: | [Modeling] EMFT.Henshin | Reporter: | Felix Rieger <riegerf> |
| Component: | Core | Assignee: | Enrico Biermann <enrico> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | henshin.stj |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Fixed. RuleApplication and UnitApplication should throw an NPE if any required parameter is null. |
Throw an exception when creating a RuleApplication with "null" as the rule. This makes debugging easier, as RuleApplications are usually created near Rules in the code, whereas method calls on RuleApplications are more likely to be found in various locations. Debugging will be made easier when a NullPointerException (or any other Exception) is thrown directly when the RuleApplication is created, as it is highly unlikely passing "null" as the Rule is intended by the developer. Furthermore, when calling methods on RuleApplications created with "null" Rules it is not immediately obvious what provoked the exception. Rule testRule = findRuleByName("Nonexistent rule"); // returns null RuleApplication testRuleApplication = new RuleApplication(testRule, engine); // no exception is thrown, but should throw exception testRuleApplication.findAllMatches // throws NullPointerException