[
https://issues.jboss.org/browse/DROOLS-546?page=com.atlassian.jira.plugin...
]
Benoit Voisin commented on DROOLS-546:
--------------------------------------
(comment also written on the Pull request, I did not know the best place to put it)
First of all, thanks for the great work on Drools.
Nevertheless, I disagree with you on this updated fix (315566a, ignoring the setter if the
field is unknown). I believe that the NPE was a symptom of an user's bug (typo or
other error) and should NOT be ignored. Ignoring this field naming error will result in
hours lost by users trying to find out why a rule fires or not as expected.
My proposal (throwing a UnknownFieldException) was to improve the symptom to provide a
clear information to the user to help him/her find the typo as fast as possible.
The reason I proposed this fix, was because I recently had to debug the application to
understand a NPE I was having, and discover a typographic error (badly named field). With
my proposed fix, the error message would have been clear enough for me to correct my error
without the need to debug. Without the NPE, I will in a similar case loose much more time
trying to find the typo.
Still, I might have missed something and would be very happy to hear your thoughts on the
subject.
FactType.get/set should throw specific exception (not NPE) for
unknown fields
-----------------------------------------------------------------------------
Key: DROOLS-546
URL:
https://issues.jboss.org/browse/DROOLS-546
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 6.1.0.CR1
Reporter: Benoit Voisin
Assignee: Mario Fusco
Fix For: 6.1.0.Final
factType.get(instance, "unknownField") is currently throwing an NPE. This gives
improper information to the user/developper.
I propose that it throws a new UnknownFactFieldException giving improved information
giving good hints for debugging or enabling specific exception management.
See pull request for test-case and proposed fix
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)