static void parseClassResources()

in web/src/main/java/org/apache/commons/chain2/web/ChainResources.java [54:86]


    static void parseClassResources(String resources,
                                    XmlConfigParser parser) {
        if (resources == null) {
            return;
        }
        Log log = LogFactory.getLog(ChainResources.class);
        ClassLoader loader =
            Thread.currentThread().getContextClassLoader();
        if (loader == null) {
            loader = ChainResources.class.getClassLoader();
        }
        String[] paths = getResourcePaths(resources);
        String path = null;
        try {
            for (String path1 : paths) {
                path = path1;
                URL url = loader.getResource(path);
                if (url == null) {
                    throw new IllegalStateException
                            ("Missing chain config resource '" + path + "'");
                }
                if (log.isDebugEnabled()) {
                    log.debug("Loading chain config resource '" + path + "'");
                }
                @SuppressWarnings("unused") // FIXME we have to assign the factory here to help the compiler with the type arguments
                CatalogFactory<Object,Object,Map<Object,Object>> factory = parser.parse(url);
            }
        } catch (Exception e) {
            throw new RuntimeException
                ("Exception parsing chain config resource '" + path + "': "
                 + e.getMessage());
        }
    }