[ https://issues.apache.org/jira/browse/TAP5-2206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13799229#comment-13799229 ]
Andreas Ernst commented on TAP5-2206: ------------------------------------- # This patch file was generated by NetBeans IDE # It uses platform neutral UTF-8 encoding and \n newlines. --- /tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/PersistenceContentHandler.java +++ /tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/PersistenceContentHandler.java @@ -14,6 +14,7 @@ package org.apache.tapestry5.internal.jpa; +import java.util.Arrays; import org.apache.tapestry5.ioc.internal.util.CollectionFactory; import org.apache.tapestry5.jpa.TapestryPersistenceUnitInfo; import org.xml.sax.Attributes; @@ -28,7 +29,7 @@ public class PersistenceContentHandler implements ContentHandler { - private static final String NAMESPACE_URI = "http://java.sun.com/xml/ns/persistence"; + private static final String NAMESPACE_URI[] = {"http://java.sun.com/xml/ns/persistence", "http://xmlns.jcp.org/xml/ns/persistence"}; private static final String ELEMENT_PERSISTENCE_UNIT = "persistence-unit"; private static final String ELEMENT_PROVIDER = "provider"; private static final String ELEMENT_JTA_DATA_SOURCE = "jta-data-source"; @@ -77,7 +78,7 @@ public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes atts) throws SAXException { - if (NAMESPACE_URI.equals(namespaceURI)) + if ( Arrays.asList(NAMESPACE_URI).contains(namespaceURI)) { if (ELEMENT_PERSISTENCE_UNIT.equals(localName)) { @@ -107,8 +108,7 @@ final String string = characters.toString().trim(); characters = null; - - if (NAMESPACE_URI.equals(namespaceURI)) + if ( Arrays.asList(NAMESPACE_URI).contains(namespaceURI)) { if (ELEMENT_PROVIDER.equals(localName)) { > support parsing of JPA 2.x definitions > -------------------------------------- > > Key: TAP5-2206 > URL: https://issues.apache.org/jira/browse/TAP5-2206 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-jpa > Affects Versions: 5.3.7 > Reporter: Andreas Ernst > Priority: Critical > > <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence > http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> > </persistence> > does not work > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" > version="1.0"> > </persistence> > namespace URI is a constant there and has different value > https://github.com/apache/tapestry-5/blob/master/tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/PersistenceContentHandler.java#L80 -- This message was sent by Atlassian JIRA (v6.1#6144)