tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 55166] schemaLocation references between servlet and jsp XSDs are invalid
Date Wed, 03 Jul 2013 03:29:45 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=55166

--- Comment #5 from Jeremy Boynes <jboynes@apache.org> ---
Created attachment 30526
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30526&action=edit
full output from test run

I was seeing the problem with xjc running against the resources directory. That
may not be a typical manifestation.

However, I put together this testcase for validation

    @Test
    public void testValidation() throws Exception {
        System.out.println("ServletContext = " +
getClass().getResource("/javax/servlet/ServletContext.class"));
        System.out.println("JspFactory = " +
getClass().getResource("/javax/servlet/jsp/JspFactory.class"));
        SchemaFactory schemaFactory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        schemaFactory.setErrorHandler(new ErrorHandler() {
            @Override
            public void warning(SAXParseException exception) throws
SAXException {
                exception.printStackTrace();
            }

            @Override
            public void error(SAXParseException exception) throws SAXException
{
                exception.printStackTrace();
            }

            @Override
            public void fatalError(SAXParseException exception) throws
SAXException {
                exception.printStackTrace();
            }
        });
        URL url =
ServletContext.class.getResource("/javax/servlet/resources/web-app_3_0.xsd");
        System.out.println("url = " + url);
        Schema schema = schemaFactory.newSchema(url);
    }

which fails with 

org.xml.sax.SAXParseException; systemId:
jar:file:/Users/jeremy/apache/apache-tomcat-7.0.41/lib/servlet-api.jar!/javax/servlet/resources/web-common_3_0.xsd;
lineNumber: 119; columnNumber: 46; schema_reference.4: Failed to read schema
document 'jsp_2_2.xsd', because 1) could not find the document; 2) the document
could not be read; 3) the root element of the document is not <xsd:schema>.

Caused by: java.io.FileNotFoundException: JAR entry
javax/servlet/resources/jsp_2_2.xsd not found in
/Users/jeremy/apache/apache-tomcat-7.0.41/lib/servlet-api.jar

The full output is attached. As you can see, it is looking for jsp_2_2.xsd in
same location as the web-common_3_0.xsd resource that is including it. I ran
against the lib directory from a download of 7.0.41.

I don't know how the TCK is validating. It may have a custom resolver for its
own copies of the XSDs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message