Skip to content
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

Error while parsing nullable TIMESTAMP WITH TIME ZONE column as java.util.Calendar #1071

Closed
soylent-grin opened this issue Jan 16, 2018 · 0 comments

Comments

@soylent-grin
Copy link

@soylent-grin soylent-grin commented Jan 16, 2018

Looks like problem is located here: if getTimestamp(columnIndex) returns null, timestampValue.getTime() throws NullPointerException.
Seems to be a bug for me; quick fix by adding null check before getTime():

Timestamp timestampValue = getTimestamp(columnIndex);
if (wasNull()) {
  return null;
}
Calendar calendar = Calendar.getInstance(getDefaultCalendar().getTimeZone());
calendar.setTimeInMillis(timestampValue.getTime());
return type.cast(calendar);

I could submit a PR if you confirm this behavior as unexpected and fix is enough.

vlsi added a commit to vlsi/pgjdbc that referenced this issue Jan 16, 2018
…endar.class) on null timestamps

fixes pgjdbc#1071
@vlsi vlsi closed this in #1072 Jan 16, 2018
vlsi added a commit that referenced this issue Jan 16, 2018
…endar.class) on null timestamps

fixes #1071
rhavermans added a commit to bolcom/pgjdbc that referenced this issue Jul 13, 2018
rhavermans added a commit to bolcom/pgjdbc that referenced this issue Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.