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

Locale config loaded sooner #1980

Merged
merged 1 commit into from
Nov 15, 2023
Merged

Locale config loaded sooner #1980

merged 1 commit into from
Nov 15, 2023

Conversation

patrickdalla
Copy link
Collaborator

Closes #1979
Load config soon after object creation to avoid dependent code execution before it.

Copy link
Member

@lfcnassif lfcnassif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I wasn't able to reproduce the described issue from command line, I'll apply the change since it's simple and doesn't look to cause side effects, thanks @patrickdalla.

@lfcnassif lfcnassif merged commit e1dd232 into master Nov 15, 2023
2 checks passed
@lfcnassif lfcnassif deleted the LocaleLoad branch November 15, 2023 18:34
@patrickdalla
Copy link
Collaborator Author

patrickdalla commented Nov 15, 2023

PythonParser has some static fields loaded using iped.parsers.util.Messages.
PythonTask access PythonParser, also at class loading.
Messages get its location info from System properties only once, the first execution saving it internally. This locale System property is set on LocaleConfig object load method.
So, before the comit, as the LocaleConfig wasn't loaded, taskinstaller loaded PythonTask that loaded PythonParser that called Messages initialization before locale info in LocaleConfig was set in SystemProperties.

@lfcnassif
Copy link
Member

Thank you @patrickdalla. But if you can answer the questions I made on #1979 I would appreciate, so we can tag the issue properly.

@patrickdalla
Copy link
Collaborator Author

patrickdalla commented Nov 15, 2023

PythonParser has some static fields loaded using iped.parsers.util.Messages.
PythonTask access PythonParser, also at class loading.
Messages get its location info from System properties only once, the first execution saving it internally. This locale System property is set no LocaleConfig load.
So, before the comit, as the LocaleConfig wasn't loaded, taskinstaller loaded PythonTask that loaded PythonParser that called Messages initialization before locale info in LocaleConfig was set in SystemProperties.

I detected that it was affecting parser Messages, i. e., only locale info used by classes on iped-parsers.

@patrickdalla
Copy link
Collaborator Author

Thank you @patrickdalla. But if you can answer the questions I made on #1979 I would appreciate, so we can tag the issue properly.

Right. I will check it tomorow. Maybe class loading order is different when running inside eclipse IDE.

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.

Load localization configuration early
2 participants