sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Desruisseaux (JIRA)" <>
Subject [jira] [Resolved] (SIS-441) UnconvertibleObjectException when reading code list value from PostgreSQL
Date Mon, 26 Nov 2018 11:35:00 GMT


Martin Desruisseaux resolved SIS-441.
    Resolution: Fixed

> UnconvertibleObjectException when reading code list value from PostgreSQL
> -------------------------------------------------------------------------
>                 Key: SIS-441
>                 URL:
>             Project: Spatial Information Systems
>          Issue Type: Task
>          Components: Metadata
>    Affects Versions: 0.8
>            Reporter: Martin Desruisseaux
>            Assignee: Martin Desruisseaux
>            Priority: Major
>             Fix For: 1.0
> When metadata are read from database using {{org.apache.sis.sql.MetadataSource}}, an
attempt to get the {{CodeList}} value of a metadata entry produce the following error:
> {noformat}
> org.apache.sis.util.collection.BackingStoreException: Database error while creating a
‘Role’ object for the “IOGP” identifier.
>      at org.apache.sis.metadata.sql.Dispatcher.invoke(
>      at org.apache.sis.metadata.sql.$Proxy233.getRole(Unknown Source)
>      (…snip…)
>  Caused by: org.apache.sis.metadata.sql.MetadataStoreException: Expected an instance
of ‘Role’ for the “role” property, but got an instance of ‘PGobject’.
>      at org.apache.sis.metadata.sql.MetadataSource.readColumn(
>      at org.apache.sis.metadata.sql.Dispatcher.fetchValue(
>      at org.apache.sis.metadata.sql.Dispatcher.invoke(
>  Caused by: org.apache.sis.util.UnconvertibleObjectException: Can not convert from type
‘PGobject’ to type ‘Role’.
>      at org.apache.sis.internal.converter.ConverterRegistry.find(
>      (…snip…)
> {noformat}
> This happen only with PostgreSQL database, because we store metadata as `VARCHAR` on
Derby. The workaround is to read {{CodeList}} value using {{ResultSet.getString(int)}} instead
than {{ResultSet.getObject(…)}}, so the {{PGobject}} is converted to a {{String}} that we
can later parse as a {{CodeList}}.

This message was sent by Atlassian JIRA

View raw message