Uploaded image for project: 'Apache MetaModel (Retired)'
  1. Apache MetaModel (Retired)
  2. METAMODEL-1190

ClassCastException when getting value from DB

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.0.0
    • None
    • None

    Description

      We use MetaModel with Postgres/MsSQL in our project and when system processes many data and queries DB tables in parallel then queuries suddenly fails with exception like this
      'java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Boolean'.

      This exception is thrown when org.apache.metamodel.data.Row.getValue(Column) is executed and result is to be saved to variable. The problem occurs time and again.
      It looks like that AbstractRow.getIndex(Column) which is invoked in getValue(Column) returns wrong column index and that's why value of another column is get.

      I think the cause of problem is in org.apache.metamodel.data.CachingDataSetHeader.indexOf(Column) which uses System.identityHashCode(Object) for generating keys. This method can return the same values for different objects.

      Attached is testing class which reproduces problem.

      Attachments

        1. metamodel-bug.zip
          3 kB
          Petr Knápek

        Activity

          People

            Unassigned Unassigned
            pknapek Petr Knápek
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: