public URLConnection getResourceConnection(String resourceName) throws ResourceException {
        // Get the URLConnection
        URLConnection groovyScriptConn = null;

        ResourceException se = null;
        for (URL root : roots) {
            URL scriptURL = null;
            try {
                scriptURL = new URL(root, resourceName);
                groovyScriptConn = openConnection(scriptURL);

                break; // Now this is a bit unusual
            } catch (MalformedURLException e) {
                String message = "Malformed URL: " + root + ", " + resourceName;
                if (se == null) {
                    se = new ResourceException(message);
                } else {
                    se = new ResourceException(message, se);
                }
            } catch (IOException e1) {
                String message = "Cannot open URL: " + root + resourceName;
                groovyScriptConn = null;
                if (se == null) {
                    se = new ResourceException(message);
                } else {
                    se = new ResourceException(message, se);
                }
            }
        }

        if (se == null) se = new ResourceException("No resource for " + resourceName + " was found");

        // If we didn't find anything, report on all the exceptions that occurred.
        if (groovyScriptConn == null) throw se;
        return groovyScriptConn;
    }
public URLConnection getResourceConnection ( String resourceName ) throws ResourceException { URLConnection groovyScriptConn = null ; ResourceException se = null ; for ( URL root : roots ) { URL scriptURL = null ; try { scriptURL = new URL ( root , resourceName ) ; groovyScriptConn = openConnection ( scriptURL ) ; break ; } catch ( MalformedURLException e ) { String message = "Malformed URL: " + root + ", " + resourceName ; if ( se == null ) { se = new ResourceException ( message ) ; } else { se = new ResourceException ( message , se ) ; } } catch ( IOException e1 ) { String message = "Cannot open URL: " + root + resourceName ; groovyScriptConn = null ; if ( se == null ) { se = new ResourceException ( message ) ; } else { se = new ResourceException ( message , se ) ; } } } if ( se == null ) se = new ResourceException ( "No resource for " + resourceName + " was found" ) ; if ( groovyScriptConn == null ) throw se ; return groovyScriptConn ; }
Get a resource connection as a <code>URLConnection</code> to retrieve a script
from the <code>ResourceConnector</code>.

@param resourceName name of the resource to be retrieved
@return a URLConnection to the resource
@throws ResourceException