Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Array.factory(Object) cannot handle String[] #600

Open
cwardgar opened this issue Jul 27, 2016 · 1 comment
Open

Array.factory(Object) cannot handle String[] #600

cwardgar opened this issue Jul 27, 2016 · 1 comment

Comments

@cwardgar
Copy link
Contributor

cwardgar commented Jul 27, 2016

From the mailing list. Executing:

String tsar[] = new String[]{"one", "two", "three"};
Array.factory(tsar);

results in:

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 Foo.main(Foo.java:10)

I think we can add some special-case handling for String[] in Array.reflectArrayCopyIn() to fix this.

@JohnLCaron
Copy link
Collaborator

Extensively refactored in 5.0 esp for unsigned types, now:

static public Array makeFromJavaArray(Object javaArray);

but not sure if it works there.

But this should work:

Array.factory(DataType.STRING , shape, stringArray);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants