XML Maven Plugin : Schema Validation takes longer time as Resolver tries to 
Validate URL with url.openStream() 
[org.codehaus.mojo.xml.Resolver.resolveAsURL(String)]
--------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: MOJO-1543
                 URL: http://jira.codehaus.org/browse/MOJO-1543
             Project: Mojo
          Issue Type: Bug
          Components: xml
         Environment: Any OS with NO internet connection
            Reporter: Prashant  Bhate
            Assignee: Jochen Wiedmann



When XML is validated with help of http://mojo.codehaus.org/xml-maven-plugin/ 
in environment where there is no internet connectivity or within corporate 
network, Validation takes much longer time than usual.

I suspect the issue is with use of {{url.openStream();}} used in 
{{org.codehaus.mojo.xml.Resolver.resolveAsURL(String)}}. 


{code:title=Resolver.java|borderStyle=solid}

        try
        {
            final URL url = new URL( pResource );
            stream = url.openStream();
            stream.close();
            stream = null;
            return url;
        }
        catch ( IOException e )
        {
            return null;
        }

{code} 

openStream by default sets timeout value as 0 which makes the request wait for 
ever. Instead of this if above lines are replaced with 

{code:title=Resolver.java|borderStyle=solid}
// Define static TIMEOUT as constant ...
        try
        {
            final URL url = new URL( pResource );
            conn.setConnectTimeout(TIMEOUT);
            conn.setReadTimeout(TIMEOUT);
            stream = conn.getInputStream();
            stream.close();
            stream = null;
            return url;
        }
        catch ( IOException e )
        {
            return null;
        }

{code} 

Connection would only wait for only specified amount instead of for ever.

Hope this detail helps

Thanks,
Prashant Bhate


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to