Re: NullPointerException in ShadowScalarType.java

  • To: Jim Koutsovasilis <jimk@xxxxxxxxxx>
  • Subject: Re: NullPointerException in ShadowScalarType.java
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Tue, 16 Sep 2003 05:31:54 -0500 (CDT)
Hi Jim,

This is a real mystery. Line 92 of ShadowScalarType.java is:

  ValueIndices[map.getValueIndex()]++;

The previous line is:

  DisplayIndices[map.getDisplayScalarIndex()]++;

so map cannot be null. It has to be ValueIndices, but that
array is constructed in the ShadowType constructor (super
of ShadowScalarType). Furthermore, ValueIndices is never set
to null in either ShadowType or ShadowScalarType. If your
application calls addRreference() before any ScalarMaps are
added, then the ValueIndices array might be constructed with
length = 0. But in that case there would be no ScalarMaps
and line 92 of ShadowScalarType.java should never get
executed.

Please let me know if you get more evidence.

Cheers,
Bill

On Tue, 16 Sep 2003, Jim Koutsovasilis wrote:

> Hello,
>
> I recently came across the following exception:
>
> java.lang.NullPointerException
>   at visad.ShadowScalarType.<init>(ShadowScalarType.java:92)
>   at visad.ShadowRealType.<init>(ShadowRealType.java:41)
>   at visad.java3d.ShadowRealTypeJ3D.<init>(ShadowRealTypeJ3D.java:48)
>   at visad.java3d.RendererJ3D.makeShadowRealType(RendererJ3D.java:130)
>   at visad.RealType.buildShadowType(RealType.java:1096)
>   at 
> visad.java3d.ShadowRealTupleTypeJ3D.<init>(ShadowRealTupleTypeJ3D.java:48)
>   at visad.java3d.RendererJ3D.makeShadowRealTupleType(RendererJ3D.java:124)
>   at visad.RealTupleType.buildShadowType(RealTupleType.java:501)
>   at visad.DataDisplayLink.prepareData(DataDisplayLink.java:258)
>   at visad.DataRenderer.prepareAction(DataRenderer.java:314)
>   at visad.DisplayRenderer.prepareAction(DisplayRenderer.java:745)
>   at visad.DisplayImpl.doAction(DisplayImpl.java:1512)
>   at visad.ActionImpl.run(ActionImpl.java:353)
>   at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95
>
> with line 92 of ShadowScalarType.java being:
> >        ValueIndices[map.getValueIndex()]++;
>
>
> I'm unable to replicate the problem, but am wondering
> if this is a timing issue whereby the "ValueIndices"
> array is not ready yet.
>
> Any ideas?
>
> Thanks,
> Jim.
> ---
> Jim Koutsovasilis
> Bureau of Meteorology, Australia
> jimk@xxxxxxxxxx
>
>