Project

General

Profile

Actions

Defect #1800

closed

Default contract code is hardcoded in AbstractContractSetEavTreesProcessor

Added by Vladimír Kotýnek over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Marek Klement
Target version:
Start date:
08/15/2019
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

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.

Actions #1

Updated by Marek Klement over 4 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

Actions #2

Updated by Marek Klement over 4 years ago

Actions #3

Updated by Ondřej Kopr over 4 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.

Actions #4

Updated by Marek Klement over 4 years ago

Merged to develop.

This was changed in commit: 437f870b43edf64e658e30665bad8e9b1ef6bcd6

Actions #5

Updated by Ondřej Kopr over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF