Uploaded image for project: 'Spatial Information Systems'
  1. Spatial Information Systems
  2. SIS-441

UnconvertibleObjectException when reading code list value from PostgreSQL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8
    • 1.0
    • Metadata
    • None

    Description

      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:

      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(Dispatcher.java:161)
           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(MetadataSource.java:990)
           at org.apache.sis.metadata.sql.Dispatcher.fetchValue(Dispatcher.java:227)
           at org.apache.sis.metadata.sql.Dispatcher.invoke(Dispatcher.java:159)
       Caused by: org.apache.sis.util.UnconvertibleObjectException: Can not convert from type ‘PGobject’ to type ‘Role’.
           at org.apache.sis.internal.converter.ConverterRegistry.find(ConverterRegistry.java:528)
           (…snip…)
      

      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.

      Attachments

        Activity

          People

            desruisseaux Martin Desruisseaux
            desruisseaux Martin Desruisseaux
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: