Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

Class net::sourceforge::jnlp::runtime::JNLPClassLoader::loadClass ( String  name  )  throws ClassNotFoundException [inline]

Find a JAR in the shared 'extension' classloaders, this classloader, or one of the classloaders for the JNLP file's extensions.

Definition at line 948 of file JNLPClassLoader.java.

References net::sourceforge::jnlp::cache::ResourceTracker::addResource(), available, file, findLoadedClassAll(), net::sourceforge::jnlp::cache::ResourceTracker::getCacheURL(), net::sourceforge::jnlp::JNLPFile::getCodeBase(), net::sourceforge::jnlp::JARDesc::getLocation(), net::sourceforge::jnlp::JARDesc::getVersion(), jarIndexes, loadClassExt(), and tracker.

Referenced by net::sourceforge::jnlp::Launcher::createApplet(), and net::sourceforge::jnlp::Launcher::createAppletObject().

                                                                      {

        Class result = findLoadedClassAll(name);

        // try parent classloader
        if (result == null) {
            try {
                ClassLoader parent = getParent();
                if (parent == null)
                    parent = ClassLoader.getSystemClassLoader();

                return parent.loadClass(name);
            }
            catch (ClassNotFoundException ex) { }
        }

        // filter out 'bad' package names like java, javax
        // validPackage(name);

        // search this and the extension loaders
        if (result == null)
            try {
                result = loadClassExt(name);
            } catch (ClassNotFoundException cnfe) {

                // Not found in external loader either. As a last resort, look in any available indexes

                // Currently this loads jars directly from the site. We cannot cache it because this
                // call is initiated from within the applet, which does not have disk read/write permissions
                for (JarIndex index: jarIndexes) {
                    LinkedList<String> jarList = index.get(name.replace('.', '/'));

                    if (jarList != null) {
                        for (String jarName: jarList) {
                            JARDesc desc;
                            try {
                                desc = new JARDesc(new URL(file.getCodeBase(), jarName),
                                        null, null, false, true, false, true);
                            } catch (MalformedURLException mfe) {
                                throw new ClassNotFoundException(name);
                            }

                            available.add(desc);

                            tracker.addResource(desc.getLocation(),
                                    desc.getVersion(),
                                    JNLPRuntime.getDefaultUpdatePolicy()
                            );

                            URL remoteURL;
                            try {
                                remoteURL = new URL(file.getCodeBase() + jarName);
                            } catch (MalformedURLException mfe) {
                                throw new ClassNotFoundException(name);
                            }

                            URL u;

                            try {
                                u = tracker.getCacheURL(remoteURL);
                            } catch (Exception e) {
                                throw new ClassNotFoundException(name);
                            }

                            if (u != null)
                                addURL(u);

                        }

                        // If it still fails, let it error out
                        result = loadClassExt(name);
                    }
                }
            }

        return result;
    }


Generated by  Doxygen 1.6.0   Back to index