Skip to content

LuceneConnector static initialization order isse #166

@AdamByerly

Description

@AdamByerly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions