[jboss-jira] [JBoss JIRA] (JBMETA-348) WebApp24ValidationUnitTestCase tries to connect to java.sun.com

Thomas Diesler (Issue Comment Edited) (JIRA) jira-events at lists.jboss.org
Mon Dec 12 10:12:11 EST 2011


    [ https://issues.jboss.org/browse/JBMETA-348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650038#comment-12650038 ] 

Thomas Diesler edited comment on JBMETA-348 at 12/12/11 10:10 AM:
------------------------------------------------------------------

You can use this code instead

{code}
public void testJAXPSchema() throws Exception {
    URL schemaURL = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
    XMLResourceResolver resolver = new XMLResourceResolver();
    InputSource source = resolver.resolveEntity(schemaURL.toExternalForm(), null);
    SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    factory.setResourceResolver(resolver);
    jaxpSchema = factory.newSchema(new StreamSource(source.getByteStream(), schemaURL.toExternalForm()));
}
{code}

It gets the input stream from the resolver. As a side effect it also tests that the top level schame can get resolved
                
      was (Author: thomas.diesler):
    You can use this code instead

{code}
public void testJAXPSchema() throws Exception {
    URL schemaURL = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
    XMLResourceResolver resolver = new XMLResourceResolver();
    InputSource source = resolver.resolveEntity(schemaURL.toExternalForm(), null);
    SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    factory.setResourceResolver(resolver);
    jaxpSchema = factory.newSchema(new StreamSource(source.getByteStream(), schemaURL.toExternalForm()));
}
{code}
                  
> WebApp24ValidationUnitTestCase tries to connect to java.sun.com
> ---------------------------------------------------------------
>
>                 Key: JBMETA-348
>                 URL: https://issues.jboss.org/browse/JBMETA-348
>             Project: JBoss Metadata
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: web
>    Affects Versions: 7.0.0.Beta30
>         Environment: Fedora 15
>            Reporter: Carlo de Wolf
>            Assignee: Thomas Diesler
>            Priority: Blocker
>             Fix For: 7.0.0.Beta31
>
>         Attachments: org.jboss.test.metadata.web.WebApp24ValidationUnitTestCase.txt
>
>
> The tests must never connect to the outside world.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list