OpenJPA
  1. OpenJPA
  2. OPENJPA-326

NPE if a discriminator column is specified without discriminator type in orm.xml

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.7
    • Fix Version/s: 1.0.1, 1.1.0
    • Component/s: None
    • Labels:
      None

      Description

      XMLPersistenceMappingParser should initialize _discType to STRING to avoid a potential NPE. I'll provide an example shortly.

        Activity

        Hide
        Michael Dick added a comment -

        Example exception:

        <openjpa-1.0.0-SNAPSHOT-r420667:568164 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: org.xml.sax.SAXException: file:/home/mikedd/workspaces/jpa/tests/target/test-classes/META-INF/orm.xml [Location: Line: 29, C: 14]: An error was encountered while parsing element "entity". Make sure the metadata file is correctly formatted. [java.lang.NullPointerException]
        at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:250)
        at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:199)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:433)

        Patch attached so that I don't lose track of the changes. The fix is committed in trunk and we'll migrate to 1.0.1 when we're done with 1.0.0.

        Show
        Michael Dick added a comment - Example exception: <openjpa-1.0.0-SNAPSHOT-r420667:568164 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: org.xml.sax.SAXException: file:/home/mikedd/workspaces/jpa/tests/target/test-classes/META-INF/orm.xml [Location: Line: 29, C: 14] : An error was encountered while parsing element "entity". Make sure the metadata file is correctly formatted. [java.lang.NullPointerException] at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:250) at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:199) at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:433) Patch attached so that I don't lose track of the changes. The fix is committed in trunk and we'll migrate to 1.0.1 when we're done with 1.0.0.

          People

          • Assignee:
            Michael Dick
            Reporter:
            Michael Dick
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development