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

LuceneConnector static initialization order isse #166

Open
AdamByerly opened this issue Jul 8, 2021 · 0 comments
Open

LuceneConnector static initialization order isse #166

AdamByerly opened this issue Jul 8, 2021 · 0 comments

Comments

@AdamByerly
Copy link

AdamByerly commented Jul 8, 2021

In the LuceneConenctor constructor, there is a try/catch, wherein the catch attempts to use the private log4j Logger (named LOG) to log any IOExceptions thrown. The problem is that in Java static member variables are initialized in the order they are declared in the java file and the LuceneConnector's singleton instance initialization precedes the Logger's initialization. This is a simple fix. Simply swap the order of the LuceneConnector and Logger static member variable declarations/initializations so that the Logger is first (lines 58 and 59). Also, it couldn't hurt to catch (and rethrow if you like) all exceptions in the LuceneConnector constructor, as I was chasing down a nasty NullPointerException (related to a configuration problem of my own fault), and for posterity, that might save them some effort debugging.

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

No branches or pull requests

1 participant