Announcement

Collapse
No announcement yet.

Circular Dependency In The Configuration Class

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Circular Dependency In The Configuration Class

    Daily Build 1867
    JDK 8u92
    CentOS 7 3.10.0-327.13.1.el7.x86_64

    If things go wrong during the Configuration class's constructor - for example, a faulty resolution of lower-level classes such as XPath-related stuff, which was the case here at our site - it can expose a circular dependency in the Configuration class between its constructor and its own singleton instance.

    The problem manifests if execution ends up e.g. at line 118 in Configuration.java. This causes a static initializer to fire in the Logging class, which in turn makes a series of static calls in the Configuration class that eventually want the Configuration instance's singleton to have been fully initialized and assigned. Because the singleton initialization is what's in progress when the logging call is made the singleton instance is still null, and this eventually causes a NullPointerException.

    Here is a partial stack trace of such a failure from daily build 1867:

    at gov.nasa.worldwind.Configuration.<init>( Configuration.java:118)
    at gov.nasa.worldwind.Configuration.<clinit >(Configuration.java:76)
    at gov.nasa.worldwind.awt.WorldWindowGLCanv as.<init>(WorldWindowGLCanvas.java:64)
    ...other stuff...
    Caused by: java.lang.NullPointerException
    at gov.nasa.worldwind.Configuration.getStri ngValue(Configuration.java:258)
    at gov.nasa.worldwind.Configuration.getInte gerValue(Configuration.java:287)
    at gov.nasa.worldwind.Configuration.getInte gerValue(Configuration.java:273)
    at gov.nasa.worldwind.util.Logging.<clinit> (Logging.java:29)
Working...
X