8000 Fix NullPointerException in array conversion by ljodal · Pull Request #21 · alaisi/postgres-async-driver · GitHub
[go: up one dir, main page]

Skip to content

Fix NullPointerException in array conversion #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public static <T> T toArray(Class<T> type, Oid oid, byte[] value, BiFunction<Oid
throw new IllegalArgumentException("Primitive arrays are not supported due to possible NULL values");
}

if (value == null) {
return null;
}

char[] text = new String(value, UTF_8).toCharArray();
List<List<Object>> holder = new ArrayList<>(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ public void selectTimestamp() {
getRow().getArray("TIMESTAMPA", Timestamp[].class));
}

@Test
public void selectNull() {
dbr.query("INSERT INTO CA_TEST (TEXTA) VALUES (NULL);");

assertArrayEquals(null, getRow().getArray("TEXTA", String[].class));
}

@Test
public void roundtripInt() {
Integer[][] a = new Integer[][]{
Expand Down
0