openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OPENJPA-2284) NPE occurs when <cascade-persist/> is added to a <persistence-unit-defaults> in an orm.
Date Wed, 10 Apr 2013 15:04:16 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee resolved OPENJPA-2284.
---------------------------------

    Resolution: Fixed
    
> NPE occurs when <cascade-persist/> is added to a <persistence-unit-defaults>
in an orm.
> ---------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2284
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2284
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.0.3, 2.3.0, 2.2.1
>            Reporter: Heath Thomann
>            Assignee: Heath Thomann
>            Priority: Minor
>             Fix For: 2.0.3, 2.1.2, 2.3.0, 2.2.2, 2.2.1.1
>
>         Attachments: OPENJPA-2284-mvn-test.zip
>
>
> Take this entity:
> public class Simple {
>   private int id;
>   private String name;
> Take this orm.xml entry:
>   <persistence-unit-metadata>
>     <persistence-unit-defaults>
>        <schema>MySchema</schema>
>        <delimited-identifiers/>
>           <!-- The cascade-persist entry causes an issue:      -->
>         <cascade-persist/>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
>   <entity class="hat.entities.Simple" access="FIELD">
>     <attributes>
>       <id name="id" />
>       <basic name="name" />
>     </attributes>
>   </entity>
> With this, the following exception will occur:
> Caused by: org.xml.sax.SAXException: file:/E:/jpa/openJPAcode/PMR93141/target/test-classes/META-INF/orm.xml
[Location: Line: 16, C: 23]: An error was encountered while parsing element "id".  Make sure
the metadata file is correctly formatted. [java.lang.NullPointerException]
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.getException(XMLMetaDataParser.java:739)
> 	at org.apache.openjpa.lib.meta.CFMetaDataParser.endElement(CFMetaDataParser.java:147)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.endElement(XMLMetaDataParser.java:499)
> 	at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:579)
> 	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:218)
> 	at org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XMLNamespaceBinder.java:873)
> 	at org.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamespaceBinder.java:590)
> 	at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:777)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:748)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1453)
> 	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:333)
> 	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:524)
> 	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
> 	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
> 	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
> 	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
> 	at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:421)
> 	... 60 more
> If I comment out the '<cascade-persist/>' entry, all works fine.  Note that in
the above XML I've added the </schema> and <delimited-identifiers/> entries as
well.  Neither of these have an effect on the outcome (they could simply be removed).  I was
thinking that if the issue occurred for the cascade stanza that it might also occur for the
<delimited-identifiers/> entry since the two are similar in their XML definition (XSD).
 However, this issue seems isolated to just the cascade stanza.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message