Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable_types_contributor setting allows arbitrary values except boolean #695

Open
IlyaRyzhov opened this issue Jan 25, 2024 · 1 comment

Comments

@IlyaRyzhov
Copy link

IlyaRyzhov commented Jan 25, 2024

Bug description:
hypersistence.utils.enable_types_contributor setting can hold arbitrary values except boolean. For, instance "abc" string. Moreover, setting hypersistence.utils.enable_types_contributor to true has no effect - type contributor is still disabled

To Reproduce:
Apply settings listed below

hypersistence:
  utils:
    enable_types_contributor: abc

Expected behavior:
I expect to get some exception, indicating that the setting hold invalid value.

Additional context:
I guess the problem is this code snippet io.hypersistence.utils.hibernate.type.HibernateTypesContributor (or more specifically in Boolean.getBoolean call):

 Boolean enableTypesContributor = (Boolean) configurationService.getSetting(ENABLE_TYPES_CONTRIBUTOR, value -> {
            if(value instanceof Boolean) {
                return value;
            }
            if(value instanceof String) {
                return Boolean.getBoolean((String) value);
            }
            throw new HibernateException(
                String.format("The value [%s] of the [%s] setting is not supported!", value, ENABLE_TYPES_CONTRIBUTOR)
            );
        });
@vladmihalcea
Copy link
Owner

@IlyaRyzhov Looking forward to your Pull Request that fixes the issues in all the project modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants