From: | Bhavesh Mistry <bhavesh(dot)mistry13(at)gmail(dot)com> |
---|---|
To: | Discuss List Postgres <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Issue with PSQL JDBC Driver Null Pointer |
Date: | 2021-07-28 21:31:38 |
Message-ID: | CAD1effgdZtiG49ZAry1c6qRegNgZJYydmuL8+JE6mpYBdZrpmg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I am getting an NPE exception in the JDBC driver 42.2.23.
When the alias is null, NPE results. Is it possible to handle null value ?
I have filled a bug against RCA
https://github.com/vladmihalcea/hibernate-types/issues/335. But, I thought
that PSQL Driver can handle it more gracefully.
Caused by: java.lang.NullPointerException: null
at org.postgresql.jdbc.TypeInfoCache.getTypeForAlias(TypeInfoCache.java:675)
at org.postgresql.jdbc.TypeInfoCache.getPGArrayType(TypeInfoCache.java:519)
at org.postgresql.jdbc.PgConnection.createArrayOf(PgConnection.java:1375)
at org.postgresql.jdbc.PgConnection.createArrayOf(PgConnection.java:1399)
at org.apache.commons.dbcp2.DelegatingConnection.createArrayOf(DelegatingConnection.java:827)
at org.apache.commons.dbcp2.DelegatingConnection.createArrayOf(DelegatingConnection.java:827)
at org.apache.commons.dbcp2.DelegatingConnection.createArrayOf(DelegatingConnection.java:827)
at com.vladmihalcea.hibernate.type.array.internal.ArraySqlTypeDescriptor$1.doBind(ArraySqlTypeDescriptor.java:36)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:73)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:276)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:271)
at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:39)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2995)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3292)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3828)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:107)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
at org.hibernate.engine.spi.ActionQueue.lambda$executeActions$1(ActionQueue.java:478)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:475)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:348)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:40)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1362)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:453)
at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3212)
at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2380)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:447)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$300(JdbcResourceLocalTransactionCoordinatorImpl.java:40)
at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:281)
at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:101)
... 123 common frames omitted
public String getTypeForAlias(String alias) {
String type = typeAliases.get(alias);
if (type != null) {
return type;
}
if (alias.indexOf('"') == -1) { *// THIS LINE THROWS NPE SINCE
alias is null ** *
type = typeAliases.get(alias.toLowerCase());
if (type != null) {
return type;
}
}
return alias;
}
--
Thanks,
Bhavesh
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2021-07-29 06:38:26 | Re: How postgres is refreshing TLS certificates |
Previous Message | Steve Litt | 2021-07-28 19:27:36 | Re: PostgreSQL reference coffee mug |