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

Sorting annotation to avoid executing booleanString before trim #544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SijieMei
Copy link

@SijieMei SijieMei commented Oct 8, 2024

Issue:

When I run the test com.univocity.parsers.common.processor.MultiBeanListProcessorTest.testAnnotatedBeanProcessor, I met the error:
2aa66d0d92cdae3b8bd0b5b8c4fe01f

Reason:

Class TestBean has two attributes "pending" and "other". The attribute used both trim and booleanString. Since getDeclaredAnnotations doesn't ensure order, it may happen BooleanString is executed first and then trim is executed. This will cause errors that call trim on Boolean type.

Changes:

In the AnnotationHelp, add logic to sort BooleanString at the end of "found" array.

In the test com.univocity.parsers.common.processor.MultiBeanListProcessorTest.testAnnotatedBeanProcessor,  pending used both trim and booleanString. Since getDeclaredAnnotations doesn't ensure order, it may happen booleanString is executed first and then trim. This will cause error that calling trim on boolean type.

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

Successfully merging this pull request may close these issues.

1 participant