Skip to content

Null-Globe bug in FlyToOrbitViewAnimator #55

@wcmatthysen

Description

@wcmatthysen

There is a bug in the FlyToOrbitViewAnimator that causes a NullPointerException during startup. I've seen this issue manifest itself in the gov.nasa.worldwindx.examples.dataimport.ImportImagery example application. However, the issue only pops up when I set the GDAL_DATA and GDAL_PLUGINS manually in the launch script. The script I'm using is:

#!/bin/sh

export GDAL_DATA=/usr/share/gdal/2.2
export GDAL_PLUGINS=/usr/lib/gdalplugins
export LD_LIBRARY_PATH=/usr/lib/jni:/usr/lib/grass74/lib

java -Xmx1024m -Djava.library.path=/usr/lib/jni -classpath ./worldwind.jar:./worldwindx.jar:/usr/share/java/gdal.jar:./jogl-all.jar:./gluegen-rt.jar gov.nasa.worldwindx.examples.dataimport.ImportImagery

This results in the following exception being printed out continuously:

Jun 25, 2019 1:53:19 PM gov.nasa.worldwind.WorldWindowGLAutoDrawable display
SEVERE: Exception while attempting to repaint WorldWindow
java.lang.NullPointerException
        at gov.nasa.worldwind.view.orbit.FlyToOrbitViewAnimator$OnSurfacePositionAnimator.nextPosition(FlyToOrbitViewAnimator.java:124)
        at gov.nasa.worldwind.animation.PositionAnimator.setImpl(PositionAnimator.java:78)
        at gov.nasa.worldwind.animation.BasicAnimator.set(BasicAnimator.java:66)
        at gov.nasa.worldwind.animation.CompoundAnimator.setImpl(CompoundAnimator.java:89)
        at gov.nasa.worldwind.animation.BasicAnimator.set(BasicAnimator.java:66)
        at gov.nasa.worldwind.animation.BasicAnimator.next(BasicAnimator.java:55)
        at gov.nasa.worldwind.animation.AnimationController.stepAnimators(AnimationController.java:78)
        at gov.nasa.worldwind.view.orbit.OrbitViewInputHandler.apply(OrbitViewInputHandler.java:522)
        at gov.nasa.worldwind.view.BasicView.apply(BasicView.java:172)
        at gov.nasa.worldwind.AbstractSceneController.applyView(AbstractSceneController.java:538)
        at gov.nasa.worldwind.BasicSceneController.doNormalRepaint(BasicSceneController.java:40)
        at gov.nasa.worldwind.BasicSceneController.doRepaint(BasicSceneController.java:30)
        at gov.nasa.worldwind.AbstractSceneController.repaint(AbstractSceneController.java:400)
        at gov.nasa.worldwind.WorldWindowGLAutoDrawable.doDisplay(WorldWindowGLAutoDrawable.java:459)
        at gov.nasa.worldwind.WorldWindowGLAutoDrawable.display(WorldWindowGLAutoDrawable.java:332)
        at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
        at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
        at com.jogamp.opengl.awt.GLCanvas$11.run(GLCanvas.java:1424)
        at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
        at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
        at com.jogamp.opengl.awt.GLCanvas$12.run(GLCanvas.java:1438)
        at com.jogamp.opengl.Threading.invoke(Threading.java:223)
        at com.jogamp.opengl.awt.GLCanvas.display(GLCanvas.java:505)
        at com.jogamp.opengl.awt.GLCanvas.paint(GLCanvas.java:559)
        at com.jogamp.opengl.awt.GLCanvas.update(GLCanvas.java:866)
        at sun.awt.RepaintArea.updateComponent(RepaintArea.java:255)
        at sun.awt.X11.XRepaintArea.updateComponent(XRepaintArea.java:51)
        at sun.awt.RepaintArea.paint(RepaintArea.java:232)
        at sun.awt.X11.XComponentPeer.handleEvent(XComponentPeer.java:584)
        at java.awt.Component.dispatchEventImpl(Component.java:4965)
        at java.awt.Component.dispatchEvent(Component.java:4711)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
        at java.awt.EventQueue$4.run(EventQueue.java:733)
        at java.awt.EventQueue$4.run(EventQueue.java:731)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I've dug around in the code a bit and I believe that it is a timing issue that causes this bug. When the environment variables are not set, the GDAL initialisation code attempts to search for the correct values for the GDAL_DATA and GDAL_PLUGINS variables. This search causes enough time to go by so that the View can be initialised resulting in no breakage. Thus, I think I've traced the issue to the FlyToOrbitViewAnimator class itself. The bugfix is in PR #56.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions