NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-java] Array.factory and Strings

  • To: Bob Simons - NOAA Federal <bob.simons@xxxxxxxx>
  • Subject: Re: [netcdf-java] Array.factory and Strings
  • From: Christian Ward-Garrison <cwardgar@xxxxxxxx>
  • Date: Wed, 27 Jul 2016 12:48:54 -0600
Hi Bob,

Thanks for the bug report. I've added it as a GitHub issue [1].

Cheers,
Christian

[1] https://github.com/Unidata/thredds/issues/600

On Thu, Jul 14, 2016 at 12:51 PM, Bob Simons - NOAA Federal <
bob.simons@xxxxxxxx> wrote:

> Using netcdfAll-4.6.6.jar :
>
> I expected that I could use Array.factory(java.lang.Object javaArray) like
> this
>   String tsar[] = new String[]{author};
>   Array oneAuthorArray = Array.factory(tsar);
> to create an ArrayString.D1
> but that fails with
> Exception in thread "main" java.lang.NullPointerException
>         at ucar.ma2.Array.reflectArrayCopyIn(Array.java:259)
>         at ucar.ma2.Array.reflectArrayCopyIn(Array.java:263)
>         at ucar.ma2.Array.factory(Array.java:252)
>         at [my code on the second line above]
> Shouldn't that work?
> (The JavaDoc for that Array.factory method does say "LOOK: not sure this
> works for reference types.")
> Is that a bug?
> Can you please make Array.factory work with a String[]?
>
> I can use
>   ArrayString.D1 oneAuthorArray = new ArrayString.D1(1);
>   oneAuthorArray.set(0, author);
> So I have a solution for now.
>
> Thank you for looking into this.
> Best wishes.
>
> --
> Sincerely,
>
> Bob Simons
> IT Specialist
> Environmental Research Division
> NOAA Southwest Fisheries Science Center
> 99 Pacific St., Suite 255A      (New!)
> Monterey, CA 93940               (New!)
> Phone: (831)333-9878            (New!)
> Fax:   (831)648-8440
> Email: bob.simons@xxxxxxxx
>
> The contents of this message are mine personally and
> do not necessarily reflect any position of the
> Government or the National Oceanic and Atmospheric Administration.
> <>< <>< <>< <>< <>< <>< <>< <>< <><
>
>
> _______________________________________________
> NOTE: All exchanges posted to Unidata maintained email lists are
> recorded in the Unidata inquiry tracking system and made publicly
> available through the web.  Users who post to any of the lists we
> maintain are reminded to remove any personal information that they
> do not want to be made public.
>
>
> netcdf-java mailing list
> netcdf-java@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: