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.

[netcdf-java] Array.factory and Strings

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.
<>< <>< <>< <>< <>< <>< <>< <>< <><
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: