Defect #1800
closedDefault contract code is hardcoded in AbstractContractSetEavTreesProcessor
100%
Description
In current state when you change the code of the "default" EAV definition of the contract form "default" to anything else, you will get NullPointerException when createing a new identity.
2019-08-15 19:23:15.649 ERROR 21977 --- [io-8080-exec-15] e.b.i.c.a.e.AbstractEntityEventProcessor : [core:EVENT_EXECUTE_PROCESSOR_FAILED:aa7a955b-63e8-4252-9b1d-7f20611a73c2] Event [null] failed in processor [identity-save-processor]. ({eventId=null, processor=identity-save-processor}) java.lang.NullPointerException: null at eu.bcvsolutions.idm.extras.event.processor.contract.AbstractContractSetEavTreesProcessor.actualProcess(AbstractContractSetEavTreesProcessor.java:75) at eu.bcvsolutions.idm.extras.event.processor.contract.IdentityContractSetEavTreesProcessor.process(IdentityContractSetEavTreesProcessor.java:38) at eu.bcvsolutions.idm.core.api.event.AbstractEntityEventProcessor.onApplicationEvent(AbstractEntityEventProcessor.java:238)
The code of the definition is hardcoded as a constant in public interface IdmFormDefinitionService
as String DEFAULT_DEFINITION_CODE = "default";
and used in class AbstractContractSetEavTreesProcessor
in method public void actualProcess(IdmIdentityContractDto contract)
This seems like an inappropriate usage of the constant, as the comment says "Default definition name for type (if no name is given)". You should search for the main definition instead of using the default name for look up.
Updated by Marek Klement over 5 years ago
- Added form definition to configuration. If this config property is not set, then it tries to get default one.
- also, a custom exception is thrown if the code is wrong, null
Updated by Marek Klement over 5 years ago
Adjusted documentation for properties setting. https://wiki.czechidm.com/tutorial/adm/automatic-roles-structure-and-attribute
Updated by Ondřej Kopr over 5 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
I made code review. It works fine. You use defensive behavior with getting the form definition code nice! Please just add some information about commit into this ticket.
Updated by Marek Klement over 5 years ago
Merged to develop.
This was changed in commit: 437f870b43edf64e658e30665bad8e9b1ef6bcd6