Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326239 - Throw an exception when creating a RuleApplication with "null" as the rule
Summary: Throw an exception when creating a RuleApplication with "null" as the rule
Status: RESOLVED FIXED
Alias: None
Product: EMFT.Henshin
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Enrico Biermann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-25 14:23 EDT by Felix Rieger CLA
Modified: 2010-10-04 04:46 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Rieger CLA 2010-09-25 14:23:06 EDT
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
Comment 1 Enrico Biermann CLA 2010-10-04 04:46:41 EDT
Fixed.

RuleApplication and UnitApplication should throw an NPE if any required parameter is null.