Skip to content

Fixed null-Globe bug in FlyToOrbitViewAnimator.#56

Merged
wcmatthysen merged 2 commits intoWorldWindEarth:developfrom
wcmatthysen:fly-to-orbit-null-globe-fix
Jun 29, 2019
Merged

Fixed null-Globe bug in FlyToOrbitViewAnimator.#56
wcmatthysen merged 2 commits intoWorldWindEarth:developfrom
wcmatthysen:fly-to-orbit-null-globe-fix

Conversation

@wcmatthysen
Copy link
Copy Markdown
Member

Description of the Change

The Globe that is provided to the OnSurfacePositionAnimator's constructor could, in some situations, be null. This is especially true during startup when the View.goTo() method is called and the View.getGlobe() method returns null. As noted in the Javadocs, View.getGlobe() returns null if called before the first invocation of View.apply(). So then, instead of getting the Globe, and passing it on, the OrbitView itself is now passed along as constructor argument where the OnSurfacePositionAnimator can get the Globe, check if it is null or not and based on this determine whether it wants to try and get the endElevation at that point in time. If this fix is not done, the OnSurfacePositionAnimator could get stuck with a null Globe and will cause the entire application to break with NullPointerExceptions being printed out continually.

Why Should This Be In Core?

If this bugfix is not in, you can potentially end up with a broken Globe at startup.

Benefits

Stability improvements.

Potential Drawbacks

None

Applicable Issues

Issue #55

The Globe that is provided to the OnSurfacePositionAnimator's
constructor could, in some situations, be null. This is especially true
during startup when the `View.goTo()` method is called and the
`View.getGlobe()` method returns null. As noted in the Javadocs,
`View.getGlobe()` returns null if called before the first invocation of
`View.apply()`. So then, instead of getting the Globe, and passing it
on, the OrbitView itself is now passed along as constructor argument
where the OnSurfacePositionAnimator can get the Globe, check if it is
null or not and based on this determine whether it wants to try and get
the endElevation at that point in time. If this fix is not done, the
OnSurfacePositionAnimator could get stuck with a null Globe and will
cause the entire application to break with NullPointerExceptions being
printed out continually.
@wcmatthysen wcmatthysen added the bug Something isn't working label Jun 25, 2019
@wcmatthysen
Copy link
Copy Markdown
Member Author

Ok, looks like the build is breaking because Travis can't properly install Oracle JDK 11.

@gbburkhardt
Copy link
Copy Markdown
Member

My first thought is that GDALUtils should also be changed to avoid a long search through /usr/lib in the first place. No one will want to wait that long on a regular basis. So probably the search path for gdalplugins/gdal-data for Linux should change "/usr/lib" to "/usr/lib/gdalplugins".

Modified `FlyToOrbitViewAnimator` by removing the null `Globe` check
from the `nextPosition()` method of the `OnSurfacePositionAnimator`
inner class. This null-check is not needed as the `Globe` should be
non-null when this method is called the first time.
@gbburkhardt
Copy link
Copy Markdown
Member

Very nice. Good to go.

@wcmatthysen wcmatthysen merged commit 4df1ca2 into WorldWindEarth:develop Jun 29, 2019
@wcmatthysen wcmatthysen deleted the fly-to-orbit-null-globe-fix branch June 29, 2019 19:50
@wcmatthysen wcmatthysen added this to the WWJ-CE 2.2.0 milestone Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants