[
https://issues.jboss.org/browse/DROOLS-546?page=com.atlassian.jira.plugin...
]
Davide Sottara updated DROOLS-546:
----------------------------------
    Description: 
*WARNING : the committed fix does not implement the behavior intended by the title or
description : the code now simply ignore without any error the unknown field*
[EDIT: I have updated the title to reflect the original problem, not the proposed
solution(s). 
After the discussion below, we decided to prevent the NPE but not to throw a different
exception. The KieBase.getFactType( String pkg, String name ) will return 
null in case the fact type is not defined. The client can do a null check to determined
whether the type is valid or not. --Davide]
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
  was:
*WARNING : the committed fix does not implement the behavior intended by the title or
description : the code now simply ignore without any error the unknown field*
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
 FactType.get/set throws an 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, 6.2.0.Beta1
 *WARNING : the committed fix does not implement the behavior intended by the title or
description : the code now simply ignore without any error the unknown field*
 [EDIT: I have updated the title to reflect the original problem, not the proposed
solution(s). 
 After the discussion below, we decided to prevent the NPE but not to throw a different
exception. The KieBase.getFactType( String pkg, String name ) will return 
 null in case the fact type is not defined. The client can do a null check to determined
whether the type is valid or not. --Davide]
 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.3.1#6329)