[ 
https://issues.apache.org/jira/browse/OPENJPA-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12569324#action_12569324
 ] 

Kevin Sutter commented on OPENJPA-513:
--------------------------------------

After a bit more digging, here's the scoop on the xml validation...

By default, our OpenJPA code wants to validate the persistence.xml file when we 
read it in.  In the PersistenceProductDerivation$ConfigurationParser, we set 
the validation to true:

        public ConfigurationParser(Map map) {
            _map = map;
            setCaching(false);
            setValidating(true);
            setParseText(true);
        }

But, later in the static initializer for the XMLMetaDataParser, there is a 
check for the Sun Xerxes parser.  This sets _schemaBug to true:

    static {
        try {
            // check for Xerces version 2.0.2 to see if we need to disable
            // schema validation, which works around the bug reported at:
            // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708859
            _schemaBug = "Xerces-J 2.0.2".equals(Class.forName
                ("org.apache.xerces.impl.Version").getField("fVersion").
                get(null));
        } catch (Throwable t) {
            // Xerces might not be available
            _schemaBug = false;
        }
    }

So, then when we determine what type of parser (validating or not), we end up 
running without validation for the Sun JDK ALL THE TIME:

        if (schemaSource != null && _schemaBug) {
            if (_log != null && _log.isTraceEnabled())
                _log.trace(_loc.get("parser-schema-bug"));
            schemaSource = null;
        }
        boolean validating = _validating && (getDocType() != null 
            || schemaSource != null);

So, as soon as Sun's Xerxes parser gets updated with this fix, then this same 
testcase will fail with the Sun JDK.  Which brings me back to my original point 
of this not being a valid test for standard JPA.

It looks like we (OpenJPA) wanted to run with a validating parser.  But, due to 
the bug in the Sun Xerxes parser, we've been running without validation for the 
Sun JDK and with validation for all other JDK's (including the IBM JDK).  Since 
it looks like we want a validating parser, then I think this 
TestPersistenceUnitWithoutXSD should be removed.  And, maybe we should look at 
providing a switch to run with or without validation.

Comments?
Kevin

> More issues with the IBM JDK
> ----------------------------
>
>                 Key: OPENJPA-513
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-513
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: build / infrastructure
>    Affects Versions: 1.0.2, 1.1.0
>            Reporter: Kevin Sutter
>            Assignee: Kevin Sutter
>             Fix For: 1.1.0
>
>
> Now that I have a resolution (JDK patch) for OPENJPA-429, when I run a 1.1.0 
> build, I am getting some errors from the test phase of 
> openjpa-persistence-jdbc.  The following tests are failing according to the 
> surefire report:
> Results :
> Tests in error:
>   
> testEntityListeners(org.apache.openjpa.persistence.callbacks.TestEntityListeners)
>   
> testGlobalListeners(org.apache.openjpa.persistence.callbacks.TestEntityListeners)
>   
> testPersistenceUnitWithoutXSD(org.apache.openjpa.persistence.xml.TestPersistenceUnitWithoutXSD)
>   
> testEnhancementOfAllPUsWithinAResource(org.apache.openjpa.enhance.TestEnhancementWithMultiplePUs)
> Tests run: 568, Failures: 0, Errors: 4, Skipped: 0

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to