| Summary: | NPE in compiler for fact class w/o getters/setters | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | nwallace <nwallace> |
| Component: | unspecified | Assignee: | Edson Tirelli <ed.tirelli> |
| Status: | CLOSED NEXTRELEASE | QA Contact: | |
| Severity: | unspecified | Docs Contact: | |
| Priority: | high | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Target Release: | 5.0.1 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://jira.jboss.org/jira/browse/BRMS-165 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: |
any
|
|
| Last Closed: | 2009-09-01 12:22:37 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Link: Added: This issue is related to JBRULES-2021 Fix in place. For documenting this in the Release Notes, can you please confirm the following and fill in the missing information. Dot point explanations are fine: The CAUSE (what was actually broken) * CONSEQUENCES of the bug (how it impacts users.) * A null-pointer exception would occur if a fact class lacked "getters" and "setters." The FIX (what was changed to eliminate this bug) and * RESULTS of the fix (what now happens for users.) * The software now, correctly, displays a compiler error message instead. We are still awaiting the outstanding information for the Release Notes on this one. Please provide it as soon as possible. Thanks. The CAUSE (what was actually broken) * by design, Drools only access properties through the getter methods. A null check was missing though in drools compiler. CONSEQUENCES of the bug (how it impacts users.) * A null-pointer exception would occur if a fact class lacked "getters" and "setters." The FIX (what was changed to eliminate this bug) and * Added a null check for non-existing getter methods. RESULTS of the fix (what now happens for users.) * The software now, correctly, displays a compiler error message instead. Hi Edson, To clarify, what term we would we use refer to the object that the null check is applied to? Ie, The compiler now checks that the ???? is not null. The compiler now checks that the method accessor (getter) exists. added to the BRMS 5.0 CP01 release notes as resolved: JBRULES-2021 A rule that referenced properties of a fact that did not have "getter" or "setter" methods for those properties would cause the compiler to throw a null-pointer exception. This occurred because the Rules compiler was not checking if the methods existed before calling them. The compiler now performs this check and displays an appropriate compiler error message if the methods are not found. |
Date of First Response: 2009-09-10 01:02:44 securitylevel_name: Public A class with missing getters and setters, e.g.: public class Command { protected String ident; protected Code code; protected boolean refused; protected String reason; public Command( String id, Code c ){ ident = id; code = c; } } used in a rule pattern such as, e.g.: rule cleanupRefused when $c : Command( $i : ident, refused == true, $r : reason ) then # whatever end causes a NPE in Declaration:239 due to Declaration.readAccessor == null This should produce a compiler error message. NOTICE: Javadoc on constructors of class Declaration is incorrect!