changeset 1842:31b0ba36a6b7

Completely restructure the building and inclusion of netx and plugin code. We were relying on the binary plugs process (and thus importing unneeded SNMP classes). We now use the same method as jaxws, jaxp, langtools and corba, and the binary plugs process is turned off (the default, we were turning it on by setting ALT_BINARY_PLUGS_PATH). 2009-05-27 Andrew John Hughes <ahughes@redhat.com> * overlays/openjdk/jdk/src/share/classes/javax/jnlp/BasicService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/ClipboardService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadServiceListener.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/ExtensionInstallerService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileContents.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileOpenService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileSaveService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/JNLPRandomAccessFile.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/PersistenceService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/PrintService.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManager.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManagerStub.java, * overlays/openjdk/jdk/src/share/classes/javax/jnlp/UnavailableServiceException.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/AppletDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ApplicationDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ComponentDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/DefaultLaunchHandler.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ExtensionDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/IconDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InformationDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InstallerDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JARDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPFile.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPSplashScreen.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JREDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchException.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchHandler.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Launcher.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/NetxPanel.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Node.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PackageDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ParseException.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Parser.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PluginBridge.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PropertyDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ResourcesDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/SecurityDesc.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Version.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheEntry.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheUtil.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DownloadIndicator.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/Resource.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/ResourceTracker.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/UpdatePolicy.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/package.html, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationEvent.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationListener.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadEvent.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadListener.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/package.html, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/package.html, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Manifest.mf, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Messages.properties, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/about.jnlp, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/default.jnlp, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppThreadGroup.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletAudioClip.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletEnvironment.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletInstance.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/ApplicationInstance.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot13.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPClassLoader.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPPolicy.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPRuntime.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/package.html, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AccessWarningPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AppletWarningPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertVerifier.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertWarningPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertsInfoPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/HttpsCertVerifier.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/MoreInfoPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityDialogUI.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityUtil.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityWarningDialog.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SingleCertInfoPane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/VariableX509TrustManager.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificatePane.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificateViewer.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/ServiceUtil.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XBasicService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XClipboardService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XDownloadService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XExtensionInstallerService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileContents.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileOpenService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileSaveService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPersistenceService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPrintService.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XServiceManagerStub.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/package.html, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/CharacterEncoder.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/HexDumpEncoder.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarRunner.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSigner.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSignerResources.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyStoreUtil.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyTool.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/PropertiesFile.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/Reflect.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/WeakList.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLElement.java, * overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLParseException.java: Moved to... * Makefile.am: Remove use of ALT_BINARY_PLUGS_PATH (and thus turn off the binary plugs build), add a INITIAL_BOOTSTRAP_LINK_STAMP target which allows us to depend on $(ICEDTEA_BOOT_DIR) for both types of build, output to lib/tools.jar not jre/lib/tools.jar, add targets for building netx and liveconnect classes and make icedtea targets dependent on this. * netx/javax/jnlp/BasicService.java, * netx/javax/jnlp/ClipboardService.java, * netx/javax/jnlp/DownloadService.java, * netx/javax/jnlp/DownloadServiceListener.java, * netx/javax/jnlp/ExtensionInstallerService.java, * netx/javax/jnlp/FileContents.java, * netx/javax/jnlp/FileOpenService.java, * netx/javax/jnlp/FileSaveService.java, * netx/javax/jnlp/JNLPRandomAccessFile.java, * netx/javax/jnlp/PersistenceService.java, * netx/javax/jnlp/PrintService.java, * netx/javax/jnlp/ServiceManager.java, * netx/javax/jnlp/ServiceManagerStub.java, * netx/javax/jnlp/UnavailableServiceException.java, * netx/net/sourceforge/jnlp/AppletDesc.java, * netx/net/sourceforge/jnlp/ApplicationDesc.java, * netx/net/sourceforge/jnlp/ComponentDesc.java, * netx/net/sourceforge/jnlp/DefaultLaunchHandler.java, * netx/net/sourceforge/jnlp/ExtensionDesc.java, * netx/net/sourceforge/jnlp/IconDesc.java, * netx/net/sourceforge/jnlp/InformationDesc.java, * netx/net/sourceforge/jnlp/InstallerDesc.java, * netx/net/sourceforge/jnlp/JARDesc.java, * netx/net/sourceforge/jnlp/JNLPFile.java, * netx/net/sourceforge/jnlp/JNLPSplashScreen.java, * netx/net/sourceforge/jnlp/JREDesc.java, * netx/net/sourceforge/jnlp/LaunchException.java, * netx/net/sourceforge/jnlp/LaunchHandler.java, * netx/net/sourceforge/jnlp/Launcher.java, * netx/net/sourceforge/jnlp/NetxPanel.java, * netx/net/sourceforge/jnlp/Node.java, * netx/net/sourceforge/jnlp/PackageDesc.java, * netx/net/sourceforge/jnlp/ParseException.java, * netx/net/sourceforge/jnlp/Parser.java, * netx/net/sourceforge/jnlp/PluginBridge.java, * netx/net/sourceforge/jnlp/PropertyDesc.java, * netx/net/sourceforge/jnlp/ResourcesDesc.java, * netx/net/sourceforge/jnlp/SecurityDesc.java, * netx/net/sourceforge/jnlp/Version.java, * netx/net/sourceforge/jnlp/cache/CacheEntry.java, * netx/net/sourceforge/jnlp/cache/CacheUtil.java, * netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java, * netx/net/sourceforge/jnlp/cache/DownloadIndicator.java, * netx/net/sourceforge/jnlp/cache/Resource.java, * netx/net/sourceforge/jnlp/cache/ResourceTracker.java, * netx/net/sourceforge/jnlp/cache/UpdatePolicy.java, * netx/net/sourceforge/jnlp/cache/package.html, * netx/net/sourceforge/jnlp/event/ApplicationEvent.java, * netx/net/sourceforge/jnlp/event/ApplicationListener.java, * netx/net/sourceforge/jnlp/event/DownloadEvent.java, * netx/net/sourceforge/jnlp/event/DownloadListener.java, * netx/net/sourceforge/jnlp/event/package.html, * netx/net/sourceforge/jnlp/package.html, * netx/net/sourceforge/jnlp/resources/Manifest.mf, * netx/net/sourceforge/jnlp/resources/Messages.properties, * netx/net/sourceforge/jnlp/resources/about.jnlp, * netx/net/sourceforge/jnlp/resources/default.jnlp, * netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java, * netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java, * netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java, * netx/net/sourceforge/jnlp/runtime/AppletInstance.java, * netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java, * netx/net/sourceforge/jnlp/runtime/Boot.java, * netx/net/sourceforge/jnlp/runtime/Boot13.java, * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java, * netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java, * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java, * netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java, * netx/net/sourceforge/jnlp/runtime/package.html, * netx/net/sourceforge/jnlp/security/AccessWarningPane.java, * netx/net/sourceforge/jnlp/security/AppletWarningPane.java, * netx/net/sourceforge/jnlp/security/CertVerifier.java, * netx/net/sourceforge/jnlp/security/CertWarningPane.java, * netx/net/sourceforge/jnlp/security/CertsInfoPane.java, * netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java, * netx/net/sourceforge/jnlp/security/MoreInfoPane.java, * netx/net/sourceforge/jnlp/security/SecurityDialogUI.java, * netx/net/sourceforge/jnlp/security/SecurityUtil.java, * netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java, * netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java, * netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java, * netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java, * netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java, * netx/net/sourceforge/jnlp/services/ServiceUtil.java, * netx/net/sourceforge/jnlp/services/XBasicService.java, * netx/net/sourceforge/jnlp/services/XClipboardService.java, * netx/net/sourceforge/jnlp/services/XDownloadService.java, * netx/net/sourceforge/jnlp/services/XExtensionInstallerService.java, * netx/net/sourceforge/jnlp/services/XFileContents.java, * netx/net/sourceforge/jnlp/services/XFileOpenService.java, * netx/net/sourceforge/jnlp/services/XFileSaveService.java, * netx/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java, * netx/net/sourceforge/jnlp/services/XPersistenceService.java, * netx/net/sourceforge/jnlp/services/XPrintService.java, * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java, * netx/net/sourceforge/jnlp/services/package.html, * netx/net/sourceforge/jnlp/tools/CharacterEncoder.java, * netx/net/sourceforge/jnlp/tools/HexDumpEncoder.java, * netx/net/sourceforge/jnlp/tools/JarRunner.java, * netx/net/sourceforge/jnlp/tools/JarSigner.java, * netx/net/sourceforge/jnlp/tools/JarSignerResources.java, * netx/net/sourceforge/jnlp/tools/KeyStoreUtil.java, * netx/net/sourceforge/jnlp/tools/KeyTool.java, * netx/net/sourceforge/jnlp/util/PropertiesFile.java, * netx/net/sourceforge/jnlp/util/Reflect.java, * netx/net/sourceforge/jnlp/util/WeakList.java, * netx/net/sourceforge/nanoxml/XMLElement.java, * netx/net/sourceforge/nanoxml/XMLParseException.java: to here. * patches/ecj/icedtea.patch: Recreated. * patches/icedtea-ant.patch: Remove hack to jaxws which uses plugs directory (now undefined). * patches/icedtea-javac-debuginfo.patch: Recreated. * patches/icedtea-netx.patch: Include netx and netscape classes via the same import mechanism as jaxws, jaxp, corba and langtools (extracting a classes.zip).
author Andrew John Hughes <ahughes@redhat.com>
date Thu, 28 May 2009 10:18:19 +0100
parents cecded2429ca
children c1ca56ce26f5
files ChangeLog Makefile.am netx/javax/jnlp/BasicService.java netx/javax/jnlp/ClipboardService.java netx/javax/jnlp/DownloadService.java netx/javax/jnlp/DownloadServiceListener.java netx/javax/jnlp/ExtensionInstallerService.java netx/javax/jnlp/FileContents.java netx/javax/jnlp/FileOpenService.java netx/javax/jnlp/FileSaveService.java netx/javax/jnlp/JNLPRandomAccessFile.java netx/javax/jnlp/PersistenceService.java netx/javax/jnlp/PrintService.java netx/javax/jnlp/ServiceManager.java netx/javax/jnlp/ServiceManagerStub.java netx/javax/jnlp/UnavailableServiceException.java netx/net/sourceforge/jnlp/AppletDesc.java netx/net/sourceforge/jnlp/ApplicationDesc.java netx/net/sourceforge/jnlp/ComponentDesc.java netx/net/sourceforge/jnlp/DefaultLaunchHandler.java netx/net/sourceforge/jnlp/ExtensionDesc.java netx/net/sourceforge/jnlp/IconDesc.java netx/net/sourceforge/jnlp/InformationDesc.java netx/net/sourceforge/jnlp/InstallerDesc.java netx/net/sourceforge/jnlp/JARDesc.java netx/net/sourceforge/jnlp/JNLPFile.java netx/net/sourceforge/jnlp/JNLPSplashScreen.java netx/net/sourceforge/jnlp/JREDesc.java netx/net/sourceforge/jnlp/LaunchException.java netx/net/sourceforge/jnlp/LaunchHandler.java netx/net/sourceforge/jnlp/Launcher.java netx/net/sourceforge/jnlp/NetxPanel.java netx/net/sourceforge/jnlp/Node.java netx/net/sourceforge/jnlp/PackageDesc.java netx/net/sourceforge/jnlp/ParseException.java netx/net/sourceforge/jnlp/Parser.java netx/net/sourceforge/jnlp/PluginBridge.java netx/net/sourceforge/jnlp/PropertyDesc.java netx/net/sourceforge/jnlp/ResourcesDesc.java netx/net/sourceforge/jnlp/SecurityDesc.java netx/net/sourceforge/jnlp/Version.java netx/net/sourceforge/jnlp/cache/CacheEntry.java netx/net/sourceforge/jnlp/cache/CacheUtil.java netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java netx/net/sourceforge/jnlp/cache/DownloadIndicator.java netx/net/sourceforge/jnlp/cache/Resource.java netx/net/sourceforge/jnlp/cache/ResourceTracker.java netx/net/sourceforge/jnlp/cache/UpdatePolicy.java netx/net/sourceforge/jnlp/cache/package.html netx/net/sourceforge/jnlp/event/ApplicationEvent.java netx/net/sourceforge/jnlp/event/ApplicationListener.java netx/net/sourceforge/jnlp/event/DownloadEvent.java netx/net/sourceforge/jnlp/event/DownloadListener.java netx/net/sourceforge/jnlp/event/package.html netx/net/sourceforge/jnlp/package.html netx/net/sourceforge/jnlp/resources/Manifest.mf netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/resources/about.jnlp netx/net/sourceforge/jnlp/resources/default.jnlp netx/net/sourceforge/jnlp/resources/info-small.png netx/net/sourceforge/jnlp/resources/install.png netx/net/sourceforge/jnlp/resources/netx-icon.png netx/net/sourceforge/jnlp/resources/warning-small.png netx/net/sourceforge/jnlp/resources/warning.png netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java netx/net/sourceforge/jnlp/runtime/AppletInstance.java netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java netx/net/sourceforge/jnlp/runtime/Boot.java netx/net/sourceforge/jnlp/runtime/Boot13.java netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java netx/net/sourceforge/jnlp/runtime/package.html netx/net/sourceforge/jnlp/security/AccessWarningPane.java netx/net/sourceforge/jnlp/security/AppletWarningPane.java netx/net/sourceforge/jnlp/security/CertVerifier.java netx/net/sourceforge/jnlp/security/CertWarningPane.java netx/net/sourceforge/jnlp/security/CertsInfoPane.java netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java netx/net/sourceforge/jnlp/security/MoreInfoPane.java netx/net/sourceforge/jnlp/security/SecurityDialogUI.java netx/net/sourceforge/jnlp/security/SecurityUtil.java netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java netx/net/sourceforge/jnlp/services/ServiceUtil.java netx/net/sourceforge/jnlp/services/XBasicService.java netx/net/sourceforge/jnlp/services/XClipboardService.java netx/net/sourceforge/jnlp/services/XDownloadService.java netx/net/sourceforge/jnlp/services/XExtensionInstallerService.java netx/net/sourceforge/jnlp/services/XFileContents.java netx/net/sourceforge/jnlp/services/XFileOpenService.java netx/net/sourceforge/jnlp/services/XFileSaveService.java netx/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java netx/net/sourceforge/jnlp/services/XPersistenceService.java netx/net/sourceforge/jnlp/services/XPrintService.java netx/net/sourceforge/jnlp/services/XServiceManagerStub.java netx/net/sourceforge/jnlp/services/package.html netx/net/sourceforge/jnlp/tools/CharacterEncoder.java netx/net/sourceforge/jnlp/tools/HexDumpEncoder.java netx/net/sourceforge/jnlp/tools/JarRunner.java netx/net/sourceforge/jnlp/tools/JarSigner.java netx/net/sourceforge/jnlp/tools/JarSignerResources.java netx/net/sourceforge/jnlp/tools/KeyStoreUtil.java netx/net/sourceforge/jnlp/tools/KeyTool.java netx/net/sourceforge/jnlp/util/PropertiesFile.java netx/net/sourceforge/jnlp/util/Reflect.java netx/net/sourceforge/jnlp/util/WeakList.java netx/net/sourceforge/nanoxml/XMLElement.java netx/net/sourceforge/nanoxml/XMLParseException.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/BasicService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/ClipboardService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadServiceListener.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/ExtensionInstallerService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileContents.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileOpenService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileSaveService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/JNLPRandomAccessFile.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/PersistenceService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/PrintService.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManager.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManagerStub.java overlays/openjdk/jdk/src/share/classes/javax/jnlp/UnavailableServiceException.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/AppletDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ApplicationDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ComponentDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/DefaultLaunchHandler.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ExtensionDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/IconDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InformationDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InstallerDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JARDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPFile.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPSplashScreen.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JREDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchException.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchHandler.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Launcher.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/NetxPanel.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Node.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PackageDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ParseException.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Parser.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PluginBridge.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PropertyDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ResourcesDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/SecurityDesc.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Version.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheEntry.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheUtil.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DownloadIndicator.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/Resource.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/ResourceTracker.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/UpdatePolicy.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/package.html overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationEvent.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationListener.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadEvent.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadListener.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/package.html overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/package.html overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Manifest.mf overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Messages.properties overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/about.jnlp overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/default.jnlp overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/info-small.png overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/install.png overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/netx-icon.png overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/warning-small.png overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/warning.png overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppThreadGroup.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletAudioClip.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletEnvironment.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletInstance.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/ApplicationInstance.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot13.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPClassLoader.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPPolicy.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPRuntime.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/package.html overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AccessWarningPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AppletWarningPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertVerifier.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertWarningPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertsInfoPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/HttpsCertVerifier.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/MoreInfoPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityDialogUI.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityUtil.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityWarningDialog.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SingleCertInfoPane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/VariableX509TrustManager.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificatePane.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificateViewer.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/ServiceUtil.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XBasicService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XClipboardService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XDownloadService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XExtensionInstallerService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileContents.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileOpenService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileSaveService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPersistenceService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPrintService.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XServiceManagerStub.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/package.html overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/CharacterEncoder.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/HexDumpEncoder.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarRunner.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSigner.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSignerResources.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyStoreUtil.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyTool.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/PropertiesFile.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/Reflect.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/WeakList.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLElement.java overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLParseException.java patches/ecj/icedtea.patch patches/icedtea-ant.patch patches/icedtea-javac-debuginfo.patch patches/icedtea-netx.patch
diffstat 232 files changed, 21056 insertions(+), 20656 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 27 20:20:48 2009 +0100
+++ b/ChangeLog	Thu May 28 10:18:19 2009 +0100
@@ -1,3 +1,236 @@
+2009-05-27  Andrew John Hughes  <ahughes@redhat.com>
+
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/BasicService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/ClipboardService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadServiceListener.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/ExtensionInstallerService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileContents.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileOpenService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileSaveService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/JNLPRandomAccessFile.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/PersistenceService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/PrintService.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManager.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManagerStub.java,
+	* overlays/openjdk/jdk/src/share/classes/javax/jnlp/UnavailableServiceException.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/AppletDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ApplicationDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ComponentDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/DefaultLaunchHandler.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ExtensionDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/IconDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InformationDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InstallerDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JARDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPFile.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPSplashScreen.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JREDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchException.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchHandler.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Launcher.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/NetxPanel.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Node.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PackageDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ParseException.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Parser.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PluginBridge.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PropertyDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ResourcesDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/SecurityDesc.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Version.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheEntry.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheUtil.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DownloadIndicator.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/Resource.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/ResourceTracker.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/UpdatePolicy.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/package.html,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationEvent.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationListener.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadEvent.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadListener.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/package.html,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/package.html,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Manifest.mf,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Messages.properties,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/about.jnlp,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/default.jnlp,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppThreadGroup.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletAudioClip.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletEnvironment.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletInstance.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/ApplicationInstance.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot13.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPClassLoader.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPPolicy.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPRuntime.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/package.html,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AccessWarningPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AppletWarningPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertVerifier.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertWarningPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertsInfoPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/HttpsCertVerifier.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/MoreInfoPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityDialogUI.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityUtil.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityWarningDialog.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SingleCertInfoPane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/VariableX509TrustManager.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificatePane.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificateViewer.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/ServiceUtil.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XBasicService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XClipboardService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XDownloadService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XExtensionInstallerService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileContents.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileOpenService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileSaveService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPersistenceService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPrintService.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XServiceManagerStub.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/package.html,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/CharacterEncoder.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/HexDumpEncoder.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarRunner.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSigner.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSignerResources.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyStoreUtil.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyTool.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/PropertiesFile.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/Reflect.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/WeakList.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLElement.java,
+	* overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLParseException.java:
+	Moved to...
+	* Makefile.am:
+	Remove use of ALT_BINARY_PLUGS_PATH (and thus turn off the binary plugs build),
+	add a INITIAL_BOOTSTRAP_LINK_STAMP target which allows us to depend on $(ICEDTEA_BOOT_DIR)
+	for both types of build, output to lib/tools.jar not jre/lib/tools.jar, add targets
+	for building netx and liveconnect classes and make icedtea targets dependent on this.
+	* netx/javax/jnlp/BasicService.java,
+	* netx/javax/jnlp/ClipboardService.java,
+	* netx/javax/jnlp/DownloadService.java,
+	* netx/javax/jnlp/DownloadServiceListener.java,
+	* netx/javax/jnlp/ExtensionInstallerService.java,
+	* netx/javax/jnlp/FileContents.java,
+	* netx/javax/jnlp/FileOpenService.java,
+	* netx/javax/jnlp/FileSaveService.java,
+	* netx/javax/jnlp/JNLPRandomAccessFile.java,
+	* netx/javax/jnlp/PersistenceService.java,
+	* netx/javax/jnlp/PrintService.java,
+	* netx/javax/jnlp/ServiceManager.java,
+	* netx/javax/jnlp/ServiceManagerStub.java,
+	* netx/javax/jnlp/UnavailableServiceException.java,
+	* netx/net/sourceforge/jnlp/AppletDesc.java,
+	* netx/net/sourceforge/jnlp/ApplicationDesc.java,
+	* netx/net/sourceforge/jnlp/ComponentDesc.java,
+	* netx/net/sourceforge/jnlp/DefaultLaunchHandler.java,
+	* netx/net/sourceforge/jnlp/ExtensionDesc.java,
+	* netx/net/sourceforge/jnlp/IconDesc.java,
+	* netx/net/sourceforge/jnlp/InformationDesc.java,
+	* netx/net/sourceforge/jnlp/InstallerDesc.java,
+	* netx/net/sourceforge/jnlp/JARDesc.java,
+	* netx/net/sourceforge/jnlp/JNLPFile.java,
+	* netx/net/sourceforge/jnlp/JNLPSplashScreen.java,
+	* netx/net/sourceforge/jnlp/JREDesc.java,
+	* netx/net/sourceforge/jnlp/LaunchException.java,
+	* netx/net/sourceforge/jnlp/LaunchHandler.java,
+	* netx/net/sourceforge/jnlp/Launcher.java,
+	* netx/net/sourceforge/jnlp/NetxPanel.java,
+	* netx/net/sourceforge/jnlp/Node.java,
+	* netx/net/sourceforge/jnlp/PackageDesc.java,
+	* netx/net/sourceforge/jnlp/ParseException.java,
+	* netx/net/sourceforge/jnlp/Parser.java,
+	* netx/net/sourceforge/jnlp/PluginBridge.java,
+	* netx/net/sourceforge/jnlp/PropertyDesc.java,
+	* netx/net/sourceforge/jnlp/ResourcesDesc.java,
+	* netx/net/sourceforge/jnlp/SecurityDesc.java,
+	* netx/net/sourceforge/jnlp/Version.java,
+	* netx/net/sourceforge/jnlp/cache/CacheEntry.java,
+	* netx/net/sourceforge/jnlp/cache/CacheUtil.java,
+	* netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java,
+	* netx/net/sourceforge/jnlp/cache/DownloadIndicator.java,
+	* netx/net/sourceforge/jnlp/cache/Resource.java,
+	* netx/net/sourceforge/jnlp/cache/ResourceTracker.java,
+	* netx/net/sourceforge/jnlp/cache/UpdatePolicy.java,
+	* netx/net/sourceforge/jnlp/cache/package.html,
+	* netx/net/sourceforge/jnlp/event/ApplicationEvent.java,
+	* netx/net/sourceforge/jnlp/event/ApplicationListener.java,
+	* netx/net/sourceforge/jnlp/event/DownloadEvent.java,
+	* netx/net/sourceforge/jnlp/event/DownloadListener.java,
+	* netx/net/sourceforge/jnlp/event/package.html,
+	* netx/net/sourceforge/jnlp/package.html,
+	* netx/net/sourceforge/jnlp/resources/Manifest.mf,
+	* netx/net/sourceforge/jnlp/resources/Messages.properties,
+	* netx/net/sourceforge/jnlp/resources/about.jnlp,
+	* netx/net/sourceforge/jnlp/resources/default.jnlp,
+	* netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java,
+	* netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java,
+	* netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java,
+	* netx/net/sourceforge/jnlp/runtime/AppletInstance.java,
+	* netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java,
+	* netx/net/sourceforge/jnlp/runtime/Boot.java,
+	* netx/net/sourceforge/jnlp/runtime/Boot13.java,
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java,
+	* netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java,
+	* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java,
+	* netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java,
+	* netx/net/sourceforge/jnlp/runtime/package.html,
+	* netx/net/sourceforge/jnlp/security/AccessWarningPane.java,
+	* netx/net/sourceforge/jnlp/security/AppletWarningPane.java,
+	* netx/net/sourceforge/jnlp/security/CertVerifier.java,
+	* netx/net/sourceforge/jnlp/security/CertWarningPane.java,
+	* netx/net/sourceforge/jnlp/security/CertsInfoPane.java,
+	* netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java,
+	* netx/net/sourceforge/jnlp/security/MoreInfoPane.java,
+	* netx/net/sourceforge/jnlp/security/SecurityDialogUI.java,
+	* netx/net/sourceforge/jnlp/security/SecurityUtil.java,
+	* netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java,
+	* netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java,
+	* netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java,
+	* netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java,
+	* netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java,
+	* netx/net/sourceforge/jnlp/services/ServiceUtil.java,
+	* netx/net/sourceforge/jnlp/services/XBasicService.java,
+	* netx/net/sourceforge/jnlp/services/XClipboardService.java,
+	* netx/net/sourceforge/jnlp/services/XDownloadService.java,
+	* netx/net/sourceforge/jnlp/services/XExtensionInstallerService.java,
+	* netx/net/sourceforge/jnlp/services/XFileContents.java,
+	* netx/net/sourceforge/jnlp/services/XFileOpenService.java,
+	* netx/net/sourceforge/jnlp/services/XFileSaveService.java,
+	* netx/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java,
+	* netx/net/sourceforge/jnlp/services/XPersistenceService.java,
+	* netx/net/sourceforge/jnlp/services/XPrintService.java,
+	* netx/net/sourceforge/jnlp/services/XServiceManagerStub.java,
+	* netx/net/sourceforge/jnlp/services/package.html,
+	* netx/net/sourceforge/jnlp/tools/CharacterEncoder.java,
+	* netx/net/sourceforge/jnlp/tools/HexDumpEncoder.java,
+	* netx/net/sourceforge/jnlp/tools/JarRunner.java,
+	* netx/net/sourceforge/jnlp/tools/JarSigner.java,
+	* netx/net/sourceforge/jnlp/tools/JarSignerResources.java,
+	* netx/net/sourceforge/jnlp/tools/KeyStoreUtil.java,
+	* netx/net/sourceforge/jnlp/tools/KeyTool.java,
+	* netx/net/sourceforge/jnlp/util/PropertiesFile.java,
+	* netx/net/sourceforge/jnlp/util/Reflect.java,
+	* netx/net/sourceforge/jnlp/util/WeakList.java,
+	* netx/net/sourceforge/nanoxml/XMLElement.java,
+	* netx/net/sourceforge/nanoxml/XMLParseException.java: to here.
+	* patches/ecj/icedtea.patch:
+	Recreated.
+	* patches/icedtea-ant.patch:
+	Remove hack to jaxws which uses plugs directory (now undefined).
+	* patches/icedtea-javac-debuginfo.patch: Recreated.
+	* patches/icedtea-netx.patch:
+	Include netx and netscape classes via the same import mechanism
+	as jaxws, jaxp, corba and langtools (extracting a classes.zip).
+
 2009-05-27  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/Makefile.am	Wed May 27 20:20:48 2009 +0100
+++ b/Makefile.am	Thu May 28 10:18:19 2009 +0100
@@ -26,14 +26,14 @@
 ICEDTEAPLUGIN_CLEAN = clean-IcedTeaNPPlugin
 ICEDTEAPLUGIN_TARGET = IcedTeaNPPlugin.so
 PLUGIN_PATCH = patches/icedtea-liveconnect.patch
-LIVECONNECT_DIR = -C lib/rt netscape -C lib/rt net
+LIVECONNECT_DIR = -C lib/rt netscape
 JNLP_ABOUT_TARGET = extra-lib/about.jar 
 else
 if ENABLE_PLUGIN
 ICEDTEAPLUGIN_CLEAN = clean-IcedTeaPlugin
 ICEDTEAPLUGIN_TARGET = IcedTeaPlugin.so
 PLUGIN_PATCH = patches/icedtea-liveconnect.patch
-LIVECONNECT_DIR = -C lib/rt netscape -C lib/rt net
+LIVECONNECT_DIR = -C lib/rt netscape
 JNLP_ABOUT_TARGET = extra-lib/about.jar 
 else
 ICEDTEAPLUGIN_CLEAN =
@@ -63,6 +63,18 @@
 JIBX_DEPS_DIR=$(abs_top_builddir)/jibx
 endif
 
+SHARE = openjdk/jdk/src/share/classes
+SOLARIS = openjdk/jdk/src/solaris/classes
+LANGTOOLS = openjdk/langtools/src/share/classes
+JAXP = openjdk/jaxp/src/share/classes
+CORBA = openjdk/corba/src/share/classes
+JAXWS = openjdk/jaxws/src/share/classes
+
+OPENJDK_SOURCEPATH_DIRS = \
+        $(SHARE):$(SOLARIS):$(LANGTOOLS):$(JAXP):$(CORBA):$(JAXWS)
+
+SOURCEPATH_DIRS = $(abs_top_builddir)/generated:$(OPENJDK_SOURCEPATH_DIRS)
+
 # Top-Level Targets
 # =================
 
@@ -1527,7 +1539,6 @@
 	"LANG=C" \
 	"PATH=$(abs_top_builddir)/bootstrap/jdk1.6.0/bin:$(OS_PATH):$$PATH" \
 	"ALT_BOOTDIR=$(ICEDTEA_BOOT_DIR)" \
-	"ALT_BINARY_PLUGS_PATH=$(abs_top_builddir)/bootstrap/jdk1.7.0" \
 	"BUILD_ARCH_DIR=$(BUILD_ARCH_DIR)" \
 	"ICEDTEA_RT=$(ICEDTEA_RT)" \
 	"ICEDTEA_BUILD_DIR=$(ICEDTEA_BUILD_DIR)" \
@@ -1556,7 +1567,9 @@
 	"JAVAC=" \
 	"RHINO_JAR=$(RHINO_JAR)" \
 	"DISTRIBUTION_ID=$(DIST_ID)" \
-	"ALT_JIBX_LIBS_PATH=$(JIBX_DEPS_DIR)"
+	"ALT_JIBX_LIBS_PATH=$(JIBX_DEPS_DIR)" \
+	"ALT_NETX_DIST=$(abs_top_builddir)/netx" \
+	"ALT_LIVECONNECT_DIST=$(abs_top_builddir)"
 
 if WITH_CACAO
 ICEDTEA_ENV += \
@@ -1603,7 +1616,6 @@
 	"LANG=C" \
 	"PATH=$(abs_top_builddir)/bootstrap/jdk1.6.0/bin:$(OS_PATH):$$PATH" \
 	"ALT_BOOTDIR=$(ICEDTEA_BOOT_DIR)" \
-	"ALT_BINARY_PLUGS_PATH=$(abs_top_builddir)/bootstrap/jdk1.7.0" \
 	"BUILD_ARCH_DIR=$(BUILD_ARCH_DIR)" \
 	"ICEDTEA_RT=$(ICEDTEA_RT)" \
 	"ICEDTEA_BUILD_DIR=$(ICEDTEA_BUILD_DIR_ECJ)" \
@@ -1639,7 +1651,9 @@
 	"JAR_KNOWS_ATFILE=$(JAR_KNOWS_ATFILE)" \
 	"JAR_KNOWS_J_OPTIONS=$(JAR_KNOWS_J_OPTIONS)" \
 	"JAR_ACCEPTS_STDIN_LIST=$(JAR_ACCEPTS_STDIN_LIST)" \
-	"DISABLE_NIMBUS=true"
+	"DISABLE_NIMBUS=true" \
+	"ALT_NETX_DIST=$(abs_top_builddir)/netx" \
+	"ALT_LIVECONNECT_DIST=$(abs_top_builddir)"
 
 if WITH_CACAO
 ICEDTEA_ENV_ECJ += \
@@ -2060,6 +2074,7 @@
 	patches/icedtea-jvmtiEnv.patch \
 	patches/icedtea-xml-encodinginfo.patch \
 	patches/icedtea-cc-interp-backedge.patch \
+	patches/icedtea-netx.patch \
 	$(DISTRIBUTION_PATCHES)
 
 if WITH_RHINO
@@ -2277,12 +2292,12 @@
 	    test x$${all_patches_ok} = "xyes" && all_patches_ok=$$p ; \
 	  fi ; \
 	done ; \
-	mv stamps/patch.stamp.tmp stamps/patch.stamp ; \
 	if ! test x$${all_patches_ok} = "xyes"; then \
 	  echo ERROR patch $${all_patches_ok} FAILED! ; \
 	  echo WARNING make clean-patch before retrying a fix ; \
 	  exit 2; \
-	fi
+	fi ; \
+	mv stamps/patch.stamp.tmp stamps/patch.stamp 
 
 if ENABLE_NPPLUGIN
 	cp -a $(abs_top_srcdir)/plugin/icedteanp/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
@@ -2539,13 +2554,16 @@
 if WITH_OPENJDK
   BOOTSTRAP_DIRECTORY_STAMP =
   ICEDTEA_HOME = $(SYSTEM_OPENJDK_DIR)
+  INITIAL_BOOTSTRAP_LINK_STAMP = stamps/bootstrap-directory-symlink.stamp
 else
 if WITH_ICEDTEA
   BOOTSTRAP_DIRECTORY_STAMP =
   ICEDTEA_HOME = $(SYSTEM_ICEDTEA_DIR)
+  INITIAL_BOOTSTRAP_LINK_STAMP = stamps/bootstrap-directory-symlink.stamp
 else
   BOOTSTRAP_DIRECTORY_STAMP = stamps/bootstrap-directory.stamp
   ICEDTEA_HOME = $(abs_top_builddir)/bootstrap/icedtea
+  INITIAL_BOOTSTRAP_LINK_STAMP = stamps/bootstrap-directory-symlink-ecj.stamp
 endif
 endif
 
@@ -2601,10 +2619,10 @@
 	  rm -f bootstrap/ecj/include/$$i; \
 	  ln -s $(SYSTEM_GCJ_DIR)/include/$$i bootstrap/ecj/include/$$i; \
 	done; \
-	if test -f $(abs_top_builddir)/bootstrap/jdk1.7.0/jre/lib/tools.jar ; \
+	if test -f $(abs_top_builddir)/bootstrap/jdk1.7.0/lib/tools.jar ; \
 	then \
 	  mkdir -p $(abs_top_builddir)/bootstrap/ecj/lib ; \
-	  ln -sf $(abs_top_builddir)/bootstrap/jdk1.7.0/jre/lib/tools.jar \
+	  ln -sf $(abs_top_builddir)/bootstrap/jdk1.7.0/lib/tools.jar \
 	    $(abs_top_builddir)/bootstrap/ecj/lib/tools.jar ; \
 	fi
 	if test -f \
@@ -2654,7 +2672,8 @@
   ICEDTEA_DEBUG_BUILD_TARGET=debug_build
 endif
 
-NETX_RESOURCE_DIR=openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources
+NETX_DIR=$(abs_top_srcdir)/netx/net/sourceforge
+NETX_RESOURCE_DIR=$(NETX_DIR)/jnlp/resources
 
 # If you change anything here in the icedtea target, please make sure
 # you change it in the icedtea-debug target as well.
@@ -2662,8 +2681,8 @@
 	stamps/hotspot-tools.stamp stamps/plugs.stamp \
 	stamps/ports.stamp stamps/patch.stamp stamps/overlay.stamp \
 	$(ICEDTEAPLUGIN_TARGET) $(ICEDTEANPPLUGIN_TARGET) $(JNLP_ABOUT_TARGET) \
-	stamps/jibx.stamp stamps/cacao.stamp \
-	stamps/pulse-java.stamp stamps/visualvm.stamp
+	stamps/jibx.stamp stamps/cacao.stamp stamps/netx-dist.stamp \
+	stamps/liveconnect.stamp stamps/pulse-java.stamp stamps/visualvm.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV) \
 	  -C openjdk/ \
@@ -2748,8 +2767,8 @@
 	stamps/hotspot-tools.stamp stamps/plugs.stamp \
 	stamps/ports.stamp stamps/patch.stamp stamps/overlay.stamp \
 	$(ICEDTEAPLUGIN_TARGET) $(ICEDTEANPPLUGIN_TARGET) $(JNLP_ABOUT_TARGET) \
-	stamps/jibx.stamp stamps/cacao.stamp \
-	stamps/pulse-java.stamp stamps/visualvm.stamp
+	stamps/jibx.stamp stamps/cacao.stamp stamps/netx-dist.stamp \
+	stamps/liveconnect.stamp stamps/pulse-java.stamp stamps/visualvm.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV) \
 	  -C openjdk/ \
@@ -2861,8 +2880,9 @@
 	touch stamps/native-ecj.stamp
 
 stamps/icedtea-ecj.stamp: stamps/bootstrap-directory-symlink-ecj.stamp \
-	stamps/hotspot-tools.stamp stamps/plugs.stamp \
-	stamps/ports-ecj.stamp stamps/patch-ecj.stamp stamps/cacao.stamp
+	stamps/hotspot-tools.stamp stamps/plugs.stamp stamps/netx-dist.stamp \
+	stamps/liveconnect.stamp stamps/ports-ecj.stamp stamps/patch-ecj.stamp \
+	stamps/cacao.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV_ECJ) \
 	  -C openjdk-ecj \
@@ -2908,7 +2928,7 @@
 	mkdir -p stamps
 	touch stamps/plugs.stamp
 
-stamps/hotspot-tools.stamp: bootstrap/jdk1.7.0/jre/lib/tools.jar
+stamps/hotspot-tools.stamp: bootstrap/jdk1.7.0/lib/tools.jar
 	mkdir -p stamps
 	touch stamps/hotspot-tools.stamp
 
@@ -2919,7 +2939,7 @@
 
 clean-tools-jar: clean-hotspot-tools
 	rm -f stamps/hotspot-tools.stamp
-	rm -f bootstrap/jdk1.7.0/jre/lib/tools.jar
+	rm -f bootstrap/jdk1.7.0/lib/tools.jar
 
 # Sources copied from OpenJDK.
 ICEDTEA_COPY_DIRS = \
@@ -2954,16 +2974,6 @@
 	  rm -rf rt/$$copy_dir ; \
 	done
 
-SHARE = openjdk/jdk/src/share/classes
-SOLARIS = openjdk/jdk/src/solaris/classes
-LANGTOOLS = openjdk/langtools/src/share/classes
-JAXP = openjdk/jaxp/src/share/classes
-CORBA = openjdk/corba/src/share/classes
-JAXWS = openjdk/jaxws/src/share/classes
-
-OPENJDK_SOURCEPATH_DIRS = \
-        $(SHARE):$(SOLARIS):$(LANGTOOLS):$(JAXP):$(CORBA):$(JAXWS)
-
 # tools.jar class files.
 stamps/hotspot-tools-copy-source-files.stamp: stamps/overlay.stamp
 	for copy_dir in \
@@ -3002,21 +3012,21 @@
 	find hotspot-tools -name '*.java' | sort > $@
 	mkdir -p lib/hotspot-tools
 
-ABS_SOURCE_DIRS = $(abs_top_builddir)/generated
-stamps/hotspot-tools-class-files.stamp: hotspot-tools-source-files.txt
+stamps/hotspot-tools-class-files.stamp: hotspot-tools-source-files.txt \
+	$(INITIAL_BOOTSTRAP_LINK_STAMP)
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
 	then \
 	  $(JAVAC) $(MEMORY_LIMIT) -g -d lib/hotspot-tools \
             -source 1.5 \
             -sourcepath \
-	      'hotspot-tools:$(OPENJDK_SOURCEPATH_DIRS):$(ABS_SOURCE_DIRS)' \
+	      'hotspot-tools:$(abs_top_srcdir)/netx:$(SOURCEPATH_DIRS)' \
             -bootclasspath \'\' @$< ; \
 	else \
 	  $(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g \
 	    -d lib/hotspot-tools \
 	    -source 1.5 \
 	    -sourcepath \
-	      'hotspot-tools:$(OPENJDK_SOURCEPATH_DIRS):$(ABS_SOURCE_DIRS)' \
+	      'hotspot-tools:$(abs_top_srcdir)/netx:$(SOURCEPATH_DIRS)' \
 	    -bootclasspath \'\' @$< ; \
 	fi
 	mkdir -p stamps
@@ -3029,8 +3039,8 @@
 	rm -f stamps/hotspot-tools-copy-source-files.stamp
 
 # tools.jar
-bootstrap/jdk1.7.0/jre/lib/tools.jar: stamps/hotspot-tools-class-files.stamp
-	mkdir -p bootstrap/jdk1.7.0/jre/lib/
+bootstrap/jdk1.7.0/lib/tools.jar: stamps/hotspot-tools-class-files.stamp
+	mkdir -p bootstrap/jdk1.7.0/lib/
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
         then \
 	  $(JAR) cf $@ -C lib/hotspot-tools com -C lib/hotspot-tools sun \
@@ -3045,7 +3055,7 @@
 	if test -d bootstrap/ecj ; \
 	then \
 	  mkdir -p bootstrap/ecj/lib/; \
-	  ln -sf $(abs_top_builddir)/bootstrap/jdk1.7.0/jre/lib/tools.jar \
+	  ln -sf $(abs_top_builddir)/bootstrap/jdk1.7.0/lib/tools.jar \
 	    $(abs_top_builddir)/bootstrap/ecj/lib/tools.jar; \
 	fi
 
@@ -3054,20 +3064,20 @@
 	find $(abs_top_builddir)/rt -name '*.java' \
 	  | sort -u > $@
 
-stamps/rt-class-files.stamp: rt-source-files.txt
+stamps/rt-class-files.stamp: rt-source-files.txt stamps/hotspot-tools.stamp
 	mkdir -p lib/rt
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
         then \
 	  $(JAVAC) $(MEMORY_LIMIT) -g -d lib/rt \
 	    -source 1.5 \
-	    -sourcepath \
-	      '$(OPENJDK_SOURCEPATH_DIRS):$(ABS_SOURCE_DIRS)' \
+	    -classpath $(abs_top_builddir)/lib/hotspot-tools \
+	    -sourcepath '$(SOURCEPATH_DIRS)' \
 	    -bootclasspath \'\' @$< ; \
 	else \
 	  $(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g -d lib/rt \
             -source 1.5 \
-            -sourcepath \
-	      '$(OPENJDK_SOURCEPATH_DIRS):$(ABS_SOURCE_DIRS)' \
+	    -classpath $(abs_top_builddir)/lib/hotspot-tools \
+            -sourcepath '$(SOURCEPATH_DIRS)' \
             -bootclasspath \'\' @$< ; \
 	fi
 	mkdir -p stamps
@@ -3084,10 +3094,10 @@
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
 	then \
 	  $(JAR) cf $@ -C lib/rt com -C lib/rt java \
-	    -C lib/rt javax $(LIVECONNECT_DIR) -C lib/rt sun ; \
+	    -C lib/rt javax -C lib/rt sun ; \
 	else \
 	  $(ICEDTEA_BOOT_DIR)/bin/jar cf $@ -C lib/rt com -C lib/rt java \
-	    -C lib/rt javax $(LIVECONNECT_DIR) -C lib/rt sun ; \
+	    -C lib/rt javax -C lib/rt sun ; \
 	fi
 	if test -d bootstrap/ecj/jre/lib ; \
 	then \
@@ -3099,21 +3109,21 @@
 extra-source-files.txt:
 	find $(abs_top_srcdir)/extra -name '*.java' | sort > $@
 
-stamps/extra-class-files.stamp: extra-source-files.txt stamps/plugs.stamp
+stamps/extra-class-files.stamp: extra-source-files.txt stamps/netx.stamp
 	mkdir -p extra-lib
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
 	then \
 	  $(JAVAC) $(MEMORY_LIMIT) -g -d extra-lib \
 	    -source 1.5 \
-	    -sourcepath $(abs_top_srcdir)/extra \
-	    -classpath $(ICEDTEA_RT) \
+	    -classpath $(abs_top_builddir)/lib/hotspot-tools \
+	    -sourcepath $(abs_top_srcdir)/extra:$(SOURCEPATH_DIRS) \
 	    -bootclasspath \'\' \
 	    @extra-source-files.txt ; \
 	else \
 	  $(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g -d extra-lib \
             -source 1.5 \
-	    -sourcepath $(abs_top_srcdir)/extra \
-	    -classpath $(ICEDTEA_RT) \
+	    -classpath $(abs_top_builddir)/lib/hotspot-tools \
+	    -sourcepath $(abs_top_srcdir)/extra:$(SOURCEPATH_DIRS) \
 	    -bootclasspath \'\' \
 	    @extra-source-files.txt ; \
 	fi
@@ -3137,6 +3147,43 @@
 	  $(ICEDTEA_BOOT_DIR)/bin/jar cf $@ -C extra-lib net ; \
 	fi
 
+# netx
+# requires availability of OpenJDK source code including
+# a patch applied to sun.plugin.AppletViewerPanel and generated sources
+
+netx-source-files.txt:
+	find $(abs_top_srcdir)/netx -name '*.java' | sort > $@
+
+stamps/netx.stamp: netx-source-files.txt stamps/hotspot-tools.stamp
+	mkdir -p $(abs_top_builddir)/netx
+	$(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g \
+	    -d $(abs_top_builddir)/netx \
+            -source 1.5 \
+	    -classpath $(abs_top_builddir)/lib/hotspot-tools \
+	    -sourcepath $(abs_top_srcdir)/netx:$(SOURCEPATH_DIRS): \
+	    -bootclasspath \'\' \
+	    @netx-source-files.txt ;
+	mkdir -p $(abs_top_builddir)/stamps
+	touch stamps/netx.stamp
+
+stamps/netx-dist.stamp: stamps/netx.stamp
+	(cd $(abs_top_builddir)/netx ; \
+	 mkdir -p lib ; \
+	 $(ICEDTEA_BOOT_DIR)/bin/jar cf lib/classes.jar javax/jnlp net ; \
+	 cd $(abs_top_srcdir)/netx ; \
+	 $(ICEDTEA_BOOT_DIR)/bin/jar uf $(abs_top_builddir)/netx/lib/classes.jar \
+	  `find . -type f -not -name '*.java'` ; \
+	 $(ZIP) -qr $(abs_top_builddir)/netx/lib/src.zip javax net )
+	mkdir -p stamps
+	touch stamps/netx-dist.stamp
+
+stamps/liveconnect.stamp: stamps/hotspot-tools.stamp
+	if test "x${LIVECONNECT_DIR}" != x; then \
+	  $(ICEDTEA_BOOT_DIR)/bin/jar cf lib/classes.jar $(LIVECONNECT_DIR) ; \
+	fi
+	mkdir -p stamps
+	touch stamps/liveconnect.stamp
+
 stamps/jibx.stamp:
 if ENABLE_NIMBUS
 if ENABLE_NIMBUS_GENERATION
@@ -3270,7 +3317,7 @@
 	mkdir -p stamps
 	touch stamps/pulse-java-jar.stamp
 
-stamps/pulse-java-class.stamp: 
+stamps/pulse-java-class.stamp: $(INITIAL_BOOTSTRAP_LINK_STAMP)
 if ENABLE_PULSE_JAVA
 	mkdir -p $(PULSE_JAVA_CLASS_DIR)
 	if ! test -d $(ICEDTEA_BOOT_DIR) ; \
@@ -3677,3 +3724,9 @@
 clean: distclean-local
 
 jtreg: stamps/jtreg.stamp
+
+netx: stamps/netx.stamp
+
+netx-dist: stamps/netx-dist.stamp
+
+liveconnect: stamps/liveconnect.stamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/BasicService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,13 @@
+
+
+package javax.jnlp;
+
+public interface BasicService {
+
+  public java.net.URL getCodeBase();
+  public boolean isOffline();
+  public boolean showDocument(java.net.URL url);
+  public boolean isWebBrowserSupported();
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/ClipboardService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,11 @@
+
+
+package javax.jnlp;
+
+public interface ClipboardService {
+
+  public java.awt.datatransfer.Transferable getContents();
+  public void setContents(java.awt.datatransfer.Transferable contents);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/DownloadService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,25 @@
+
+
+package javax.jnlp;
+
+public interface DownloadService {
+
+  public boolean isResourceCached(java.net.URL ref, java.lang.String version);
+  public boolean isPartCached(java.lang.String part);
+  public boolean isPartCached(java.lang.String[] parts);
+  public boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String part);
+  public boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String[] parts);
+  public void loadResource(java.net.URL ref, java.lang.String version, DownloadServiceListener progress) throws java.io.IOException;
+  public void loadPart(java.lang.String part, DownloadServiceListener progress) throws java.io.IOException;
+  public void loadPart(java.lang.String[] parts, DownloadServiceListener progress) throws java.io.IOException;
+  public void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part, DownloadServiceListener progress) throws java.io.IOException;
+  public void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts, DownloadServiceListener progress) throws java.io.IOException;
+  public void removeResource(java.net.URL ref, java.lang.String version) throws java.io.IOException;
+  public void removePart(java.lang.String part) throws java.io.IOException;
+  public void removePart(java.lang.String[] parts) throws java.io.IOException;
+  public void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part) throws java.io.IOException;
+  public void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts) throws java.io.IOException;
+  public DownloadServiceListener getDefaultProgressWindow();
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/DownloadServiceListener.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,13 @@
+
+
+package javax.jnlp;
+
+public interface DownloadServiceListener {
+
+  public void progress(java.net.URL url, java.lang.String version, long readSoFar, long total, int overallPercent);
+  public void validating(java.net.URL url, java.lang.String version, long entry, long total, int overallPercent);
+  public void upgradingArchive(java.net.URL url, java.lang.String version, int patchPercent, int overallPercent);
+  public void downloadFailed(java.net.URL url, java.lang.String version);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/ExtensionInstallerService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,22 @@
+
+
+package javax.jnlp;
+
+public interface ExtensionInstallerService {
+
+  public java.lang.String getInstallPath();
+  public java.lang.String getExtensionVersion();
+  public java.net.URL getExtensionLocation();
+  public void hideProgressBar();
+  public void hideStatusWindow();
+  public void setHeading(java.lang.String heading);
+  public void setStatus(java.lang.String status);
+  public void updateProgress(int value);
+  public void installSucceeded(boolean needsReboot);
+  public void installFailed();
+  public void setJREInfo(java.lang.String platformVersion, java.lang.String jrePath);
+  public void setNativeLibraryInfo(java.lang.String path);
+  public java.lang.String getInstalledJRE(java.net.URL url, java.lang.String version);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/FileContents.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,18 @@
+
+
+package javax.jnlp;
+
+public interface FileContents {
+
+  public java.lang.String getName() throws java.io.IOException;
+  public java.io.InputStream getInputStream() throws java.io.IOException;
+  public java.io.OutputStream getOutputStream(boolean overwrite) throws java.io.IOException;
+  public long getLength() throws java.io.IOException;
+  public boolean canRead() throws java.io.IOException;
+  public boolean canWrite() throws java.io.IOException;
+  public JNLPRandomAccessFile getRandomAccessFile(java.lang.String mode) throws java.io.IOException;
+  public long getMaxLength() throws java.io.IOException;
+  public long setMaxLength(long maxlength) throws java.io.IOException;
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/FileOpenService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,11 @@
+
+
+package javax.jnlp;
+
+public interface FileOpenService {
+
+  public FileContents openFileDialog(java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException;
+  public FileContents[] openMultiFileDialog(java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException;
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/FileSaveService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,11 @@
+
+
+package javax.jnlp;
+
+public interface FileSaveService {
+
+  public FileContents saveFileDialog(java.lang.String pathHint, java.lang.String[] extensions, java.io.InputStream stream, java.lang.String name) throws java.io.IOException;
+  public FileContents saveAsFileDialog(java.lang.String pathHint, java.lang.String[] extensions, FileContents contents) throws java.io.IOException;
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/JNLPRandomAccessFile.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,46 @@
+
+
+package javax.jnlp;
+
+public interface JNLPRandomAccessFile {
+
+  public void close() throws java.io.IOException;
+  public long length() throws java.io.IOException;
+  public long getFilePointer() throws java.io.IOException;
+  public int read() throws java.io.IOException;
+  public int read(byte[] b, int off, int len) throws java.io.IOException;
+  public int read(byte[] b) throws java.io.IOException;
+  public void readFully(byte[] b) throws java.io.IOException;
+  public void readFully(byte[] b, int off, int len) throws java.io.IOException;
+  public int skipBytes(int n) throws java.io.IOException;
+  public boolean readBoolean() throws java.io.IOException;
+  public byte readByte() throws java.io.IOException;
+  public int readUnsignedByte() throws java.io.IOException;
+  public short readShort() throws java.io.IOException;
+  public int readUnsignedShort() throws java.io.IOException;
+  public char readChar() throws java.io.IOException;
+  public int readInt() throws java.io.IOException;
+  public long readLong() throws java.io.IOException;
+  public float readFloat() throws java.io.IOException;
+  public double readDouble() throws java.io.IOException;
+  public java.lang.String readLine() throws java.io.IOException;
+  public java.lang.String readUTF() throws java.io.IOException;
+  public void seek(long pos) throws java.io.IOException;
+  public void setLength(long newLength) throws java.io.IOException;
+  public void write(int b) throws java.io.IOException;
+  public void write(byte[] b) throws java.io.IOException;
+  public void write(byte[] b, int off, int len) throws java.io.IOException;
+  public void writeBoolean(boolean v) throws java.io.IOException;
+  public void writeByte(int v) throws java.io.IOException;
+  public void writeShort(int v) throws java.io.IOException;
+  public void writeChar(int v) throws java.io.IOException;
+  public void writeInt(int v) throws java.io.IOException;
+  public void writeLong(long v) throws java.io.IOException;
+  public void writeFloat(float v) throws java.io.IOException;
+  public void writeDouble(double v) throws java.io.IOException;
+  public void writeBytes(java.lang.String s) throws java.io.IOException;
+  public void writeChars(java.lang.String s) throws java.io.IOException;
+  public void writeUTF(java.lang.String str) throws java.io.IOException;
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/PersistenceService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,18 @@
+
+package javax.jnlp;
+
+public interface PersistenceService {
+
+  public static final int CACHED = 0;
+  public static final int TEMPORARY = 1;
+  public static final int DIRTY = 2;
+
+  public long create(java.net.URL url, long maxsize) throws java.net.MalformedURLException, java.io.IOException;
+  public FileContents get(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException, java.io.FileNotFoundException;
+  public void delete(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
+  public java.lang.String[] getNames(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
+  public int getTag(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
+  public void setTag(java.net.URL url, int tag) throws java.net.MalformedURLException, java.io.IOException;
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/PrintService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,13 @@
+
+
+package javax.jnlp;
+
+public interface PrintService {
+
+  public java.awt.print.PageFormat getDefaultPage();
+  public java.awt.print.PageFormat showPageFormatDialog(java.awt.print.PageFormat page);
+  public boolean print(java.awt.print.Pageable document);
+  public boolean print(java.awt.print.Printable painter);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/ServiceManager.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,54 @@
+
+
+
+package javax.jnlp;
+
+import java.util.*;
+
+
+public final class ServiceManager {
+
+  private static ServiceManagerStub stub = null;
+
+  private static Map lookupTable = new HashMap(); // ensure lookup is idempotent
+
+  private ServiceManager() {
+    // says it can't be instantiated
+  }
+
+
+  public static java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException {
+    if (stub == null)
+      throw new UnavailableServiceException("service stub not set.");
+
+    synchronized(lookupTable) {
+      Object result = lookupTable.get(name);
+
+      if (result == null) {
+        result = stub.lookup(name);
+        if (result != null)
+          lookupTable.put(name, result);
+      }
+
+      if (result == null)
+        throw new UnavailableServiceException("service not available (stub returned null).");
+
+      return result;
+    }
+  }
+
+  public static java.lang.String[] getServiceNames() {
+    // should this return the required ones even though no stub??
+    if (stub == null)
+      return new String[0];
+
+    return stub.getServiceNames();
+  }
+
+  public static void setServiceManagerStub(ServiceManagerStub stub) {
+    if (ServiceManager.stub == null)
+      ServiceManager.stub = stub;
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/ServiceManagerStub.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,11 @@
+
+
+package javax.jnlp;
+
+public interface ServiceManagerStub {
+
+  public java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException;
+  public java.lang.String[] getServiceNames();
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/UnavailableServiceException.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,16 @@
+
+
+package javax.jnlp;
+
+public class UnavailableServiceException extends Exception {
+
+  public UnavailableServiceException() {
+    super();
+  }
+
+  public UnavailableServiceException(java.lang.String message) {
+    super(message);
+  }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/AppletDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,125 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The applet-desc element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.8 $
+ */
+public class AppletDesc {
+
+    /** the applet name */
+    private String name;
+
+    /** the main class name and package */
+    private String mainClass;
+
+    /** the document base */
+    private URL documentBase;
+
+    /** the width */
+    private int width;
+
+    /** the height */
+    private int height;
+
+    /** the parameters */
+    private Map parameters;
+
+
+    /**
+     * Create an Applet descriptor.
+     * 
+     * @param name the applet name
+     * @param mainClass the main class name and package
+     * @param documentBase the document base
+     * @param width the width
+     * @param height the height
+     * @param parameters the parameters
+     */
+    public AppletDesc(String name, String mainClass, URL documentBase, int width, int height, Map parameters) {
+        this.name = name;
+        this.mainClass = mainClass;
+        this.documentBase = documentBase;
+        this.width = width;
+        this.height = height;
+        this.parameters = new HashMap(parameters);
+    }
+
+    /**
+     * Returns the applet name 
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the main class name 
+     */
+    public String getMainClass() {
+        return mainClass;
+    }
+
+    /**
+     * Returns the document base 
+     */
+    public URL getDocumentBase() {
+        return documentBase;
+    }
+
+    /**
+     * Returns the width 
+     */
+    public int getWidth() {
+        return width;
+    }
+
+    /** 
+     * Returns the height 
+     */
+    public int getHeight() {
+        return height;
+    }
+
+    /** 
+     * Returns the applet parameters 
+     */
+    public Map getParameters() {
+        return new HashMap(parameters);
+    }
+
+    /**
+     * Adds a parameter to the applet.  If the parameter already
+     * exists then it is overwritten with the new value.  Adding a
+     * parameter will have no effect on already-running applets
+     * launched from this JNLP file.
+     */
+    public void addParameter(String name, String value) {
+        parameters.put(name, value);
+    }
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ApplicationDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,76 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The application-desc element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $
+ */
+public class ApplicationDesc {
+
+    /** the main class name and package */
+    private String mainClass;
+
+    /** the arguments */
+    private String arguments[];
+
+
+    /**
+     * Create an Application descriptor.
+     * 
+     * @param mainClass the main class name and package
+     * @param arguments the arguments
+     */
+    public ApplicationDesc(String mainClass, String arguments[]) {
+        this.mainClass = mainClass;
+        this.arguments = arguments;
+    }
+
+    /**
+     * Returns the main class name 
+     */
+    public String getMainClass() {
+        return mainClass;
+    }
+
+    /** 
+     * Returns the arguments
+     */
+    public String[] getArguments() {
+        return (String[]) arguments.clone();
+    }
+
+    /**
+     * Add an argument to the end of the arguments.
+     */
+    public void addArgument(String arg) {
+        ArrayList l = new ArrayList(Arrays.asList(arguments));
+        l.add(arg);
+
+        arguments = (String[]) l.toArray(arguments);
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ComponentDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,43 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The component-desc element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $
+ */
+public class ComponentDesc {
+
+    // this is for completeness and in case of changes to spec for components.
+
+    /**
+     * Create a component descriptor.
+     */
+    public ComponentDesc() {
+    }
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/DefaultLaunchHandler.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,114 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp;
+
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+
+
+/**
+ * This default implementation shows prints the exception to
+ * stdout and if not in headless mode displays the exception in a
+ * dialog.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.1 $
+ */
+public class DefaultLaunchHandler implements LaunchHandler {
+
+    /**
+     * Called when the application could not be launched due to a
+     * fatal error, such as the inability to find the main class
+     * or non-parseable XML.
+     */
+    public void launchError(LaunchException exception) {
+        printMessage(exception);
+    }
+
+    /**
+     * Called when launching the application can not be launched
+     * due to an error that is not fatal.  For example a JNLP file
+     * that is not strictly correct yet does not necessarily
+     * prohibit the system from attempting to launch the
+     * application.
+     *
+     * @return true if the launch should continue, false to abort
+     */
+    public boolean launchWarning(LaunchException warning) {
+        printMessage(warning);
+        return true;
+    }
+
+    /**
+     * Called when a security validation error occurs while
+     * launching the application.
+     *
+     * @return true to allow the application to continue, false to stop it.
+     */
+    public boolean validationError(LaunchException security) {
+        printMessage(security);
+        return true;
+    }
+
+    /**
+     * Called when an application, applet, or installer has been
+     * launched successfully (the main method or applet start method
+     * returned normally).
+     *
+     * @param application the launched application instance
+     */
+    public void launchCompleted(ApplicationInstance application) {
+        //
+    }
+
+    /**
+     * Print a message to stdout.
+     */
+    protected void printMessage(LaunchException ex) {
+        StringBuffer result = new StringBuffer();
+        result.append("netx: ");
+        result.append(ex.getCategory());
+        if (ex.getSummary() != null) {
+            result.append(": ");
+            result.append(ex.getSummary());
+        }
+
+        if (JNLPRuntime.isDebug()) {
+            if (ex.getCause() != null)
+                ex.getCause().printStackTrace();
+            else
+                ex.printStackTrace();
+        }
+
+        Throwable causes[] = ex.getCauses();
+
+        for (int i=0; i < causes.length; i++) {
+            result.append(" (");
+            result.append(causes[i].getClass().getName());
+            result.append(" ");
+            result.append(causes[i].getMessage());
+            result.append(")");
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ExtensionDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,157 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+
+/**
+ * The extension element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.8 $
+ */
+public class ExtensionDesc {
+
+    /** the extension name */
+    private String name;
+
+    /** the required extension version */
+    private Version version;
+
+    /** the location of the extension JNLP file */
+    private URL location;
+    
+    /** the cookie string sent with resource requests */
+    private String cookieStr;
+
+    /** the JNLPFile the extension refers to */
+    private JNLPFile file;
+
+    /** map from ext-part to local part */
+    private Map extToPart = new HashMap();
+
+    /** eager ext parts */ 
+    private List eagerExtParts = new ArrayList();
+
+
+    /**
+     * Create an extention descriptor.
+     *
+     * @param name the extension name
+     * @param version the required version of the extention JNLPFile
+     * @param location the location of the extention JNLP file
+     */
+    public ExtensionDesc(String name, Version version, URL location, String cookieStr) {
+        this.name = name;
+        this.version = version;
+        this.location = location;
+        this.cookieStr = cookieStr;
+    }
+
+    /**
+     * Adds an extension part to be downloaded when the specified
+     * part of the main JNLP file is loaded.  The extension part
+     * will be downloaded before the application is launched if the
+     * lazy value is false or the part is empty or null.
+     *
+     * @param extPart the part name in the extension file
+     * @param part the part name in the main file
+     * @param lazy whether to load the part before launching
+     */
+    protected void addPart(String extPart, String part, boolean lazy) {
+        extToPart.put(extPart, part);
+
+        if (!lazy || part == null || part.length() == 0)
+            eagerExtParts.add(extPart);
+    }
+
+    /**
+     * Returns the parts in the extension JNLP file mapped to the
+     * part of the main file.
+     */
+    public String[] getExtensionParts(String thisPart) {
+
+        return null;
+    }
+
+    /**
+     * Returns the name of the extension.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the required version of the extension JNLP file.
+     */
+    public Version getVersion() {
+        return version;
+    }
+
+    /**
+     * Returns the location of the extension JNLP file.
+     */
+    public URL getLocation() {
+        return location;
+    }
+
+    /**
+     * Resolves the extension by creating a JNLPFile from the file
+     * specified by the extension's location property.
+     *
+     * @throws IOException if the extension JNLPFile could not be resolved.
+     * @throws ParseException if the extension JNLPFile could not be
+     * parsed or was not a component or installer descriptor.
+     */
+    public void resolve() throws ParseException, IOException {
+        if (file == null) {
+            file = new JNLPFile(location, cookieStr);
+
+            if (JNLPRuntime.isDebug())
+                System.out.println("Resolve: "+file.getInformation().getTitle());
+
+            // check for it being an extension descriptor
+            if (!file.isComponent() && !file.isInstaller())
+                throw new ParseException(JNLPRuntime.getMessage("JInvalidExtensionDescriptor", new Object[] {name, location} ));
+        }
+
+    }
+
+    /**
+     * Returns a JNLPFile for the extension, or null if the JNLP
+     * file has not been resolved.
+     */
+    public JNLPFile getJNLPFile() {
+        return file;
+    }
+    
+    /**
+     * Returns the cookie associated with this instance
+     */
+    public String getCookieStr() {
+        return cookieStr;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/IconDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,135 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The icon element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.8 $
+ */
+public class IconDesc {
+
+    /** default icon */
+    public static final Object DEFAULT = "default";
+
+    /** selected icon */
+    public static final Object SELECTED = "selected";
+
+    /** disabled icon */
+    public static final Object DISABLED = "disabled";
+
+    /** rollover icon */
+    public static final Object ROLLOVER = "rollover";
+
+    /** splash icon */
+    public static final Object SPLASH = "splash";
+
+
+    /** the location of the icon */
+    private URL location;
+
+    /** the type of icon*/
+    private Object kind;
+
+    /** the width, or -1 if unknown*/
+    private int width;
+
+    /** the height, or -1 if unknown*/
+    private int height;
+
+    /** the depth, or -1 if unknown*/
+    private int depth;
+
+    /** the size, or -1 if unknown*/
+    private int size;
+
+
+    /**
+     * Creates an icon descriptor with the specified information.
+     *
+     * @param location the location of the icon 
+     * @param kind the type of icon
+     * @param width the width, or -1 if unknown
+     * @param height the height, or -1 if unknown
+     * @param depth the depth, or -1 if unknown
+     * @param size the size, or -1 if unknown
+     */
+    IconDesc(URL location, Object kind, int width, int height, int depth, int size) {
+        this.location = location;
+        this.kind = kind;
+        this.width = width;
+        this.height = height;
+        this.depth = depth;
+        this.size = size;
+    }
+
+    /**
+     * Returns the location of the icon.
+     */
+    public URL getLocation() { 
+        return location; 
+    }
+
+    /**
+     * Returns the icon type.
+     */
+    public Object getKind() { 
+        return kind; 
+    }
+
+    /**
+     * Returns the icon width or -1 if not specified in the
+     * JNLPFile.
+     */
+    public int getWidth() { 
+        return width; 
+    }
+
+    /**
+     * Returns the icon height or -1 if not specified in the
+     * JNLPFile.
+     */
+    public int getHeight() { 
+        return height; 
+    }
+
+    /**
+     * Returns the icon size or -1 if not specified in the JNLPFile.
+     */
+    public int getSize() { 
+        return size; 
+    }
+
+    /**
+     * Returns the icon depth or -1 if not specified in the
+     * JNLPFile.
+     */
+    public int getDepth() { 
+        return depth; 
+    }
+
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/InformationDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,241 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.awt.Dimension;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The information element.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.9 $
+ */
+public class InformationDesc {
+
+    // There is an understanding between this class and the parser
+    // that description and icon types are keyed by "icon-"+kind and
+    // "description-"+kind, and that other types are keyed by their
+    // specification name.
+
+    /** one-line description */
+    public static final Object ONE_LINE= "oneline";
+
+    /** short description */
+    public static final Object SHORT= "short";
+
+    /** tooltip description */
+    public static final Object TOOLTIP= "tooltip";
+
+    /** default description */
+    public static final Object DEFAULT = "default";
+
+    /** the locales for the information */
+    private Locale locales[];
+
+    /** the data as list of key,value pairs */
+    private List info;
+
+    /** the JNLPFile this information is for */
+    private JNLPFile jnlpFile;
+
+
+    /**
+     * Create an information element object.
+     *
+     * @param jnlpFile file that the information is for
+     * @param locale the the information is for
+     */
+    public InformationDesc(JNLPFile jnlpFile, Locale locales[]) {
+        this.jnlpFile = jnlpFile;
+        this.locales = locales;
+    }
+
+    /**
+     * Returns the application's title.
+     */
+    public String getTitle() {
+        return (String) getItem("title");
+    }
+
+    /**
+     * Returns the application's vendor.
+     */
+    public String getVendor() {
+        return (String) getItem("vendor");
+    }
+
+    /**
+     * Returns the application's homepage.
+     */
+    public URL getHomepage() {
+        return (URL)getItem("homepage");
+    }
+
+    /**
+     * Returns the default description for the application.
+     */
+    public String getDescription() {
+        String result = getDescription(DEFAULT);
+
+        // try to find any description if default is null
+        if (result == null)
+            result = getDescription(ONE_LINE);
+        if (result == null)
+            result = getDescription(SHORT);
+        if (result == null)
+            result = getDescription(TOOLTIP);
+
+        return result;
+    }
+
+    /**
+     * Returns the application's description of the specified type.
+     *
+     * @param kind one of Information.SHORT, Information.ONE_LINE,
+     * Information.TOOLTIP, Information.DEFAULT
+     */
+    public String getDescription(Object kind) {
+        String result = (String) getItem("description-"+kind);
+        if (result == null)
+            return (String) getItem("description-"+DEFAULT);
+        else
+            return result;
+    }
+
+    /**
+     * Returns the icons specified by the JNLP file.
+     *
+     * @param kind one of IconDesc.SELECTED, IconDesc.DISABLED,
+     * IconDesc.ROLLOVER, IconDesc.SPLASH, IconDesc.DEFAULT
+     * @return an array of zero of more IconDescs of the specified icon type
+     */
+    public IconDesc[] getIcons(Object kind) {
+        List icons = getItems("icon-"+kind);
+
+        return (IconDesc[]) icons.toArray(new IconDesc[icons.size()]);
+    };
+
+    /**
+     * Returns the URL of the icon closest to the specified size and
+     * kind.  This method will not return an icon smaller than the
+     * specified width and height unless there are no other icons
+     * available.
+     *
+     * @param kind the kind of icon to get
+     * @param width desired width of icon
+     * @param height desired height of icon
+     * @return the closest icon by size or null if no icons declared
+     */
+    public URL getIconLocation(Object kind, int width, int height) {
+        IconDesc icons[] = getIcons(kind);
+        if (icons.length == 0)
+            return null;
+
+        IconDesc best = null;
+        for (int i=0; i < icons.length; i++) {
+            if (icons[i].getWidth() >= width &&
+                icons[i].getHeight() >= height) {
+                if (best == null)
+                    best = icons[i];
+
+                if (icons[i].getWidth() <= best.getWidth() && // Use <= so last specified of
+                    icons[i].getHeight() <= best.getHeight()) // equivalent icons is chosen.
+                    best = icons[i];
+            }
+        }
+
+        if (best == null)
+            best = icons[0];
+
+        return best.getLocation();
+    }
+
+    /**
+     * Returns the locales for the information.
+     */
+    public Locale[] getLocales() {
+        return locales;
+    }
+
+    /**
+     * Returns the JNLPFile the information is for.
+     */
+    public JNLPFile getJNLPFile() {
+        return jnlpFile;
+    }
+
+    /**
+     * Returns whether offline execution allowed.
+     */
+    public boolean isOfflineAllowed() {
+        return null != getItem("offline-allowed");
+    }
+
+    /**
+     * Returns whether the resources specified in the JNLP file may
+     * be shared by more than one instance in the same JVM
+     * (JNLP extension).  This is an extension to the JNLP spec and
+     * will always return false for standard JNLP files.
+     */
+    public boolean isSharingAllowed() {
+        return null != getItem("sharing-allowed");
+    }
+
+    /**
+     * Returns the last item matching the specified key.
+     */
+    protected Object getItem(Object key) {
+        List items = getItems(key);
+        if (items.size() == 0)
+            return null;
+        else
+            return items.get( items.size()-1 );
+    }
+
+    /**
+     * Returns all items matching the specified key.
+     */
+    protected List getItems(Object key) {
+        if (info == null)
+            return Collections.EMPTY_LIST;
+
+        List result = new ArrayList();
+        for (int i=0; i < info.size(); i+=2)
+            if (info.get(i).equals(key))
+                result.add( info.get(i+1) );
+
+        return result;
+    }
+
+    /**
+     * Add an information item (description, icon, etc) under a
+     * specified key name.
+     */
+    protected void addItem(String key, Object value) {
+        if (info == null)
+            info = new ArrayList();
+
+        info.add(key);
+        info.add(value);
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/InstallerDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,54 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The installer-desc element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $
+ */
+public class InstallerDesc {
+
+    /** the main class name and package. */
+    private String mainClass;
+
+
+    /**
+     * Creates a installer descriptor.
+     *
+     * @param mainClass main class name and package
+     */
+    public InstallerDesc(String mainClass) {
+        this.mainClass = mainClass;
+    }
+
+    /**
+     * Returns the main class name and package.
+     */
+    public String getMainClass() {
+        return mainClass;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/JARDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,144 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The JAR element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $
+ */
+public class JARDesc {
+
+    /** the location of the JAR file */
+    private URL location;
+
+    /** the required JAR versions, or null */
+    private Version version;
+
+    /** the part name */
+    private String part;
+
+    /** whether to load the JAR on demand */
+    private boolean lazy;
+
+    /** whether the JAR contains the main class */
+    private boolean main;
+
+    /** whether the JAR contains native libraries */
+    private boolean nativeJar;
+    
+    /** whether the JAR can be cached */
+    private boolean cacheable;
+
+    /**
+     * Create a JAR descriptor.
+     *
+     * @param location the location of the JAR file
+     * @param version the required JAR versions, or null
+     * @param part the part name, or null
+     * @param lazy whether to load the JAR on demand
+     * @param main whether the JAR contains the main class
+     * @param nativeJam whether the JAR contains native libraries
+     */
+    public JARDesc(URL location, Version version, String part, boolean lazy, boolean main, boolean nativeJar, boolean cacheable) {
+        this.location = location;
+        this.version = version;
+        this.part = part;
+        this.lazy = lazy;
+        this.main = main;
+        this.nativeJar = nativeJar;
+        this.cacheable = cacheable;
+    }
+
+    /**
+     * Returns the URL of the JAR file.
+     */
+    public URL getLocation() {
+        return location;
+    }
+
+    /**
+     * Returns the required version of the JAR file.
+     */
+    public Version getVersion() {
+        return version;
+    }
+
+    /**
+     * Returns the part name, or null if not specified in the JNLP
+     * file.
+     */
+    public String getPart() {
+        return part;
+    }
+
+    /**
+     * Returns true if the JAR file contains native code
+     * libraries.
+     */
+    public boolean isNative() {
+        return nativeJar;
+    }
+
+    // these both are included in case the spec adds a new value,
+    // where !lazy would no longer imply eager.
+
+    /**
+     * Returns true if the JAR file should be downloaded before
+     * starting the application.
+     */
+    public boolean isEager() {
+        return !lazy;
+    }
+
+    /**
+     * Returns true if the JAR file should be downloaded on demand.
+     */
+    public boolean isLazy() {
+        return lazy;
+    }
+
+    /**
+     * Returns true if the JNLP file defined this JAR as containing
+     * the main class.  If no JARs were defined as the main JAR then
+     * the first JAR should be used to locate the main class.
+     *
+     * @see ResourcesDesc#getMainJAR
+     */
+    public boolean isMain() {
+        return main;
+    }
+    
+    /**
+     * Returns if this jar is cacheable
+     * 
+     * @return Whether or not this jar is cacheable
+     */
+    public boolean isCacheable() {
+        return cacheable;
+    }
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/JNLPFile.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,523 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * Provides methods to access the information in a Java Network
+ * Launching Protocol (JNLP) file.  The Java Network Launching
+ * Protocol specifies in an XML file the information needed to
+ * load, cache, and run Java code over the network and in a secure
+ * environment.<p>
+ *
+ * This class represents the overall information about a JNLP file
+ * from the jnlp element.  Other information is accessed through
+ * objects that represent the elements of a JNLP file
+ * (information, resources, application-desc, etc).  References to
+ * these objects are obtained by calling the getInformation,
+ * getResources, getSecurity, etc methods.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.21 $ 
+ */
+public class JNLPFile {
+
+    // todo: save the update policy, then if file was not updated
+    // then do not check resources for being updated.
+    //
+    // todo: make getLaunchInfo return a superclass that all the
+    // launch types implement (can get codebase from it).
+    //
+    // todo: currently does not filter resources by jvm version.
+    //
+    
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+
+    /** the location this JNLP file was created from */
+    protected URL sourceLocation = null;
+
+    /** the network location of this JNLP file */
+    protected URL fileLocation;
+
+    /** the URL used to resolve relative URLs in the file */
+    protected URL codeBase;
+    
+    /** cookie string to send alongwith resource requests */
+    protected String cookieStr;
+
+    /** file version */
+    protected Version fileVersion;
+
+    /** spec version */
+    protected Version specVersion;
+
+    /** information */
+    protected List info;
+
+    /** resources */
+    protected List resources;
+
+    /** additional resources not in JNLP file (from command line) */
+    protected ResourcesDesc sharedResources = new ResourcesDesc(this, null, null, null);
+
+    /** the application description */
+    protected Object launchType;
+
+    /** the security descriptor */
+    protected SecurityDesc security;
+
+    /** the default OS */
+    protected Locale defaultLocale = null;
+
+    /** the default arch */
+    protected String defaultOS = null;
+
+    /** the default jvm */
+    protected String defaultArch = null;
+
+    { // initialize defaults if security allows
+        try {
+            defaultLocale = Locale.getDefault();
+            defaultOS = System.getProperty("os.name");
+            defaultArch = System.getProperty("os.arch");
+        }
+        catch (SecurityException ex) {
+            // null values will still work, and app can set defaults later
+        }
+    }
+    
+    /**
+     * Empty stub, allowing child classes to override the constructor
+     */
+    protected JNLPFile() {
+    }
+
+    /**
+     * Create a JNLPFile from a URL.
+     *
+     * @param location the location of the JNLP file
+     * @throws IOException if an IO exception occurred
+     * @throws ParseException if the JNLP file was invalid
+     */
+    public JNLPFile(URL location, String cookieStr) throws IOException, ParseException {
+        this(location, cookieStr, false); // not strict
+    }
+
+    /**
+     * Create a JNLPFile from a URL checking for updates using the
+     * default policy.
+     *
+     * @param location the location of the JNLP file
+     * @param strict whether to enforce the spec when 
+     * @throws IOException if an IO exception occurred
+     * @throws ParseException if the JNLP file was invalid
+     */
+    public JNLPFile(URL location, String cookieStr, boolean strict) throws IOException, ParseException {
+        this(location, cookieStr, strict, JNLPRuntime.getDefaultUpdatePolicy());
+    }
+
+    /**
+     * Create a JNLPFile from a URL checking for updates using the
+     * specified policy.
+     *
+     * @param location the location of the JNLP file
+     * @param strict whether to enforce the spec when 
+     * @param policy the update policy
+     * @throws IOException if an IO exception occurred
+     * @throws ParseException if the JNLP file was invalid
+     */
+    public JNLPFile(URL location, String cookieStr, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
+        Node root = Parser.getRootNode(openURL(location, cookieStr, policy));
+        parse(root, strict, location);
+
+        this.fileLocation = location;
+        this.cookieStr = cookieStr;
+    }
+
+    /**
+     * Create a JNLPFile from an input stream.
+     *
+     * @throws IOException if an IO exception occurred
+     * @throws ParseException if the JNLP file was invalid
+     */
+    public JNLPFile(InputStream input, boolean strict) throws ParseException {
+        parse(Parser.getRootNode(input), strict, null);
+    }
+
+    /**
+     * Create a JNLPFile from a character stream.
+     *
+     * @param input the stream
+     * @param strict whether to enforce the spec when 
+     * @throws IOException if an IO exception occurred
+     * @throws ParseException if the JNLP file was invalid
+     */
+    private JNLPFile(Reader input, boolean strict) throws ParseException {
+        // todo: now that we are using NanoXML we can use a Reader
+        //parse(Parser.getRootNode(input), strict, null);
+    }
+
+
+    /**
+     * Open the jnlp file URL from the cache if there, otherwise
+     * download to the cache.  Called from constructor.
+     */
+    private static InputStream openURL(URL location, String cookieStr, UpdatePolicy policy) throws IOException {
+        if (location == null || policy == null)
+            throw new IllegalArgumentException(R("NullParameter"));
+
+        try {
+            ResourceTracker tracker = new ResourceTracker(false); // no prefetch
+            tracker.addResource(location, cookieStr, null/*version*/, policy);
+
+            return tracker.getInputStream(location);
+        }
+        catch (Exception ex) {
+            throw new IOException(ex.getMessage());
+        }
+    }
+
+    /**
+     * Returns the JNLP specification versions supported.
+     */
+    public static Version getSupportedVersions() {
+        return Parser.getSupportedVersions();
+    }
+
+    /**
+     * Returns the JNLP file's title.  This method returns the same
+     * value as InformationDesc.getTitle().
+     */
+    public String getTitle() {
+        return getInformation().getTitle();
+    }
+
+    /**
+     * Returns the JNLP file's network location as specified in the
+     * JNLP file.
+     */
+    public URL getSourceLocation() {
+        return sourceLocation;
+    }
+
+    /**
+     * Returns the location of the file parsed to create the JNLP
+     * file, or null if it was not created from a URL.
+     */
+    public URL getFileLocation() {
+        return fileLocation;
+    }
+
+    /**
+     * Returns the JNLP file's version.
+     */
+    public Version getFileVersion() {
+        return fileVersion;
+    }
+
+    /**
+     * Returns the specification version required by the file.
+     */
+    public Version getSpecVersion() {
+        return specVersion;
+    }
+
+    /**
+     * Returns the codebase URL for the JNLP file.
+     */
+    public URL getCodeBase() {
+        return codeBase;
+    }
+
+    /**
+     * Returns the cookie string that will be send when resources for this file are requested 
+     */
+    public String getCookieStr() {
+        return cookieStr;
+    }
+    
+    /**
+     * Returns the information section of the JNLP file as viewed
+     * through the default locale.
+     */
+    public InformationDesc getInformation() {
+        return getInformation(defaultLocale);
+    }
+
+    /**
+     * Returns the information section of the JNLP file as viewed
+     * through the specified locale.
+     */
+    public InformationDesc getInformation(final Locale locale) {
+        return new InformationDesc(this, new Locale[] {locale}) {
+            protected List getItems(Object key) {
+                List result = new ArrayList();
+
+                for (int i=0; i < info.size(); i++) {
+                    InformationDesc infoDesc = (InformationDesc) info.get(i);
+
+                    if (localMatches(locale, infoDesc.getLocales()))
+                        if (localMatches(locale, infoDesc.getLocales()))
+                            result.addAll(infoDesc.getItems(key) );
+                }
+
+                return result;
+            }
+        };
+    }
+
+    /**
+     * Returns the security section of the JNLP file.
+     */
+    public SecurityDesc getSecurity() {
+        return security;
+    }
+
+    /**
+     * Returns the resources section of the JNLP file as viewed
+     * through the default locale and the os.name and os.arch
+     * properties.
+     */
+    public ResourcesDesc getResources() {
+        return getResources(defaultLocale, defaultOS, defaultArch);
+    }
+
+    /**
+     * Returns the information section of the JNLP file for the
+     * specified locale, os, and arch.
+     */
+    public ResourcesDesc getResources(final Locale locale, final String os, final String arch) {
+        return new ResourcesDesc(this, new Locale[] {locale}, new String[] {os}, new String[] {arch}) {
+            public List getResources(Class launchType) {
+                List result = new ArrayList();
+
+                for (int i=0; i < resources.size(); i++) {
+                    ResourcesDesc rescDesc = (ResourcesDesc) resources.get(i);
+
+                    if (localMatches(locale, rescDesc.getLocales())
+                        && stringMatches(os, rescDesc.getOS())
+                        && stringMatches(arch, rescDesc.getArch()))
+                        result.addAll(rescDesc.getResources(launchType) );
+                }
+
+                result.addAll(sharedResources.getResources(launchType));
+
+                return result;
+            }
+
+            public void addResource(Object resource) {
+                // todo: honor the current locale, os, arch values
+                sharedResources.addResource(resource);
+            }
+        };
+    }
+
+    /**
+     * Returns an object of one of the following types: AppletDesc,
+     * ApplicationDesc, InstallerDesc, and ComponentDesc.
+     */
+    public Object getLaunchInfo() {
+        return launchType;
+    }
+
+    /**
+     * Returns the launch information for an applet.
+     *
+     * @throws UnsupportedOperationException if there is no applet information
+     */
+    public AppletDesc getApplet() {
+        if (!isApplet())
+            throw new UnsupportedOperationException(R("JNotApplet"));
+
+        return (AppletDesc) launchType;
+    }
+
+    /**
+     * Returns the launch information for an application.
+     *
+     * @throws UnsupportedOperationException if there is no application information
+     */
+    public ApplicationDesc getApplication() {
+        if (!isApplication())
+            throw new UnsupportedOperationException(R("JNotApplication"));
+
+        return (ApplicationDesc) launchType;
+    }
+
+    /**
+     * Returns the launch information for a component.
+     *
+     * @throws UnsupportedOperationException if there is no component information
+     */
+    public ComponentDesc getComponent() {
+        if (!isComponent())
+            throw new UnsupportedOperationException(R("JNotComponent"));
+
+        return (ComponentDesc) launchType;
+    }
+
+    /**
+     * Returns the launch information for an installer.
+     *
+     * @throws UnsupportedOperationException if there is no installer information
+     */
+    public InstallerDesc getInstaller() {
+        if (!isInstaller())
+            throw new UnsupportedOperationException(R("NotInstaller"));
+
+        return (InstallerDesc) launchType;
+    }
+
+    /** 
+     * Returns whether the lauch descriptor describes an Applet.
+     */
+    public boolean isApplet() {
+        return launchType instanceof AppletDesc;
+    }
+
+    /** 
+     * Returns whether the lauch descriptor describes an Application.
+     */
+    public boolean isApplication() {
+        return launchType instanceof ApplicationDesc;
+    }
+
+    /** 
+     * Returns whether the lauch descriptor describes a Component.
+     */
+    public boolean isComponent() {
+        return launchType instanceof ComponentDesc;
+    }
+
+    /** 
+     * Returns whether the lauch descriptor describes an Installer.
+     */
+    public boolean isInstaller() {
+        return launchType instanceof InstallerDesc;
+    }
+
+    /**
+     * Sets the default view of the JNLP file returned by
+     * getInformation, getResources, etc.  If unset, the defaults
+     * are the properties os.name, os.arch, and the locale returned
+     * by Locale.getDefault().
+     */
+    public void setDefaults(String os, String arch, Locale locale) {
+        defaultOS = os;
+        defaultArch = arch;
+        defaultLocale = locale;
+    }
+
+
+    /**
+     * Returns whether a locale is matched by one of more other
+     * locales.  Only the non-empty language, country, and variant
+     * codes are compared; for example, a requested locale of
+     * Locale("","","") would always return true.
+     *
+     * @param requested the local
+     * @param available the available locales
+     * @return true if requested matches any of available, or if
+     * available is empty or null.
+     */
+    private boolean localMatches(Locale requested, Locale available[]) {
+        if (available == null || available.length == 0)
+            return true;
+
+        for (int i=0; i < available.length; i++) {
+            String language = requested.getLanguage(); // "" but never null
+            String country = requested.getCountry();
+            String variant = requested.getVariant();
+
+            if (!"".equals(language) && !language.equalsIgnoreCase(available[i].getLanguage()))
+                continue;
+            if (!"".equals(country) && !country.equalsIgnoreCase(available[i].getCountry()))
+                continue;
+            if (!"".equals(variant) && !variant.equalsIgnoreCase(available[i].getVariant()))
+                continue;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns whether the string is a prefix for any of the strings
+     * in the specified array.
+     *
+     * @param prefixStr the prefix string
+     * @param available the strings to test
+     * @return true if prefixStr is a prefix of any strings in
+     * available, or if available is empty or null.
+     */
+    private boolean stringMatches(String prefixStr, String available[]) {
+        if (available == null || available.length == 0)
+            return true;
+
+        for (int i=0; i < available.length; i++)
+            if (available[i] != null && available[i].startsWith(prefixStr))
+                return true;
+
+        return false;
+    }
+
+    /**
+     * Initialize the JNLPFile fields. Private because it's called
+     * from the constructor.
+     *
+     * @param root the root node
+     * @param strict whether to enforce the spec when 
+     * @param location the file location or null
+     */
+    private void parse(Node root, boolean strict, URL location) throws ParseException {
+        try {
+            //if (location != null)
+            //  location = new URL(location, "."); // remove filename
+
+            Parser parser = new Parser(this, location, root, strict, true); // true == allow extensions
+
+            // JNLP tag information
+            specVersion = parser.getSpecVersion();
+            fileVersion = parser.getFileVersion();
+            codeBase = parser.getCodeBase();
+            sourceLocation = parser.getFileLocation();
+
+            info = parser.getInfo(root);
+            resources = parser.getResources(root, false); // false == not a j2se resources section
+            launchType = parser.getLauncher(root);
+            security = parser.getSecurity(root);
+        }
+        catch (ParseException ex) {
+            throw ex;
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            throw new RuntimeException(ex.toString());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/JNLPSplashScreen.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,93 @@
+package net.sourceforge.jnlp;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Toolkit;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+import javax.swing.JFrame;
+
+import net.sourceforge.jnlp.cache.ResourceTracker;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+public class JNLPSplashScreen extends JFrame {
+
+    String applicationTitle;
+    String applicationVendor;
+
+    ResourceTracker resourceTracker;
+
+    URL splashImageUrl;
+    Image splashImage;
+
+    public JNLPSplashScreen(ResourceTracker resourceTracker,
+            String applicationTitle, String applicationVendor) {
+
+        // If the JNLP file does not contain any icon images, the splash image
+        // will consist of the application's title and vendor, as taken from the
+        // JNLP file.
+
+        this.resourceTracker = resourceTracker;
+        this.applicationTitle = applicationTitle;
+        this.applicationVendor = applicationVendor;
+
+    }
+
+    public void setSplashImageURL(URL url) {
+        splashImageUrl = url;
+        splashImage = null;
+        try {
+            splashImage = ImageIO.read(resourceTracker
+                    .getCacheFile(splashImageUrl));
+        } catch (IOException e) {
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Error loading splash image: " + url);
+            }
+            splashImage = null;
+            return;
+        } catch (IllegalArgumentException argumentException) {
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Error loading splash image: " + url);
+            }
+            splashImage = null;
+            return;
+        }
+
+        correctSize();
+    }
+
+    public boolean isSplashScreenValid() {
+        return (splashImage != null);
+    }
+    
+    private void correctSize() {
+
+        Insets insets = getInsets();
+        int minimumWidth = splashImage.getWidth(null) + insets.left
+                + insets.right;
+        int minimumHeight = splashImage.getHeight(null) + insets.top
+                + insets.bottom;
+        setMinimumSize(new Dimension(minimumWidth, minimumHeight));
+
+        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+        setLocation((screenSize.width - minimumWidth) / 2,
+                (screenSize.height - minimumHeight) / 2);
+    }
+
+    @Override
+    public void paint(Graphics g) {
+        if (splashImage == null) {
+            return;
+        }
+
+        correctSize();
+        Graphics2D g2 = (Graphics2D) g;
+        g2.drawImage(splashImage, getInsets().left, getInsets().top, null);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/JREDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,123 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The J2SE element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $
+ */
+public class JREDesc {
+
+    /** the platform version or the product version if location is not null */
+    private Version version;
+
+    /** the location of a JRE product or null */
+    private URL location;
+
+    /** inital heap size */
+    private long initialHeapSize;
+
+    /** maximum head size */
+    private long maximumHeapSize;
+
+    /** list of ResourceDesc objects */
+    private List resources;
+
+
+    /**
+     * Create a JRE descriptor.
+     *
+     * @param version the platform version or the product version
+     * if location is not null
+     * @param location the location of a JRE product or null
+     * @param initialHeapSize inital heap size
+     * @param maximumHeadSize maximum head size
+     * @param resources list of ResourceDesc objects
+     */
+    public JREDesc(Version version, URL location, String initialHeapSize, String maximumHeapSize, List resources) {
+        this.version = version;
+        this.location = location;
+        this.initialHeapSize = heapToLong(initialHeapSize);
+        this.maximumHeapSize = heapToLong(maximumHeapSize);
+        this.resources = resources;
+    }
+
+    /**
+     * Returns the JRE version.  Use isPlatformVersion to
+     * determine if this version corresponds to a platform or
+     * product version.
+     */
+    public Version getVersion() {
+        return version;
+    }
+
+    /**
+     * Returns true if the JRE version is a Java platform version
+     * (java.specification.version property) or false if it is a
+     * product version (java.version property).
+     */
+    public boolean isPlatformVersion() {
+        return getLocation() == null;
+    }
+
+    /**
+     * Returns the JRE version string.
+     */
+    public URL getLocation() {
+        return location;
+    }
+
+    /**
+     * Returns the maximum heap size in bytes.
+     */
+    public long getMaximumHeapSize() {
+        return maximumHeapSize;
+    }
+
+    /**
+     * Returns the initial heap size in bytes.
+     */
+    public long getInitialHeapSize() {
+        return initialHeapSize;
+    }
+
+    /**
+     * Returns the resources defined for this JRE.
+     */
+    public List getResourcesDesc() {
+        return resources;
+    }
+
+    /**
+     * Convert a heap size description string to a long value
+     * indicating the heap min/max size.
+     */
+    static private long heapToLong(String heapSize) {
+        // need to implement for completeness even though not used in netx
+        return -1;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/LaunchException.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,190 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * Thrown when a JNLP application, applet, or installer could not
+ * be created.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.9 $
+ */
+public class LaunchException extends Exception {
+
+    /** the original exception */
+    private Throwable cause = null;
+
+    /** the file being launched */
+    private JNLPFile file;
+
+    /** the category of the exception */
+    private String category;
+
+    /** summary */
+    private String summary;
+
+    /** description of the action that was taking place */
+    private String description;
+
+    /** severity of the warning/error */
+    private String severity;
+
+
+    /**
+     * Creates a LaunchException without detail message.
+     */
+    public LaunchException(JNLPFile file, Exception cause, String severity, String category, String summary, String description) {
+        super(severity + ": " + category  + ": "+ summary);
+
+        this.file = file;
+        this.category = category;
+        this.summary = summary;
+        this.description = description;
+        this.severity = severity;
+
+        // replace with setCause when no longer 1.3 compatible
+        this.cause = cause;
+    }
+
+    /**
+     * Creates a LaunchException with a cause. 
+     */
+    public LaunchException(Throwable cause) {
+        this(cause.getMessage());
+
+        // replace with setCause when no longer 1.3 compatible
+        this.cause = cause;
+    }
+
+    /**
+     * Creates a LaunchException with a cause and detail message
+     */
+    public LaunchException(String message, Throwable cause) {
+        this(message+": "+cause.getMessage());
+
+        // replace with setCause when no longer 1.3 compatible
+        this.cause = cause;
+    }
+
+    /**
+     * Constructs a LaunchException with the specified detail
+     * message.
+     * 
+     * @param message the detail message
+     */
+    public LaunchException(String message) {
+        super(message);
+    }
+
+    /**
+     * Returns the JNLPFile being launched.
+     */
+    public JNLPFile getFile() {
+        return file;
+    }
+
+    /**
+     * Returns the category string, a short description of the
+     * exception suitable for displaying in a window title.
+     */
+    public String getCategory() {
+        return category;
+    }
+
+    /**
+     * Returns a one-sentence summary of the problem.
+     */
+    public String getSummary() {
+        return summary;
+    }
+
+    /**
+     * Return a description of the exception and the action being
+     * performed when the exception occurred.
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Returns a short description of the severity of the problem.
+     */
+    public String getSeverity() {
+        return severity;
+    }
+
+    /**
+     * Return the cause of the launch exception or null if there
+     * is no cause exception.
+     */
+    public Throwable getCause() {
+        return cause;
+    }
+
+    /**
+     * Returns the causes for this exception.  This method is
+     * useful on JRE 1.3 since getCause is not a standard method,
+     * and will be removed once netx no longer supports 1.3.
+     */
+    public Throwable[] getCauses() {
+        ArrayList result = new ArrayList();
+
+        Reflect r = new Reflect();
+        Throwable cause = this.cause;
+
+        while (cause != null) {
+            result.add(cause);
+            cause = (Throwable) r.invoke(cause, "getCause");
+        }
+
+        return (Throwable[]) result.toArray(new Throwable[0]);
+    }
+
+    /**
+     * Print the stack trace and the cause exception (1.3
+     * compatible)
+     */
+    public void printStackTrace(PrintStream stream) {
+        super.printStackTrace(stream);
+
+        if (cause != null) {
+            stream.println("Caused by: ");
+            cause.printStackTrace(stream);
+        }
+    }
+
+    /**
+     * Print the stack trace and the cause exception (1.3
+     * compatible)
+     */
+    public void printStackTrace(PrintWriter stream) {
+        super.printStackTrace(stream);
+
+        if (cause != null) {
+            stream.println("Caused by: ");
+            cause.printStackTrace(stream);
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/LaunchHandler.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,68 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp;
+
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * This optional interface is used to handle conditions that occur
+ * while launching JNLP applications, applets, and installers.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.9 $
+ */
+public interface LaunchHandler {
+
+    /**
+     * Called when the application could not be launched due to a
+     * fatal error, such as the inability to find the main class or
+     * non-parseable XML.
+     */
+    public void launchError(LaunchException exception);
+
+    /**
+     * Called when launching the application can not be launched due
+     * to an error that is not fatal.  For example a JNLP file that
+     * is not strictly correct yet does not necessarily prohibit the
+     * system from attempting to launch the application.
+     *
+     * @return true if the launch should continue, false to abort
+     */
+    public boolean launchWarning(LaunchException warning);
+
+    /**
+     * Called when a security validation error occurs while
+     * launching the application.
+     *
+     * @return true to allow the application to continue, false to stop it.
+     */
+    public boolean validationError(LaunchException security);
+    // this method will probably be replaced when real security
+    // controller is in place.
+
+    /**
+     * Called when an application, applet, or installer has been
+     * launched successfully (the main method or applet start method
+     * returned normally).
+     *
+     * @param application the launched application instance
+     */
+    public void launchCompleted(ApplicationInstance application); 
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/Launcher.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,710 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.applet.*;
+import java.awt.Container;
+import java.io.*;
+import java.net.*;
+import java.util.jar.JarFile;
+import java.lang.reflect.*;
+
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * Launches JNLPFiles either in the foreground or background.<p>
+ *
+ * An optional LaunchHandler can be specified that is notified of
+ * warning and error condition while launching and that indicates
+ * whether a launch may proceed after a warning has occurred.  If
+ * specified, the LaunchHandler is notified regardless of whether
+ * the file is launched in the foreground or background.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.22 $ 
+ */
+public class Launcher {
+
+    // defines class Launcher.BgRunner, Launcher.TgThread
+
+    /** shortcut for resources */
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+
+    /** shared thread group */
+    private static final ThreadGroup mainGroup = new ThreadGroup(R("LAllThreadGroup"));
+
+    /** the handler */
+    private LaunchHandler handler = null;
+
+    /** the update policy */
+    private UpdatePolicy updatePolicy = JNLPRuntime.getDefaultUpdatePolicy();
+
+    /** whether to create an AppContext (if possible) */
+    private boolean context = true;
+
+    /** If the application should call System.exit on fatal errors */
+    private boolean exitOnFailure = true;
+
+    /**
+     * Create a launcher with the runtime's default update policy
+     * and launch handler.
+     */
+    public Launcher() {
+        this(null, null);
+
+        if (handler == null)
+            handler = JNLPRuntime.getDefaultLaunchHandler();
+    }
+    
+    /**
+     * Create a launcher with the runtime's default update policy
+     * and launch handler.
+     * 
+     * @param exitOnError Exit if there is an error (usually default, but false when being used from the plugin)
+     */
+    public Launcher(boolean exitOnFailure) {
+        this(null, null);
+
+        if (handler == null)
+            handler = JNLPRuntime.getDefaultLaunchHandler();
+        
+        this.exitOnFailure = exitOnFailure;
+    }
+
+    /**
+     * Create a launcher with the specified handler and the
+     * runtime's default update policy.
+     *
+     * @param handler the handler to use or null for no handler.
+     */
+    public Launcher(LaunchHandler handler) {
+        this(handler, null);
+    }
+
+    /**
+     * Create a launcher with an optional handler using the
+     * specified update policy and launch handler.
+     *
+     * @param handler the handler to use or null for no handler.
+     * @param policy the update policy to use or null for default policy.
+     */
+    public Launcher(LaunchHandler handler, UpdatePolicy policy) {
+        if (policy == null)
+            policy = JNLPRuntime.getDefaultUpdatePolicy();
+
+        this.handler = handler;
+        this.updatePolicy = policy;
+    }
+
+    /**
+     * Sets the update policy used by launched applications.
+     */
+    public void setUpdatePolicy(UpdatePolicy policy) {
+        if (policy == null)
+            throw new IllegalArgumentException(R("LNullUpdatePolicy"));
+
+        this.updatePolicy = policy;
+    }
+
+    /**
+     * Returns the update policy used when launching applications.
+     */
+    public UpdatePolicy getUpdatePolicy() {
+        return updatePolicy;
+    }
+
+    /**
+     * Sets whether to launch the application in a new AppContext
+     * (a separate event queue, look and feel, etc).  If the
+     * sun.awt.SunToolkit class is not present then this method
+     * has no effect.  The default value is true.
+     */
+    public void setCreateAppContext(boolean context) {
+        this.context = context;
+    }
+
+    /**
+     * Returns whether applications are launched in their own
+     * AppContext.
+     */
+    public boolean isCreateAppContext() {
+        return this.context;
+    }
+
+    /**
+     * Launches a JNLP file by calling the launch method for the
+     * appropriate file type.  The application will be started in
+     * a new window.
+     *
+     * @param file the JNLP file to launch
+     * @return the application instance
+     * @throws LaunchException if an error occurred while launching (also sent to handler)
+     */
+    public ApplicationInstance launch(JNLPFile file) throws LaunchException {
+        return launch(file, null);
+    }
+
+    /**
+     * Launches a JNLP file inside the given container if it is an applet.  Specifying a
+     * container has no effect for Applcations and Installers.
+     *
+     * @param file the JNLP file to launch
+     * @param cont the container in which to place the application, if it is an applet
+     * @return the application instance
+     * @throws LaunchException if an error occurred while launching (also sent to handler)
+     */
+    public ApplicationInstance launch(JNLPFile file, Container cont) throws LaunchException {
+        TgThread tg;
+
+        if (file instanceof PluginBridge && cont != null)
+        	tg = new TgThread(file, cont, true);
+        else if (cont == null)
+        	tg = new TgThread(file);
+        else
+        	tg = new TgThread(file, cont);
+
+        tg.start();
+
+        try {
+            tg.join();
+        }
+        catch (InterruptedException ex) {
+			//By default, null is thrown here, and the message dialog is shown.
+            throw launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCSystem"), R("LThreadInterrupted"), R("LThreadInterruptedInfo")));
+        }
+
+        if (tg.getException() != null)
+            throw tg.getException(); // passed to handler when first created
+
+        if (handler != null)
+            handler.launchCompleted(tg.getApplication());
+
+        return tg.getApplication();
+    }    
+
+    /**
+     * Launches a JNLP file by calling the launch method for the
+     * appropriate file type.
+     *
+     * @param location the URL of the JNLP file to launch
+     * @throws LaunchException if there was an exception 
+     * @return the application instance
+     */
+    public ApplicationInstance launch(URL location) throws LaunchException {
+        return launch(toFile(location));
+    }
+
+    /** 
+     * Launches a JNLP file by calling the launch method for the
+     * appropriate file type in a different thread.
+     *
+     * @param file the JNLP file to launch
+     */
+    public void launchBackground(JNLPFile file) {
+        BgRunner runner = new BgRunner(file, null);
+        new Thread(runner).start();
+    }
+
+    /**
+     * Launches the JNLP file at the specified location in the
+     * background by calling the launch method for its file type.
+     *
+     * @param location the location of the JNLP file
+     */
+    public void launchBackground(URL location) {
+        BgRunner runner = new BgRunner(null, location);
+        new Thread(runner).start();
+    }
+
+    /**
+     * Launches the JNLP file in a new JVM instance.  The launched
+     * application's output is sent to the system out and it's
+     * standard input channel is closed.
+     *
+     * @param file the JNLP file to launch
+     * @throws LaunchException if there was an exception 
+     */
+    public void launchExternal(JNLPFile file) throws LaunchException {
+        if (file.getSourceLocation() != null)
+            launchExternal(file.getSourceLocation());
+        else if (file.getFileLocation() != null)
+            launchExternal(file.getFileLocation());
+        else
+            launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo")));
+    }
+
+    /**
+     * Launches the JNLP file at the specified location in a new JVM
+     * instance.  The launched application's output is sent to the
+     * system out and it's standard input channel is closed.
+     *
+     * @param location the URL of the JNLP file to launch
+     * @throws LaunchException if there was an exception 
+     */
+    public void launchExternal(URL location) throws LaunchException {
+        try {
+            URL cs = Launcher.class.getProtectionDomain().getCodeSource().getLocation();
+            if (JNLPRuntime.isDebug())
+                System.out.println("netx.jar path: "+cs.getPath());
+
+            File netxFile = new File(cs.getPath());
+            if (!netxFile.exists())
+                throw launchError(new LaunchException(null, null, R("LSFatal"), R("LCExternalLaunch"), R("LNetxJarMissing"), R("LNetxJarMissingInfo")));
+
+            String command[] = {
+                "javaw",
+                "-jar",
+                netxFile.toString(),
+                "-jnlp",
+                location.toString(),
+                "-verbose",
+            };
+
+            Process p = Runtime.getRuntime().exec(command);
+            new StreamEater(p.getErrorStream()).start();
+            new StreamEater(p.getInputStream()).start();
+            p.getOutputStream().close();
+
+        }
+        catch (NullPointerException ex) {
+            throw launchError(new LaunchException(null, null, R("LSFatal"), R("LCExternalLaunch"), R("LNetxJarMissing"), R("LNetxJarMissingInfo")));
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(null, ex, R("LSFatal"), R("LCExternalLaunch"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
+        }
+    }
+
+    /**
+     * Returns the JNLPFile for the URL, with error handling.
+     */
+    private JNLPFile toFile(URL location) throws LaunchException {
+        try { 
+            JNLPFile file = null;
+
+            try {
+                file = new JNLPFile(location, null, true, updatePolicy); // strict
+            }
+            catch (ParseException ex) {
+                file = new JNLPFile(location, null, false, updatePolicy);
+
+                // only here if strict failed but lax did not fail 
+                LaunchException lex = 
+                    launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCFileFormat"), R("LNotToSpec"), R("LNotToSpecInfo")));
+
+                if (lex != null)
+                    throw lex;
+            }
+
+            return file;
+        }
+        catch (Exception ex) {
+            if (ex instanceof LaunchException)
+                throw (LaunchException) ex; // already sent to handler when first thrown
+            else  // IO and Parse
+                throw launchError(new LaunchException(null, ex, R("LSFatal"), R("LCReadError"), R("LCantRead"), R("LCantReadInfo")));
+        }
+    }
+
+    /** 
+     * Launches a JNLP application.  This method should be called
+     * from a thread in the application's thread group.
+     */
+    protected ApplicationInstance launchApplication(JNLPFile file) throws LaunchException {
+        if (!file.isApplication())
+            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplication"), R("LNotApplicationInfo")));
+
+        try {
+            final int preferredWidth = 500;
+            final int preferredHeight = 400;
+            JNLPSplashScreen splashScreen = null;
+            URL splashImageURL = file.getInformation().getIconLocation(
+                    IconDesc.SPLASH, preferredWidth, preferredHeight);
+            if (splashImageURL != null) {
+                ResourceTracker resourceTracker = new ResourceTracker(true);
+                resourceTracker.addResource(splashImageURL, "SPLASH", file.getFileVersion(), updatePolicy);
+                splashScreen = new JNLPSplashScreen(resourceTracker, null, null);
+                splashScreen.setSplashImageURL(splashImageURL);
+                if (splashScreen.isSplashScreenValid()) {
+                    splashScreen.setVisible(true);
+                }
+            }
+
+
+            ApplicationInstance app = createApplication(file);
+            app.initialize();
+
+            String mainName = file.getApplication().getMainClass();
+            
+            // When the application-desc field is empty, we should take a 
+            // look at the main jar for the main class.
+            if (mainName == null) {
+            	JARDesc mainJarDesc = file.getResources().getMainJAR();
+            	File f = CacheUtil.getCacheFile(mainJarDesc.getLocation(), null);
+            	if (f != null) {
+            		JarFile mainJar = new JarFile(f);
+            		mainName = mainJar.getManifest().
+            			getMainAttributes().getValue("Main-Class");
+            	}
+            }
+            
+            if (mainName == null)
+            	throw launchError(new LaunchException(file, null, 
+            		R("LSFatal"), R("LCClient"), R("LCantDetermineMainClass") , 
+            		R("LCantDetermineMainClassInfo")));
+            
+            Class mainClass = app.getClassLoader().loadClass(mainName);
+
+            Method main = mainClass.getDeclaredMethod("main", new Class[] {String[].class} );
+            String args[] = file.getApplication().getArguments();
+
+            // required to make some apps work right
+            Thread.currentThread().setContextClassLoader(app.getClassLoader());
+
+            if (splashScreen != null) {
+                if (splashScreen.isSplashScreenValid()) {
+                    splashScreen.setVisible(false);
+                }
+                splashScreen.dispose();
+            }
+
+            main.invoke(null, new Object[] { args } );
+
+            return app;
+        }
+        catch (LaunchException lex) {
+            throw launchError(lex);
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
+        }
+    }
+
+    /** 
+     * Launches a JNLP applet. This method should be called from a
+     * thread in the application's thread group.<p>
+     *
+     * The enableCodeBase parameter adds the applet's codebase to
+     * the locations searched for resources and classes.  This can
+     * slow down the applet loading but allows browser-style applets
+     * that don't use JAR files exclusively to be run from a applet
+     * JNLP file.  If the applet JNLP file does not specify any
+     * resources then the code base will be enabled regardless of
+     * the specified value.<p>
+     *
+     * @param file the JNLP file
+     * @param enableCodeBase whether to add the codebase URL to the classloader
+     */
+    protected ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
+        if (!file.isApplet())
+            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo")));
+
+        try {
+            AppletInstance applet = createApplet(file, enableCodeBase, cont);
+            applet.initialize();
+            
+            applet.getAppletEnvironment().startApplet(); // this should be a direct call to applet instance
+            return applet;
+        }
+        catch (LaunchException lex) {
+            throw launchError(lex);
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
+        }
+    }
+    
+    /**
+     * Gets an ApplicationInstance, but does not launch the applet.
+     */
+    protected ApplicationInstance getApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
+        if (!file.isApplet())
+            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo")));
+
+        try {
+            AppletInstance applet = createApplet(file, enableCodeBase, cont);
+            applet.initialize();
+            return applet;
+        }
+        catch (LaunchException lex) {
+            throw launchError(lex);
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
+        }
+    }
+
+    /** 
+     * Launches a JNLP installer.  This method should be called from
+     * a thread in the application's thread group.
+     */
+    protected ApplicationInstance launchInstaller(JNLPFile file) throws LaunchException {
+        throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCNotSupported"), R("LNoInstallers"), R("LNoInstallersInfo")));
+    }
+
+    /**
+     * Create an AppletInstance.
+     *
+     * @param enableCodeBase whether to add the code base URL to the classloader
+     */
+    protected AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
+        try {
+            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
+
+            if (enableCodeBase || file.getResources().getJARs().length == 0)
+                loader.enableCodeBase();
+
+            AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup();
+
+            String appletName = file.getApplet().getMainClass();
+
+			//Classloader chokes if there's '/' in the path to the main class.
+			//Must replace with '.' instead.
+			appletName = appletName.replace('/', '.');
+            Class appletClass = loader.loadClass(appletName);
+            Applet applet = (Applet) appletClass.newInstance();
+
+            AppletInstance appletInstance;
+            if (cont == null)
+              appletInstance = new AppletInstance(file, group, loader, applet);
+            else
+              appletInstance = new AppletInstance(file, group, loader, applet, cont);
+
+            group.setApplication(appletInstance);
+            loader.setApplication(appletInstance);
+
+            return appletInstance;
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")));
+        }
+    }
+
+    /**
+     * Creates an Applet object from a JNLPFile. This is mainly to be used with
+     * gcjwebplugin.
+     * @param file the PluginBridge to be used.
+     * @param enableCodeBase whether to add the code base URL to the classloader.
+     */
+    protected Applet createAppletObject(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
+        try {
+            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
+
+            if (enableCodeBase || file.getResources().getJARs().length == 0)
+                loader.enableCodeBase();
+
+            String appletName = file.getApplet().getMainClass();
+
+			//Classloader chokes if there's '/' in the path to the main class.
+			//Must replace with '.' instead.
+			appletName = appletName.replace('/', '.');
+            Class appletClass = loader.loadClass(appletName);
+            Applet applet = (Applet) appletClass.newInstance();
+
+            return applet;
+        }
+        catch (Exception ex) {
+            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")));
+        }
+    }
+    
+    /**
+     * Creates an Application.
+     */
+    protected ApplicationInstance createApplication(JNLPFile file) throws LaunchException {
+        try {
+            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
+            AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup();
+
+            ApplicationInstance app = new ApplicationInstance(file, group, loader);
+            group.setApplication(app);
+            loader.setApplication(app);
+
+            return app;
+        }
+        catch (Exception ex) {
+            throw new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo"));
+        }
+    }
+
+    /**
+     * Create a thread group for the JNLP file.
+     */
+    protected AppThreadGroup createThreadGroup(JNLPFile file) {
+        return new AppThreadGroup(mainGroup, file.getTitle());
+    }
+
+    /**
+     * Send n launch error to the handler, if set, and also to the
+     * caller.
+     */
+    private LaunchException launchError(LaunchException ex) {
+        if (handler != null)
+            handler.launchError(ex);
+
+        return ex;
+    }
+
+    /**
+     * Send a launch error to the handler, if set, and to the
+     * caller only if the handler indicated that the launch should
+     * continue despite the warning.
+     *
+     * @return an exception to throw if the launch should be aborted, or null otherwise
+     */
+    private LaunchException launchWarning(LaunchException ex) {
+        if (handler != null)
+            if (!handler.launchWarning(ex))
+                // no need to destroy the app b/c it hasn't started
+                return ex; // chose to abort
+
+        return null; // chose to continue, or no handler
+    }
+
+
+
+    /**
+     * This runnable is used to call the appropriate launch method
+     * for the application, applet, or installer in its thread group.
+     */
+    private class TgThread extends Thread { // ThreadGroupThread
+        private JNLPFile file;
+        private ApplicationInstance application;
+        private LaunchException exception;
+        private Container cont;
+        private boolean isPlugin = false;
+
+        TgThread(JNLPFile file) {
+            this(file, null);
+        }
+
+        TgThread(JNLPFile file, Container cont) {
+            super(createThreadGroup(file), file.getTitle());
+
+            this.file = file;
+            this.cont = cont;
+        }
+        
+        TgThread(JNLPFile file, Container cont, boolean isPlugin) {
+            super(createThreadGroup(file), file.getTitle());
+            this.file = file;
+            this.cont = cont;
+            this.isPlugin = isPlugin;
+        }
+
+        public void run() {
+            try {
+                // Do not create new AppContext if we're using NetX and gcjwebplugin.
+                if (context && !isPlugin)
+                	new Reflect().invokeStatic("sun.awt.SunToolkit", "createNewAppContext");
+
+                if (isPlugin) {
+                	// Do not display download indicators if we're using gcjwebplugin.
+                	JNLPRuntime.setDefaultDownloadIndicator(null);
+                	application = getApplet(file, true, cont);
+                } else {
+                	if (file.isApplication())
+                		application = launchApplication(file);
+                	else if (file.isApplet())
+                		application = launchApplet(file, true, cont); // enable applet code base
+                	else if (file.isInstaller())
+                		application = launchInstaller(file);
+                	else 
+                		throw launchError(new LaunchException(file, null, 
+                				R("LSFatal"), R("LCClient"), R("LNotLaunchable"), 
+                				R("LNotLaunchableInfo")));
+                }
+            }
+            catch (LaunchException ex) {
+                ex.printStackTrace();
+                exception = ex;
+                // Exit if we can't launch the application.
+                if (exitOnFailure)
+                	System.exit(0);
+            }
+        }
+
+        public LaunchException getException() {
+            return exception;
+        }
+
+        public ApplicationInstance getApplication() {
+            return application;
+        }
+        
+    };
+
+
+    /**
+     * This runnable is used by the <code>launchBackground</code>
+     * methods to launch a JNLP file from a separate thread.
+     */
+    private class BgRunner implements Runnable {
+        private JNLPFile file;
+        private URL location;
+
+        BgRunner(JNLPFile file, URL location) {
+            this.file = file;
+            this.location = location;
+        }
+
+        public void run() {
+            try {
+                if (file != null)
+                    launch(file);
+                if (location != null)
+                    launch(location);
+            }
+            catch (LaunchException ex) {
+                // launch method communicates error conditions to the
+                // handler if it exists, otherwise we don't care because
+                // there's nothing that can be done about the exception.
+            }
+        }
+    };
+
+    /**
+     * This class reads the output from a launched process and
+     * writes it to stdout.
+     */
+    private static class StreamEater extends Thread {
+        private InputStream stream;
+
+        StreamEater(InputStream stream) {
+            this.stream = new BufferedInputStream(stream);
+        }
+
+        public void run() {
+            try {
+                while (true) {
+                    int c = stream.read();
+                    if (c == -1)
+                        break;
+
+                    System.out.write(c);
+                }
+            }
+            catch (IOException ex) {
+            }
+        }
+    };
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/NetxPanel.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,150 @@
+/*
+ * Copyright 2007 Red Hat, Inc.
+ * This file is part of IcedTea, http://icedtea.classpath.org
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package net.sourceforge.jnlp;
+
+import net.sourceforge.jnlp.runtime.AppletInstance;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+import java.net.URL;
+import java.util.Hashtable;
+
+import sun.applet.AppletViewerPanel;
+
+/**
+ * This panel calls into netx to run an applet, and pipes the display
+ * into a panel from gcjwebplugin.
+ *
+ * @author      Francis Kung <fkung@redhat.com>
+ */
+public class NetxPanel extends AppletViewerPanel
+{
+    private PluginBridge bridge = null;
+    private boolean exitOnFailure = true;
+    private AppletInstance appInst = null;
+    private String cookieStr;
+    private boolean appletAlive;
+
+    public NetxPanel(URL documentURL, Hashtable atts)
+    {
+        super(documentURL, atts);
+    }
+    
+    // overloaded constructor, called when initialized via plugin 
+    public NetxPanel(URL documentURL, String cookieStr, Hashtable atts, boolean exitOnFailure)
+    {
+        this(documentURL, atts);
+        this.exitOnFailure = exitOnFailure;
+        this.cookieStr = cookieStr;
+        this.appletAlive = true;
+    }
+
+    //Overriding to use Netx classloader. You might need to relax visibility
+    //in sun.applet.AppletPanel for runLoader().
+    protected void runLoader() {
+
+    	try {
+    		bridge = new PluginBridge(baseURL,
+    				cookieStr,
+    				getDocumentBase(),
+    				getJarFiles(), 
+    				getCode(),
+    				getWidth(), 
+    				getHeight(), 
+    				atts);
+
+    		synchronized(JNLPRuntime.initMutex) {
+    			//The custom NetX Policy and SecurityManager are set here.
+    			if (!JNLPRuntime.isInitialized()) {
+    			    if (JNLPRuntime.isDebug())
+    			        System.out.println("initializing JNLPRuntime...");
+
+    				JNLPRuntime.initialize(false);
+    			} else {
+    			    if (JNLPRuntime.isDebug())
+    			        System.out.println("JNLPRuntime already initialized");
+    			}
+    		}
+
+    		doInit = true;
+    		dispatchAppletEvent(APPLET_LOADING, null);
+    		status = APPLET_LOAD;
+
+    		Launcher l = new Launcher(exitOnFailure);
+    		
+                try {
+                    appInst = (AppletInstance) l.launch(bridge, this);
+                } catch (LaunchException e) {
+                    // Assume user has indicated he does not trust the
+                    // applet.
+                	if (exitOnFailure)
+                		System.exit(0);
+                }
+    		applet = appInst.getApplet();
+    		
+    		//On the other hand, if you create an applet this way, it'll work
+    		//fine. Note that you might to open visibility in sun.applet.AppletPanel
+    		//for this to work (the loader field, and getClassLoader).
+    		//loader = getClassLoader(getCodeBase(), getClassLoaderCacheKey());
+    		//applet = createApplet(loader);
+    		
+    		// This shows that when using NetX's JNLPClassLoader, keyboard input
+    		// won't make it to the applet, whereas using sun.applet.AppletClassLoader
+    		// works just fine.
+    		
+    		dispatchAppletEvent(APPLET_LOADING_COMPLETED, null);
+
+    		if (applet != null)
+    		{
+    			// Stick it in the frame
+    			applet.setStub(this);
+    			applet.setVisible(false);
+    			add("Center", applet);
+    			showAppletStatus("loaded");
+    			validate();
+    		}
+    	} catch (Exception e) {
+    	    this.appletAlive = false;
+    		e.printStackTrace();
+    	}
+    }
+
+    // Reminder: Relax visibility in sun.applet.AppletPanel
+    protected synchronized void createAppletThread() {
+    	handler = new Thread(this);
+    	handler.start();
+    }
+    
+    public void updateSizeInAtts(int height, int width) {
+    	this.atts.put("height", Integer.toString(height));
+    	this.atts.put("width", Integer.toString(width));
+    }
+    
+    public ClassLoader getAppletClassLoader() {
+        return appInst.getClassLoader();
+    }
+    
+    public boolean isAlive() {
+        return handler.isAlive() && this.appletAlive;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/Node.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,147 @@
+package net.sourceforge.jnlp;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import net.sourceforge.nanoxml.XMLElement;
+
+// this class makes assumptions on how parser calls methods (such
+// as getFirstChild->getNextChild only called by a single loop at
+// a time, so no need for an iterator).
+
+/**
+ * This class converts the NanoXML's XMLElement nodes into the
+ * regular XML Node interface (for the methods used by Parser).
+ */
+/* NANO */
+class Node {
+    private XMLElement xml;
+    private Node next;
+    private Node children[];
+
+    Node(XMLElement xml) {
+        this.xml = xml;
+    }
+
+    Node getFirstChild() {
+        if (children == null)
+            getChildNodes();
+
+        if (children.length == 0)
+            return null;
+        else
+            return children[0];
+    }
+
+    Node getNextSibling() {
+        return next;
+    }
+
+    void normalize() {
+    }
+
+    String getNodeValue() {
+        return xml.getContent();
+    }
+
+    Node[] getChildNodes() {
+        if (children == null) {
+            List list = new ArrayList();
+
+            for (Enumeration e = xml.enumerateChildren(); e.hasMoreElements();)
+                list.add( new Node((XMLElement)e.nextElement()) );
+
+            children = (Node[]) list.toArray( new Node[list.size()] );
+
+            for (int i=0; i < children.length-1; i++)
+                children[i].next = children[i+1];
+        }
+
+        return children;
+    }
+
+    String getAttribute(String name) {
+        return (String)xml.getAttribute(name);
+    }
+
+    String getNodeName() {
+        if (xml.getName() == null)
+            return "";
+        else
+            return xml.getName();
+    }
+
+    public String toString() {
+        return getNodeName();
+    }
+}
+
+/**
+ * This class converts the TinyXML's ParsedXML nodes into the
+ * regular XML Node interface (for the methods used by Parser).
+ */
+/* TINY 
+class Node {
+    private ParsedXML tinyNode;
+    private Node next;
+    private Node children[];
+
+    Node(ParsedXML tinyNode) {
+        this.tinyNode = tinyNode;
+    }
+
+    Node getFirstChild() {
+        if (children == null)
+            getChildNodes();
+
+        if (children.length == 0)
+            return null;
+        else
+            return children[0];
+    }
+
+    Node getNextSibling() {
+        return next;
+    }
+
+    void normalize() {
+    }
+
+    String getNodeValue() {
+        return tinyNode.getContent();
+    }
+
+    Node[] getChildNodes() {
+        if (children == null) {
+            List list = new ArrayList();
+
+            for (Enumeration e = tinyNode.elements(); e.hasMoreElements();) {
+                list.add( new Node((ParsedXML)e.nextElement()) );
+            }
+            children = (Node[]) list.toArray( new Node[list.size()] );
+
+            for (int i=0; i < children.length-1; i++)
+                children[i].next = children[i+1];
+        }
+
+        return children;
+    }
+
+    String getAttribute(String name) {
+        return tinyNode.getAttribute(name);
+    }
+
+    String getNodeName() {
+        if (tinyNode.getName() == null)
+            return "";
+        else
+            return tinyNode.getName();
+    }
+
+    public String toString() {
+        return getNodeName();
+    }
+}
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/PackageDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,105 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The package element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $
+ */
+public class PackageDesc {
+
+    /** the package name */
+    private String name;
+
+    /** the part required by the package */
+    private String part;
+
+    /** whether the package includes subpackages */
+    private boolean recursive;
+
+
+    /**
+     * Create a package descriptor.
+     *
+     * @param name the package name
+     * @param part the part required by the package
+     * @param recursive whether the package includes subpackages
+     */
+    public PackageDesc(String name, String part, boolean recursive) {
+        this.name = name;
+        this.part = part;
+        this.recursive = recursive;
+    }
+
+    /**
+     * Returns whether the specified class is part of this package.
+     *
+     * @param className the fully qualified class name
+     */
+    public boolean matches(String className) {
+        // form 1: exact class
+        if (name.equals(className))
+            return true;
+
+        // form 2: package.*
+        if (name.endsWith(".*")) {
+            String pkName = name.substring(0, name.length()-1);
+
+            if (className.startsWith(pkName)) {
+                String postfix = className.substring(pkName.length()+1);
+
+                if (recursive || -1 == postfix.indexOf("."))
+                    return true;
+            }
+        }
+
+        return false;
+    }
+
+    /** 
+     * Returns the package name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the part name.
+     */
+    public String getPart() {
+        return part;
+    }
+
+    /**
+     * Returns whether subpackages should be matched by this
+     * package.
+     */
+    public boolean isRecursive() {
+        return recursive;
+    }
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ParseException.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,94 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Thrown to indicate that an error has occurred while parsing a
+ * JNLP file.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $
+ */
+public class ParseException extends Exception {
+
+    // todo: add meaningful information, such as the invalid
+    // element, parse position, etc.
+    
+    /** the original exception */
+    private Throwable cause = null;
+
+
+    /**
+     * Create a parse exception with the specified message.
+     */
+    public ParseException(String message) {
+        super(message);
+    }
+
+    /**
+     * Create a parse exception with the specified message and
+     * cause.
+     */
+    public ParseException(String message, Throwable cause) {
+        super(message);
+
+        // replace with setCause when no longer 1.3 compatible
+        this.cause = cause;
+    }
+
+    /**
+     * Return the cause of the launch exception or null if there
+     * is no cause exception.
+     */
+    public Throwable getCause() {
+        return cause;
+    }
+
+    /**
+     * Print the stack trace and the cause exception (1.3
+     * compatible)
+     */
+    public void printStackTrace(PrintStream stream) {
+        super.printStackTrace(stream);
+
+        if (cause != null) {
+            stream.println("Caused by: ");
+            cause.printStackTrace(stream);
+        }
+    }
+
+    /**
+     * Print the stack trace and the cause exception (1.3
+     * compatible)
+     */
+    public void printStackTrace(PrintWriter stream) {
+        super.printStackTrace(stream);
+
+        if (cause != null) {
+            stream.println("Caused by: ");
+            cause.printStackTrace(stream);
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/Parser.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,979 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+//import javax.xml.parsers.*; // commented to use right Node
+//import org.w3c.dom.*;       // class for using Tiny XML | NanoXML
+//import org.xml.sax.*;
+//import gd.xml.tiny.*;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.nanoxml.*;
+
+
+/**
+ * Contains methods to parse an XML document into a JNLPFile.
+ * Implements JNLP specification version 1.0.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.13 $ 
+ */
+class Parser {
+
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+    private static String R(String key, Object p1) { return R(key, p1, null); }
+    private static String R(String key, Object p1, Object p2) { return R(key, p1, p2, null); }
+    private static String R(String key, Object p1, Object p2, Object p3) { return JNLPRuntime.getMessage(key, new Object[] { p1, p2, p3 }); }
+
+
+    // defines netx.jnlp.Node class if using Tiny XML or Nano XML
+
+    // Currently uses the Nano XML parse.  Search for "SAX" or
+    // "TINY" or "NANO" and uncomment those blocks and comment the
+    // active ones (if any) to switch XML parsers.  Also
+    // (un)comment appropriate Node class at end of this file and
+    // do a clean build.
+
+    /**
+     * Ensure consistent error handling.
+     */
+    /* SAX
+    static ErrorHandler errorHandler = new ErrorHandler() {
+        public void error(SAXParseException exception) throws SAXParseException {
+            //throw exception;
+        }
+        public void fatalError(SAXParseException exception) throws SAXParseException {
+            //throw exception;
+        }
+        public void warning(SAXParseException exception) {
+            System.err.println("XML parse warning:");
+            exception.printStackTrace();
+        }
+    };
+    */
+
+
+    /** the supported JNLP file versions */
+    private static Version supportedVersions = new Version("1.0");
+
+    // fix: some descriptors need to use the jnlp file at a later
+    // date and having file ref lets us pass it to their
+    // constructors
+    //
+    /** the file reference */
+    private JNLPFile file; // do not use (uninitialized)
+
+    /** the root node */
+    private Node root;
+
+    /** the specification version */
+    private Version spec;
+
+    /** the base URL that all hrefs are relative to */
+    private URL base;
+
+    /** the codebase URL */
+    private URL codebase;
+
+    /** the file URL */
+    private URL fileLocation;
+
+    /** whether to throw errors on non-fatal errors. */
+    private boolean strict; // if strict==true parses a file with no error then strict==false should also
+
+    /** whether to allow extensions to the JNLP specification */
+    private boolean allowExtensions; // true if extensions to JNLP spec are ok
+
+
+    /**
+     * Create a parser for the JNLP file.  If the location
+     * parameters is not null it is used as the default codebase
+     * (does not override value of jnlp element's href
+     * attribute).<p>
+     *
+     * The root node may be normalized as a side effect of this
+     * constructor.
+     *
+     * @param file the (uninitialized) file reference
+     * @param base if codebase is not specified, a default base for relative URLs 
+     * @param root the root node
+     * @param strict whether to enforce strict compliance with the JNLP spec
+     * @param allowExtensions whether to allow extensions to the JNLP spec
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public Parser(JNLPFile file, URL base, Node root, boolean strict, boolean allowExtensions) throws ParseException {
+        this.file = file;
+        this.root = root;
+        this.strict = strict;
+        this.allowExtensions = allowExtensions;
+
+        // ensure it's a JNLP node
+        if (root == null || !root.getNodeName().equals("jnlp"))
+            throw new ParseException(R("PInvalidRoot"));
+
+        // JNLP tag information
+        this.spec = getVersion(root, "spec", "1.0+");
+        this.codebase = addSlash(getURL(root, "codebase", base));
+        this.base = (codebase!=null) ? codebase : base; // if codebase not specified use default codebase
+        fileLocation = getURL(root, "href", this.base);
+
+        // ensure version is supported
+        if (!supportedVersions.matchesAny(spec))
+            throw new ParseException(R("PSpecUnsupported", supportedVersions));
+
+        // normalize the text nodes
+        root.normalize();
+    }
+
+    /**
+     * Return the JNLP specification versions supported.
+     */
+    public static Version getSupportedVersions() {
+        return supportedVersions;
+    }
+
+    /** 
+     * Returns the file version.
+     */
+    public Version getFileVersion() {
+        return getVersion(root, "version", null);
+    }
+
+    /** 
+     * Returns the file location.
+     */
+    public URL getFileLocation() {
+        return fileLocation;
+    }
+
+    /** 
+     * Returns the codebase.
+     */
+    public URL getCodeBase() {
+        return codebase;
+    }
+
+    /** 
+     * Returns the specification version.
+     */
+    public Version getSpecVersion() {
+        return spec;
+    }
+
+    // 
+    // This section loads the resources elements
+    // 
+
+    /**
+     * Returns all of the ResourcesDesc elements under the specified
+     * node (jnlp or j2se).
+     *
+     * @param parent the parent node (either jnlp or j2se)
+     * @param j2se true if the resources are located under a j2se node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public List getResources(Node parent, boolean j2se) throws ParseException {
+        List result = new ArrayList();
+        Node resources[] = getChildNodes(parent, "resources");
+
+        // ensure that there are at least one information section present
+        if (resources.length == 0 && !j2se)
+            throw new ParseException(R("PNoResources"));
+
+        // create objects from the resources sections
+        for (int i=0; i < resources.length; i++)
+            result.add(getResourcesDesc(resources[i], j2se));
+
+        return result;
+    }
+
+    /**
+     * Returns the ResourcesDesc element at the specified node.
+     *
+     * @param node the resources node
+     * @param j2se true if the resources are located under a j2se node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public ResourcesDesc getResourcesDesc(Node node, boolean j2se) throws ParseException {
+        boolean mainFlag = false; // if found a main tag
+
+        // create resources
+        ResourcesDesc resources = 
+            new ResourcesDesc(file, 
+                              getLocales(node), 
+                              splitString(getAttribute(node, "os", null)),
+                              splitString(getAttribute(node, "arch", null)));
+
+        // step through the elements
+        Node child = node.getFirstChild();
+        while (child != null) {
+            String name = child.getNodeName();
+
+            // check for nativelib but no trusted environment 
+            if ("nativelib".equals(name))
+                if (!isTrustedEnvironment())
+                    throw new ParseException(R("PUntrustedNative"));
+
+            if ("j2se".equals(name)) {
+                if (getChildNode(root, "component-desc") != null)
+                    if (strict)
+                        throw new ParseException(R("PExtensionHasJ2SE"));
+                if (!j2se)
+                    resources.addResource( getJRE(child) );
+                else
+                    throw new ParseException(R("PInnerJ2SE"));
+            }
+
+            if ("jar".equals(name) || "nativelib".equals(name)) {
+                JARDesc jar = getJAR(child);
+
+                // check for duplicate main entries
+                if (jar.isMain()) {
+                    if (mainFlag == true)
+                        if (strict)
+                            throw new ParseException(R("PTwoMains"));
+                    mainFlag = true;
+                }
+
+                resources.addResource(jar);
+            }
+
+            if ("extension".equals(name))
+                resources.addResource( getExtension(child) );
+
+            if ("property".equals(name)) 
+                resources.addResource( getProperty(child) );
+
+            if ("package".equals(name))
+                resources.addResource( getPackage(child) );
+
+            child = child.getNextSibling();
+        }
+
+        return resources;
+    }
+
+    /**
+     * Returns the JRE element at the specified node.
+     *
+     * @param node the j2se node 
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public JREDesc getJRE(Node node) throws ParseException {
+        Version version = getVersion(node, "version", null);
+        URL location = getURL(node, "href", base);
+        String initialHeap = getAttribute(node, "initial-heap-size", null);
+        String maxHeap = getAttribute(node, "max-heap-size", null);
+        List resources = getResources(node, true);
+
+        // require version attribute
+        getRequiredAttribute(node, "version", null);
+
+        return new JREDesc(version, location, initialHeap, maxHeap, resources);
+    }
+
+    /**
+     * Returns the JAR element at the specified node.
+     *
+     * @param node the jar or nativelib node 
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public JARDesc getJAR(Node node) throws ParseException {
+        boolean nativeJar = "nativelib".equals(node.getNodeName());
+        URL location = getRequiredURL(node, "href", base);
+        Version version = getVersion(node, "version", null);
+        String part = getAttribute(node, "part", null);
+        boolean main = "true".equals(getAttribute(node, "main", "false"));
+        boolean lazy = "lazy".equals(getAttribute(node, "download", "eager"));
+        int size = Integer.parseInt(getAttribute(node, "size", "0"));
+
+        if (nativeJar && main)
+            if (strict) 
+                throw new ParseException(R("PNativeHasMain"));
+
+        return new JARDesc(location, version, part, lazy, main, nativeJar, true);
+
+    }
+
+    /**
+     * Returns the Extension element at the specified node.
+     *
+     * @param node the extension node 
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public ExtensionDesc getExtension(Node node) throws ParseException {
+        String name = getAttribute(node, "name", null);
+        Version version = getVersion(node, "version", null);
+        URL location = getRequiredURL(node, "href", base);
+
+        ExtensionDesc ext = new ExtensionDesc(name, version, location, null);
+
+        Node dload[] = getChildNodes(node, "ext-download");
+        for (int i=0; i < dload.length; i++) {
+            boolean lazy = "lazy".equals(getAttribute(node, "download", "eager"));
+
+            ext.addPart(getRequiredAttribute(node, "ext-part", null),
+                        getAttribute(node, "part", null),
+                        lazy);
+        }
+
+        return ext;
+    }
+
+    /**
+     * Returns the Property element at the specified node.
+     *
+     * @param node the property node 
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public PropertyDesc getProperty(Node node) throws ParseException {
+        String name = getRequiredAttribute(node, "name", null);
+        String value = getRequiredAttribute(node, "value", "");
+
+        return new PropertyDesc(name, value);
+    }
+
+    /**
+     * Returns the Package element at the specified node.
+     *
+     * @param node the package node 
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public PackageDesc getPackage(Node node) throws ParseException {
+        String name = getRequiredAttribute(node, "name", null);
+        String part = getRequiredAttribute(node, "part", "");
+        boolean recursive = getAttribute(node, "recursive", "false").equals("true");
+
+        return new PackageDesc(name, part, recursive);
+    }
+
+    // 
+    // This section loads the information elements
+    // 
+
+    /**
+     * Returns all of the information elements under the specified
+     * node.
+     *
+     * @param parent the parent node (jnlp)
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public List getInfo(Node parent) throws ParseException {
+        List result = new ArrayList();
+        Node info[] = getChildNodes(parent, "information");
+
+        // ensure that there are at least one information section present
+        if (info.length == 0)
+            throw new ParseException(R("PNoInfoElement"));
+
+        // create objects from the info sections
+        for (int i=0; i < info.length; i++)
+            result.add(getInformationDesc(info[i]));
+
+        return result;
+    }
+
+    /**
+     * Returns the information element at the specified node.
+     *
+     * @param node the information node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public InformationDesc getInformationDesc(Node node) throws ParseException {
+        List descriptionsUsed = new ArrayList();
+
+        // locale
+        Locale locales[] = getLocales(node);
+
+        // create information
+        InformationDesc info = new InformationDesc(file, locales);
+
+        // step through the elements
+        Node child = node.getFirstChild();
+        while (child != null) {
+            String name = child.getNodeName();
+
+            if ("title".equals(name))
+                addInfo(info, child, null, getSpanText(child));
+            if ("vendor".equals(name))
+                addInfo(info, child, null, getSpanText(child));
+            if ("description".equals(name)) {
+                String kind = getAttribute(child, "kind", "default");
+                if (descriptionsUsed.contains(kind))
+                    if (strict)
+                        throw new ParseException(R("PTwoDescriptions", kind));
+
+                descriptionsUsed.add(kind);
+                addInfo(info, child, kind, getSpanText(child));
+            }
+            if ("homepage".equals(name))
+                addInfo(info, child, null, getRequiredURL(child, "href", base));
+            if ("icon".equals(name))
+                addInfo(info, child, getAttribute(child, "kind", "default"), getIcon(child));
+            if ("offline-allowed".equals(name))
+                addInfo(info, child, null, Boolean.TRUE);
+            if ("sharing-allowed".equals(name)) {
+                if (strict && !allowExtensions)
+                    throw new ParseException(R("PSharing"));
+                addInfo(info, child, null, Boolean.TRUE);
+            }
+
+            child = child.getNextSibling();
+        }
+
+        return info;
+    }
+
+    /**
+     * Adds a key,value pair to the information object.
+     *
+     * @param info the information object 
+     * @param node node name to be used as the key
+     * @param mod key name appended with "-"+mod if not null
+     * @param value the info object to add (icon or string)
+     */
+    protected void addInfo(InformationDesc info, Node node, String mod, Object value) {
+        String modStr = (mod == null) ? "" : "-"+mod;
+
+        if (node == null)
+            return;
+
+        info.addItem(node.getNodeName()+modStr, value);
+    }
+
+    /**
+     * Returns the icon element at the specified node.
+     *
+     * @param node the icon node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public IconDesc getIcon(Node node) throws ParseException {
+        int width = Integer.parseInt(getAttribute(node, "width", "-1"));
+        int height = Integer.parseInt(getAttribute(node, "height", "-1"));
+        int size = Integer.parseInt(getAttribute(node, "size", "-1"));
+        int depth = Integer.parseInt(getAttribute(node, "depth", "-1"));
+        URL location = getRequiredURL(node, "href", base);
+        Object kind = getAttribute(node, "kind", "default"); 
+
+        return new IconDesc(location, kind, width, height, depth, size);
+    }
+
+    // 
+    // This section loads the security descriptor element
+    // 
+
+    /**
+     * Returns the security descriptor element.  If no security
+     * element was specified in the JNLP file then a SecurityDesc
+     * with applet permissions is returned.
+     *
+     * @param parent the parent node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public SecurityDesc getSecurity(Node parent) throws ParseException {
+        Node nodes[] = getChildNodes(parent, "security");
+
+        // test for too many security elements
+        if (nodes.length > 1) 
+            if (strict)
+                throw new ParseException(R("PTwoSecurity"));
+
+        Object type = SecurityDesc.SANDBOX_PERMISSIONS;
+
+        if (nodes.length == 0)
+            type = SecurityDesc.SANDBOX_PERMISSIONS;
+        else if (null != getChildNode(nodes[0], "all-permissions"))
+            type = SecurityDesc.ALL_PERMISSIONS;
+        else if (null != getChildNode(nodes[0], "j2ee-application-client-permissions"))
+            type = SecurityDesc.J2EE_PERMISSIONS;
+        else if (strict)
+            throw new ParseException(R("PEmptySecurity"));
+
+        if (base != null)
+            return new SecurityDesc(file, type, base.getHost());
+        else
+            return new SecurityDesc(file, type, null);
+    }
+
+    /**
+     * Returns whether the JNLP file requests a trusted execution
+     * environment.
+     */
+    protected boolean isTrustedEnvironment() {
+        Node security = getChildNode(root, "security");
+
+        if (security != null)
+            if (getChildNode(security, "all-permissions") != null
+                || getChildNode(security, "j2ee-application-client-permissions") != null)
+                return true;
+
+        return false;
+    }
+
+    // 
+    // This section loads the launch descriptor element
+    // 
+
+    /**
+     * Returns the launch descriptor element, either AppletDesc,
+     * ApplicationDesc, ComponentDesc, or InstallerDesc.
+     *
+     * @param parent the parent node
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public Object getLauncher(Node parent) throws ParseException {
+        // check for other than one application type
+        if (1 != getChildNodes(parent, "applet-desc").length
+            + getChildNodes(parent, "application-desc").length
+            + getChildNodes(parent, "component-desc").length
+            + getChildNodes(parent, "installer-desc").length)
+            throw new ParseException(R("PTwoDescriptors"));
+
+        Node child = parent.getFirstChild();
+        while (child != null) {
+            String name = child.getNodeName();
+
+            if ("applet-desc".equals(name))
+                return getApplet(child);
+            if ("application-desc".equals(name))
+                return getApplication(child);
+            if ("component-desc".equals(name))
+                return getComponent(child);
+            if ("installer-desc".equals(name))
+                return getInstaller(child);
+
+            child = child.getNextSibling();
+        }
+
+        // not reached
+        return null;
+    }
+
+    /**
+     * Returns the applet descriptor.
+     *
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public AppletDesc getApplet(Node node) throws ParseException {
+        String name = getRequiredAttribute(node, "name", R("PUnknownApplet"));
+        String main = getRequiredAttribute(node, "main-class", null);
+        URL docbase = getURL(node, "documentbase", base);
+        Map paramMap = new HashMap();
+        int width = 0;
+        int height = 0;
+
+        try {
+            width = Integer.parseInt(getRequiredAttribute(node, "width", "100"));
+            height = Integer.parseInt(getRequiredAttribute(node, "height", "100"));
+        }
+        catch (NumberFormatException nfe) {
+            if (width <= 0)
+                throw new ParseException(R("PBadWidth"));
+            throw new ParseException(R("PBadWidth"));
+        }
+
+        // read params
+        Node params[] = getChildNodes(node, "param");
+        for (int i=0; i < params.length; i++) {
+            paramMap.put(getRequiredAttribute(params[i], "name", null),
+                         getRequiredAttribute(params[i], "value", ""));
+        }
+
+        return new AppletDesc(name, main, docbase, width, height, paramMap);
+    }
+
+    /**
+     * Returns the application descriptor.
+     *
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public ApplicationDesc getApplication(Node node) throws ParseException {
+        String main = getAttribute(node, "main-class", null);
+        List argsList = new ArrayList();
+
+        // if (main == null)
+        //   only ok if can be found in main jar file (can't check here but make a note)
+
+        // read parameters
+        Node args[] = getChildNodes(node, "argument");
+        for (int i=0; i < args.length; i++) {
+            //argsList.add( args[i].getNodeValue() );
+            
+            //This approach was not finding the argument text
+            argsList.add( getSpanText(args[i]) );
+        }
+
+        String argStrings[] = 
+            (String[]) argsList.toArray( new String[argsList.size()] );
+
+        return new ApplicationDesc(main, argStrings);
+    }
+
+    /**
+     * Returns the component descriptor.
+     */
+    public ComponentDesc getComponent(Node node) {
+        return new ComponentDesc();
+    }
+
+    /**
+     * Returns the installer descriptor.
+     */
+    public InstallerDesc getInstaller(Node node) {
+        String main = getAttribute(node, "main-class", null);
+
+        return new InstallerDesc(main);
+    }
+
+    // other methods
+
+    /**
+     * Returns an array of substrings seperated by spaces (spaces
+     * escaped with backslash do not separate strings).  This method
+     * splits strings as per the spec except that it does replace
+     * escaped other characters with their own value.
+     */
+    public String[] splitString(String source) {
+        if (source == null)
+            return new String[0];
+
+        List result = new ArrayList();
+        StringTokenizer st = new StringTokenizer(source, " ");
+        StringBuffer part = new StringBuffer();
+        while (st.hasMoreTokens()) {
+            part.setLength(0);
+
+            // tack together tokens joined by backslash
+            while (true) {
+                part.append(st.nextToken());
+
+                if (st.hasMoreTokens() && part.charAt(part.length()-1) == '\\')
+                    part.setCharAt(part.length()-1, ' '); // join with the space
+                else
+                    break; // bizarre while format gets \ at end of string right (no extra space added at end)
+            } 
+
+            // delete \ quote chars
+            for (int i = part.length(); i-- > 0;) // sweet syntax for reverse loop
+                if (part.charAt(i) == '\\')
+                    part.deleteCharAt(i--); // and skip previous char so \\ becomes \
+
+            result.add( part.toString() );
+        }
+
+        return (String[]) result.toArray(new String[result.size()] );
+    }
+
+    /**
+     * Returns the Locale object(s) from a node's locale attribute.
+     *
+     * @param node the node with a locale attribute
+     */
+    public Locale[] getLocales(Node node) {
+        List locales = new ArrayList();
+        String localeParts[] = 
+            splitString(getAttribute(node, "locale", ""));
+
+        for (int i=0; i < localeParts.length; i++) {
+            Locale l = getLocale( localeParts[i] );
+            if (l != null)
+                locales.add(l);
+        }
+
+        return (Locale[]) locales.toArray(new Locale[locales.size()] );
+    }
+
+    /**
+     * Returns a Locale from a single locale.
+     *
+     * @param locale the locale string
+     */
+    public Locale getLocale(String localeStr) {
+        if (localeStr.length() < 2)
+            return null;
+
+        String language = localeStr.substring(0, 2);
+        String country = (localeStr.length()<5) ? "" : localeStr.substring(3, 5);
+        String variant = (localeStr.length()<7) ? "" : localeStr.substring(6, 8);
+
+        // null is not allowed n locale but "" is
+        return new Locale(language, country, variant);
+    }
+
+
+
+    // XML junk
+
+    /**
+     * Returns the implied text under a node, for example "text" in
+     * "<description>text</description>".
+     *
+     * @param node the node with text under it
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public String getSpanText(Node node) throws ParseException {
+        if (node == null)
+            return null;
+
+        // NANO
+        return node.getNodeValue();
+
+        /* TINY
+        Node child = node.getFirstChild();
+
+        if (child == null) {
+            if (strict)
+                // not sure if this is an error or whether "" is proper
+                throw new ParseException("No text specified (node="+node.getNodeName()+")");
+            else
+                return "";
+        }
+
+        return child.getNodeValue();
+        */
+    }
+
+    /**
+     * Returns the first child node with the specified name.
+     */
+    public static Node getChildNode(Node node, String name) {
+        Node[] result = getChildNodes(node, name);
+        if (result.length == 0)
+            return null;
+        else
+            return result[0];
+    }
+
+    /**
+     * Returns all child nodes with the specified name.
+     */
+    public static Node[] getChildNodes(Node node, String name) {
+        List result = new ArrayList();
+
+        Node child = node.getFirstChild();
+        while (child != null) {
+            if (child.getNodeName().equals(name))
+                result.add(child);
+            child = child.getNextSibling();
+        }
+
+        return (Node[]) result.toArray( new Node[result.size()] );
+    }
+
+
+    /**
+     * Returns a URL with a trailing / appended to it if there is no
+     * trailing slash on the specifed URL.
+     */
+    private URL addSlash(URL source) {
+        if (source == null)
+            return null;
+
+        if (!source.toString().endsWith("/")) {
+            try { 
+                source = new URL(source.toString()+"/"); 
+            }
+            catch (MalformedURLException ex) {
+            }
+        }
+
+        return source;
+    }
+
+
+    /**
+     * Returns the same result as getURL except that a
+     * ParseException is thrown if the attribute is null or empty.
+     *
+     * @param node the node
+     * @param name the attribute containing an href
+     * @param base the base URL
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public URL getRequiredURL(Node node, String name, URL base) throws ParseException {
+        // probably should change "" to null so that url is always
+        // required even if !strict
+        getRequiredAttribute(node, name, "");
+
+        return getURL(node, name, base);
+    }
+
+
+    /**
+     * Returns a URL object from a href string relative to the
+     * code base.  If the href denotes a relative URL, it must
+     * reference a location that is a subdirectory of the
+     * codebase.<p>
+     *
+     * @param node the node
+     * @param name the attribute containing an href
+     * @param base the base URL
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public URL getURL(Node node, String name, URL base) throws ParseException {
+        String href = getAttribute(node, name, null);
+        if (href == null)
+            return null; // so that code can throw an exception if attribute was required
+
+        try {
+            if (base == null)
+                return new URL(href);
+            else {
+                try {
+                    return new URL(href);
+                }
+                catch (MalformedURLException ex) {
+                    // is relative
+                }
+
+                URL result = new URL(base, href);
+
+                // check for going above the codebase
+                if (! result.toString().startsWith( base.toString()) )
+                    if (strict)
+                        throw new ParseException(R("PUrlNotInCodebase", node.getNodeName(), href, base));
+
+                return result;
+            }
+
+        }
+        catch (MalformedURLException ex) {
+            if (base == null)
+                throw new ParseException(R("PBadNonrelativeUrl", node.getNodeName(), href));
+            else
+                throw new ParseException(R("PBadRelativeUrl", node.getNodeName(), href, base));
+        }
+    }
+
+    /**
+     * Returns a Version from the specified attribute and default
+     * value.
+     *
+     * @param node the node
+     * @param name the attribute
+     * @param defaultValue default if no such attribute
+     * @return a Version, or null if no such attribute and default is null
+     */
+    public Version getVersion(Node node, String name, String defaultValue) {
+        String version = getAttribute(node, name, defaultValue);
+        if (version == null)
+            return null;
+        else
+            return new Version(version);
+    }
+
+    /**
+     * Returns the same result as getAttribute except that if strict
+     * mode is enabled or the default value is null a parse
+     * exception is thrown instead of returning the default value.
+     *
+     * @param node the node
+     * @param name the attribute
+     * @param defaultValue default value
+     * @throws ParseException if the attribute does not exist or is empty
+     */
+    public String getRequiredAttribute(Node node, String name, String defaultValue) throws ParseException {
+        String result = getAttribute(node, name, null);
+
+        if (result == null || result.length() == 0)
+            if (strict || defaultValue == null)
+                throw new ParseException(R("PNeedsAttribute", node.getNodeName(), name));
+
+        if (result == null)
+            return defaultValue;
+        else
+            return result;
+    }
+
+    /**
+     * Retuns an attribute or the specified defaultValue if there is
+     * no such attribute.
+     *
+     * @param node the node
+     * @param name the attribute
+     * @param defaultValue default if no such attribute
+     */
+    public String getAttribute(Node node, String name, String defaultValue) {
+        // SAX
+        // String result = ((Element) node).getAttribute(name);
+        String result = node.getAttribute(name);
+
+        if (result == null || result.length()==0) 
+            return defaultValue;
+
+        return result;
+    }
+
+    /**
+     * Return the root node from the XML document in the specified
+     * input stream.
+     *
+     * @throws ParseException if the JNLP file is invalid
+     */
+    public static Node getRootNode(InputStream input) throws ParseException {
+        try {
+            /* SAX
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setValidating(false);
+            factory.setNamespaceAware(true);
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            builder.setErrorHandler(errorHandler);
+
+            Document doc = builder.parse(input);
+            return doc.getDocumentElement();
+            */
+
+            /* TINY
+            Node document = new Node(TinyParser.parseXML(input));
+            Node jnlpNode = getChildNode(document, "jnlp"); // skip comments
+            */
+
+            /* NANO */
+            final XMLElement xml = new XMLElement();
+            final PipedInputStream pin = new PipedInputStream();
+            final PipedOutputStream pout = new PipedOutputStream(pin);
+            final InputStreamReader isr = new InputStreamReader(input);
+            
+            // Clean the jnlp xml file of all comments before passing
+            // it to the parser.
+            new Thread(
+                new Runnable(){
+                    public void run(){
+                        (new XMLElement()).sanitizeInput(isr, pout);
+                        try {
+                            pout.close();
+                        } catch (IOException ioe) {
+                            ioe.printStackTrace();
+                        }
+                    }
+                }
+            ).start();
+            xml.parseFromReader(new InputStreamReader(pin));
+            Node jnlpNode = new Node(xml);
+            return jnlpNode;
+        }
+        catch(Exception ex) {
+            throw new ParseException(R("PBadXML"), ex);
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2007 Red Hat, Inc.
+ * This file is part of IcedTea, http://icedtea.classpath.org
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package net.sourceforge.jnlp;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.List;
+import java.util.ArrayList;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+
+public class PluginBridge extends JNLPFile
+{
+    Version specVersion = new Version("1.0");
+    Version fileVersion = new Version("1.1");
+
+    String name;
+    String[] jars = new String[0];
+    String[] cache_jars = new String[0];
+    String[] cache_ex_jars = new String[0];
+    Hashtable atts;
+
+    public PluginBridge(URL codebase, String cookieStr, URL documentBase, String jar, String main,
+                        int width, int height, Hashtable atts)
+    throws Exception
+    {
+        this.codeBase = codebase;
+        this.sourceLocation = documentBase;
+
+        // also, see if cache_archive is specified
+        if (atts.get("cache_archive") != null && ((String) atts.get("cache_archive")).length() > 0) {
+            
+            String[] versions = new String[0];
+            
+            // are there accompanying versions?
+            if (atts.get("cache_version") != null) {
+                versions = ((String) atts.get("cache_version")).split(",");
+            }
+            
+            String[] jars = ((String) atts.get("cache_archive")).split(",");
+            cache_jars = new String[jars.length];
+            
+            for (int i=0; i < jars.length; i++) {
+                
+                cache_jars[i] = jars[i].trim();
+
+                if (versions.length > 0) {
+                    cache_jars[i] += ";" + versions[i].trim(); 
+                }
+            }
+        }
+        
+        if (atts.get("cache_archive_ex") != null && ((String) atts.get("cache_archive_ex")).length() > 0) {
+            cache_ex_jars = ((String) atts.get("cache_archive_ex")).split(",");
+        }
+
+        if (jar != null && jar.length() > 0) {
+            this.jars = jar.split(",");
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Jar string: " + jar);
+                System.err.println("jars length: " + jars.length);
+            }
+        }
+        this.atts = atts;
+
+        name = (String) atts.get("name");
+        if (name == null)
+            name = "Applet";
+        else
+            name = name + " applet";
+
+        if (main.endsWith(".class"))
+            main = main.substring(0, main.length() - 6);
+
+        launchType = new AppletDesc(name, main, documentBase, width,
+                                    height, atts);
+
+        if (main.endsWith(".class")) //single class file only
+            security = new SecurityDesc(this, SecurityDesc.SANDBOX_PERMISSIONS,
+                                        codebase.getHost());
+        else
+            security = null;
+        
+        this.cookieStr = cookieStr;
+    }
+
+    public String getTitle()
+    {
+        return name;
+    }
+
+    public InformationDesc getInformation(final Locale locale)
+    {
+        return new InformationDesc(this, new Locale[] {locale}) {
+            protected List getItems(Object key)
+            {
+                // Should we populate this list with applet attribute tags?
+                List result = new ArrayList();
+                return result;
+            }
+        };
+    }
+
+    public ResourcesDesc getResources(final Locale locale, final String os,
+                                      final String arch)
+    {
+        return new ResourcesDesc(this, new Locale[] {locale}, new String[] {os},
+        new String[] {arch}) {
+            public List getResources(Class launchType)
+            {
+                List result = new ArrayList();
+                result.addAll(sharedResources.getResources(launchType));
+
+                // Need to add the JAR manually...
+                //should this be done to sharedResources on init?
+                try
+                {
+                    if (launchType.equals(JARDesc.class))
+                    {
+                        for (int i = 0; i < jars.length; i++)
+                            if (jars[i].length() > 0)
+                                result.add(new JARDesc(new URL(codeBase, jars[i]),
+                                        null, null, false, true, false, true));
+                        
+                        boolean cacheable = true;
+
+                        if (atts.get("cache_option") != null && 
+                                ((String) atts.get("cache_option")).equalsIgnoreCase("no"))
+                            cacheable = false;
+
+                        for (int i = 0; i < cache_jars.length; i++) {
+                            
+                            String[] jar_and_ver = cache_jars[i].split(";");
+                            
+                            String jar = jar_and_ver[0];
+                            Version version = null;
+                            
+                            if (jar.length() == 0)
+                                continue;
+                            
+                            if (jar_and_ver.length > 1) {
+                                version = new Version(jar_and_ver[1]);
+                            }
+
+                            result.add(new JARDesc(new URL(codeBase, jar),
+                                    version, null, false, true, false, cacheable));
+                        }
+                        
+                        for (int i = 0; i < cache_ex_jars.length; i++) {
+
+                            if (cache_ex_jars[i].length() == 0)
+                                continue;
+                            
+                            String[] jar_info = cache_ex_jars[i].split(";");
+                            
+                            String jar = jar_info[0].trim();
+                            Version version = null;
+                            boolean lazy = true;
+                            
+                            if (jar_info.length > 1) {
+                                
+                                // format is name[[;preload];version]
+
+                                if (jar_info[1].equals("preload")) {
+                                    lazy = false;
+                                } else {
+                                    version = new Version(jar_info[1].trim());
+                                }
+                                
+                                if (jar_info.length > 2) {
+                                    lazy = false;
+                                    version = new Version(jar_info[2].trim());
+                                }
+                            }
+
+                            result.add(new JARDesc(new URL(codeBase, jar),
+                                    version, null, lazy, true, false, false));
+                        }
+                    }
+                }
+                catch (MalformedURLException ex)
+                    { }
+                return result;
+            }
+
+            public JARDesc[] getJARs() {
+                List resources = getResources(JARDesc.class);
+                ArrayList<JARDesc> jars = new ArrayList<JARDesc>();
+
+                //Only get the JARDescs
+                for (int i = 0; i < resources.size(); i++) {
+                    Object resource = resources.get(i);
+                    if (resource instanceof JARDesc)
+                        jars.add((JARDesc) resource);
+                }
+
+                Object[] objectArray = jars.toArray();
+                JARDesc[] jarArray = new JARDesc[objectArray.length];
+
+                for (int i = 0; i < objectArray.length; i++)
+                    jarArray[i] = (JARDesc) objectArray[i];
+
+                return jarArray;  
+            }
+            
+            public void addResource(Object resource)
+            {
+                // todo: honor the current locale, os, arch values
+                sharedResources.addResource(resource);
+            }
+
+        };
+    }
+
+    public boolean isApplet() {
+        return true;
+    }
+    public boolean isApplication() {
+        return false;
+    }
+    public boolean isComponent() {
+        return false;
+    }
+    public boolean isInstaller() {
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/PropertyDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,66 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/** 
+ * The property element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $
+ */
+public class PropertyDesc {
+
+    /** the key name */
+    private String key;
+
+    /** the value */
+    private String value;
+
+
+    /**
+     * Creates a property descriptor.
+     *
+     * @param key the key name
+     * @param value the value
+     */
+    public PropertyDesc(String key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    /**
+     * Returns the property's key 
+     */
+    public String getKey() {
+        return key;
+    }
+
+    /**
+     * Returns the property's value 
+     */
+    public String getValue() {
+        return value;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ResourcesDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,231 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.awt.Dimension;
+import java.net.*;
+import java.util.*;
+
+/**
+ * The resources element.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $
+ */
+public class ResourcesDesc {
+
+    /** the locales of these resources */
+    private Locale locales[];
+
+    /** the OS for these resources */
+    private String os[];
+
+    /** the arch for these resources */
+    private String arch[];
+
+    /** the JNLPFile this information is for */
+    private JNLPFile jnlpFile;
+
+    /** list of jars, packages, properties, and extensions */
+    private List resources = new ArrayList(); // mixed list makes easier for lookup code
+
+
+    /**
+     * Create a representation of one information section of the
+     * JNLP File.
+     *
+     * @param jnlpFile JNLP file the resources are for
+     * @param locales the locales of these resources
+     * @param os the os of these resources
+     * @param arch the arch of these resources
+     */
+    public ResourcesDesc(JNLPFile jnlpFile, Locale locales[], String os[], String arch[]) {
+        this.jnlpFile = jnlpFile;
+        this.locales = locales;
+        this.os = os;
+        this.arch = arch;
+    }
+
+    /**
+     * Returns the JVMs.
+     */
+    public JREDesc[] getJREs() {
+        List resources = getResources(JREDesc.class);
+        return (JREDesc[]) resources.toArray( new JREDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the main JAR for these resources.  There first JAR
+     * is returned if no JARs are specified as the main JAR, and if
+     * there are no JARs defined then null is returned.
+     */
+    public JARDesc getMainJAR() {
+        JARDesc jars[] = getJARs();
+
+        for (int i=0; i < jars.length; i++)
+            if (jars[i].isMain())
+                return jars[i];
+
+        if (jars.length > 0)
+            return jars[0];
+        else 
+            return null;
+    }
+
+    /**
+     * Returns all of the JARs. 
+     */
+    public JARDesc[] getJARs() {
+        List resources = getResources(JARDesc.class);
+        return (JARDesc[]) resources.toArray( new JARDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the JARs with the specified part name. 
+     *
+     * @param partName the part name, null and "" equivalent
+     */
+    public JARDesc[] getJARs(String partName) {
+        List resources = getResources(JARDesc.class);
+
+        for (int i = resources.size(); i-- > 0;) {
+            JARDesc jar = (JARDesc) resources.get(i);
+
+            if (!(""+jar.getPart()).equals(""+partName))
+                resources.remove(i);
+        }
+
+        return (JARDesc[]) resources.toArray( new JARDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the Extensions.
+     */
+    public ExtensionDesc[] getExtensions() {
+        List resources = getResources(ExtensionDesc.class);
+        return (ExtensionDesc[]) resources.toArray( new ExtensionDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the Packages.
+     */
+    public PackageDesc[] getPackages() {
+        List resources = getResources(PackageDesc.class);
+        return (PackageDesc[]) resources.toArray( new PackageDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the Packages that match the specified class name.
+     *
+     * @param className the fully qualified class name
+     * @return the PackageDesc objects matching the class name
+     */
+    public PackageDesc[] getPackages(String className) {
+        List resources = getResources(PackageDesc.class);
+
+        for (int i = resources.size(); i-- > 0;) {
+            PackageDesc pk = (PackageDesc) resources.get(i);
+
+            if (!pk.matches(className))
+                resources.remove(i);
+        }
+
+        return (PackageDesc[]) resources.toArray( new PackageDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the Properties as a list.
+     */
+    public PropertyDesc[] getProperties() {
+        List resources = getResources(PropertyDesc.class);
+        return (PropertyDesc[]) resources.toArray( new PropertyDesc[resources.size()] );
+    }
+
+    /**
+     * Returns the properties as a map.
+     */
+    public Map getPropertiesMap() {
+        Properties properties = new Properties();
+        List resources = getResources(PropertyDesc.class);
+        for (int i=0; i < resources.size(); i++) {
+            PropertyDesc prop = (PropertyDesc) resources.get(i);
+            properties.put( prop.getKey(), prop.getValue() );
+        }
+
+        return properties;
+    }
+
+    /**
+     * Returns the os required by these resources, or null if no
+     * locale was specified in the JNLP file.
+     */
+    public String[] getOS() {
+        return os;
+    }
+
+    /**
+     * Returns the architecture required by these resources, or null
+     * if no locale was specified in the JNLP file.
+     */
+    public String[] getArch() {
+        return arch;
+    }
+
+    /**
+     * Returns the locale required by these resources, or null if no
+     * locale was specified in the JNLP file.
+     */
+    public Locale[] getLocales() {
+        return locales;
+    }
+
+    /**
+     * Returns the JNLPFile the resources are for.
+     */
+    public JNLPFile getJNLPFile() {
+        return jnlpFile;
+    }
+
+    /**
+     * Returns all resources of the specified type.
+     */
+    public List getResources(Class type) {
+        List result = new ArrayList();
+
+        for (int i=0; i < resources.size(); i++)
+            if ( type.isAssignableFrom(resources.get(i).getClass()) )
+                result.add(resources.get(i));
+
+        return result;
+    }
+
+    /**
+     * Add a resource.
+     */
+    public void addResource(Object resource) {
+        // if this is going to stay public it should probably take an
+        // interface instead of an Object
+        if (resource == null)
+            throw new IllegalArgumentException("null resource");
+
+        resources.add(resource);
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/SecurityDesc.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,173 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.security.*;
+import java.awt.AWTPermission;
+
+/**
+ * The security element.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $
+ */
+public class SecurityDesc {
+
+    // todo: make sure classloader's native code support checks
+    // the security permissions
+
+    // shouldn't need to verify that native code only runs in
+    // trusted environment because the parser and/or classloader
+    // should kick it.
+
+    /** All permissions. */
+    public static final Object ALL_PERMISSIONS = "All";
+
+    /** Applet permissions. */
+    public static final Object SANDBOX_PERMISSIONS = "Sandbox";
+
+    /** J2EE permissions. */
+    public static final Object J2EE_PERMISSIONS = "J2SE";
+
+    /** permissions type */
+    private Object type;
+
+    /** the download host */
+    private String downloadHost;
+
+    /** the JNLP file */
+    private JNLPFile file;
+
+
+    /** basic permissions for restricted mode */
+    private static Permission j2eePermissions[] = {
+        new AWTPermission("accessClipboard"),
+        // disabled because we can't at this time prevent an
+        // application from accessing other applications' event
+        // queues, or even prevent access to security dialog queues.
+        //
+        // new AWTPermission("accessEventQueue"),
+        new AWTPermission("showWindowWithoutWarningBanner"),
+        new RuntimePermission("exitVM"),
+        new RuntimePermission("loadLibrary"),
+        new RuntimePermission("queuePrintJob"),
+        new SocketPermission("*", "connect"),
+        new SocketPermission("localhost:1024-", "accept, listen"),
+        new FilePermission("*", "read, write"),
+        new PropertyPermission("*", "read"),
+    };
+
+    /** basic permissions for restricted mode */
+    private static Permission sandboxPermissions[] = {
+        new SocketPermission("localhost:1024-", "listen"),
+        // new SocketPermission("<DownloadHost>", "connect, accept"), // added by code
+        new PropertyPermission("java.version", "read"),
+        new PropertyPermission("java.vendor", "read"),
+        new PropertyPermission("java.vendor.url", "read"),
+        new PropertyPermission("java.class.version", "read"),
+        new PropertyPermission("os.name", "read"),
+        new PropertyPermission("os.version", "read"),
+        new PropertyPermission("os.arch", "read"),
+        new PropertyPermission("file.separator", "read"),
+        new PropertyPermission("path.separator", "read"),
+        new PropertyPermission("line.separator", "read"),
+        new PropertyPermission("java.specification.version", "read"),
+        new PropertyPermission("java.specification.vendor", "read"),
+        new PropertyPermission("java.specification.name", "read"),
+        new PropertyPermission("java.vm.specification.vendor", "read"),
+        new PropertyPermission("java.vm.specification.name", "read"),
+        new PropertyPermission("java.vm.version", "read"),
+        new PropertyPermission("java.vm.vendor", "read"),
+        new PropertyPermission("java.vm.name", "read"),
+        new RuntimePermission("exitVM"),
+        new RuntimePermission("stopThread"),
+        new AWTPermission("showWindowWithoutWarningBanner"),
+        // disabled because we can't at this time prevent an
+        // application from accessing other applications' event
+        // queues, or even prevent access to security dialog queues.
+        //
+        // new AWTPermission("accessEventQueue"),
+    };
+
+
+    /**
+     * Create a security descriptor.
+     *
+     * @param file the JNLP file
+     * @param type the type of security
+     * @param downloadHost the download host (can always connect to)
+     */
+    public SecurityDesc(JNLPFile file, Object type, String downloadHost) {
+        this.file = file;
+        this.type = type;
+        this.downloadHost = downloadHost;
+    }
+
+    /**
+     * Returns the permissions type, one of: ALL_PERMISSIONS,
+     * SANDBOX_PERMISSIONS, J2EE_PERMISSIONS.
+     */
+    public Object getSecurityType() {
+        return type;
+    }
+
+    /**
+     * Returns a PermissionCollection containing the basic
+     * permissions granted depending on the security type.
+     */
+    public PermissionCollection getPermissions() {
+        Permissions permissions = new Permissions();
+
+        // all
+        if (type == ALL_PERMISSIONS) {
+            permissions.add(new AllPermission());
+            return permissions;
+        }
+
+        // restricted
+        if (type == SANDBOX_PERMISSIONS) {
+            for (int i=0; i < sandboxPermissions.length; i++)
+                permissions.add(sandboxPermissions[i]);
+
+            if (downloadHost != null)
+                permissions.add(new SocketPermission(downloadHost,
+                                                     "connect, accept"));
+        }
+
+        // j2ee
+        if (type == J2EE_PERMISSIONS)
+            for (int i=0; i < j2eePermissions.length; i++)
+                permissions.add(j2eePermissions[i]);
+
+        // properties
+        PropertyDesc props[] = file.getResources().getProperties();
+        for (int i=0; i < props.length; i++) {
+            // should only allow jnlp.* properties if in sandbox?
+            permissions.add(new PropertyPermission(props[i].getKey(), "read,write"));
+        }
+
+        return permissions;
+    }
+
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/Version.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,354 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * A JNLP Version string in the form "1.2-3_abc" followed by an
+ * optional + (includes all later versions) or * (matches any
+ * suffixes on versions).  More than one version can be included
+ * in a string by separating them with spaces.<p>
+ *
+ * Version strings are divided by "._-" charecters into parts.
+ * These parts are compared numerically if they can be parsed as
+ * integers or lexographically as strings otherwise.  If the
+ * number of parts is different between two version strings then
+ * the smaller one is padded with zero or the empty string.  Note
+ * that the padding in this version means that 1.2+ matches
+ * 1.4.0-beta1, but may not in future versions.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $ 
+ */
+public class Version {
+
+    // to do: web start does not match versions with a "-" like
+    // "1.4-beta1" using the + modifier, change to mimic that
+    // behavior.
+
+    // also refactor into Version and VersionID classes so that
+    // individual version ids can be easily modified to add/remove
+    // "*" and "+" modifiers.
+
+    /** separates parts of a version string */
+    private static String seperators = ".-_";
+
+    /** magic key for whether a version part was created due to normalization */
+    private static String emptyString = new String("<EMPTY>"); // not intern'ed
+
+    /** contains all the versions matched */
+    private String versionString;
+
+
+    /**
+     * Create a Version object based on a version string (ie, 
+     * "1.2.3+ 4.56*").
+     */
+    public Version(String versions) {
+        versionString = versions;
+    }
+
+    /**
+     * Returns true if the version represents a <i>version-id</i> (a
+     * single version number such as 1.2) and false otherwise.
+     */
+    public boolean isVersionId() {
+        if (-1 != versionString.indexOf(" "))
+            return false;
+
+        return true;
+    }
+
+    /**
+     * Returns true if all of this version's version-ids match one
+     * or more of the specifed version's version-id.
+     *
+     * @param version a version string
+     */
+    public boolean matches(String version) {
+        return matches(new Version(version));
+    }
+
+    /**
+     * Returns true if all of this version's version-ids match one
+     * or more of the specifed version's version-id.
+     *
+     * @param version a Version object
+     */
+    public boolean matches(Version version) {
+        List versionStrings = version.getVersionStrings();
+
+        for (int i=0; i < versionStrings.size(); i++) {
+            if (!this.matchesSingle( (String)versionStrings.get(i) ))
+                return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns true if any of this version's version-ids match one
+     * or more of the specifed version's version-id.
+     *
+     * @param version a version string
+     */
+    public boolean matchesAny(String version) {
+        return matches(new Version(version));
+    }
+
+
+    /**
+     * Returns true if any of this version's version-ids match one
+     * or more of the specifed version's version-id.
+     *
+     * @param version a Version object
+     */
+    public boolean matchesAny(Version version) {
+        List versionStrings = version.getVersionStrings();
+
+        for (int i=0; i < versionStrings.size(); i++) {
+            if (this.matchesSingle( (String)versionStrings.get(i) ))
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns whether a single version string is supported by this
+     * Version.
+     *
+     * @param version a non-compound version of the form "1.2.3[+*]"
+     */
+    private boolean matchesSingle(String version) {
+        List versionStrings = this.getVersionStrings();
+        for (int i=0; i < versionStrings.size(); i++) {
+            if ( matches(version, (String)versionStrings.get(i)) )
+                return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * Returns whether a single version string is supported by
+     * another single version string.
+     *
+     * @param subversion a non-compound version without "+" or "*"
+     * @param version a non-compound version optionally with "+" or "*"
+     */
+    private boolean matches(String subversion, String version) {
+        List subparts = getParts(subversion);
+        List parts = getParts(version);
+
+        int maxLength = Math.max(subversion.length(), version.length());
+        if (version.endsWith("*")) // star means rest of parts irrelevant: truncate them
+            maxLength = parts.size();
+
+        normalize(new List[] {subparts, parts}, maxLength);
+
+        if (equal(subparts, parts))
+            return true;
+
+        if (version.endsWith("+") && greater(subparts, parts))
+            return true;
+
+        return false;
+    }
+
+    /**
+     * Returns whether the parts of one version are equal to the
+     * parts of another version.
+     *
+     * @param parts1 normalized version parts 
+     * @param parts2 normalized version parts
+     */
+    protected boolean equal(List parts1, List parts2) {
+        for (int i=0; i < parts1.size(); i++) {
+            if ( 0 != compare((String)parts1.get(i), (String)parts2.get(i)) )
+                return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns whether the parts of one version are greater than 
+     * the parts of another version.
+     *
+     * @param parts1 normalized version parts 
+     * @param parts2 normalized version parts
+     */
+    protected boolean greater(List parts1, List parts2) {
+        //if (true) return false;
+
+        for (int i=0; i < parts1.size(); i++) {
+            // if part1 > part2 then it's a later version, so return true
+            if (compare((String)parts1.get(i), (String)parts2.get(i)) > 0)
+                return true;
+
+            // if part1 < part2 then it's a ealier version, so return false
+            if (compare((String)parts1.get(i), (String)parts2.get(i)) < 0)
+                return false;
+
+            // if equal go to next part
+        }
+
+        // all parts were equal
+        return false; // not greater than
+    }
+
+    /**
+     * Compares two parts of a version string, by value if both can
+     * be interpreted as integers or lexically otherwise.  If a part
+     * is the result of normalization then it can be the Integer
+     * zero or an empty string.
+     *
+     * Returns a value equivalent to part1.compareTo(part2);
+     *
+     * @param part1 a part of a version string
+     * @param part2 a part of a version string
+     * @return comparison of the two parts
+     */
+    protected int compare(String part1, String part2) {
+        Integer number1 = new Integer(0);
+        Integer number2 = new Integer(0);
+
+        // compare as integers
+        try {
+            if (!(part1 == emptyString)) // compare to magic normalization key
+                number1 = Integer.valueOf(part1);
+
+            if (!(part2 == emptyString)) // compare to magic normalization key
+                number2 = Integer.valueOf(part2);
+
+            return number1.compareTo(number2);
+        }
+        catch (NumberFormatException ex) {
+            // means to compare as strings
+        }
+
+        if (part1 == emptyString)
+            part1 = "";
+        if (part2 == emptyString)
+            part2 = "";
+
+        return part1.compareTo(part2);
+    }
+
+    /**
+     * Normalize version strings so that they contain the same
+     * number of constituent parts.
+     *
+     * @param versions list array of parts of a version string
+     * @param maxLength truncate lists to this maximum length
+     */
+    protected void normalize(List versions[], int maxLength) {
+        int length = 0;
+        for (int i=0; i < versions.length; i++)
+            length = Math.max(length, versions[i].size());
+
+        if (length > maxLength)
+            length = maxLength;
+
+        for (int i=0; i < versions.length; i++) {
+            // remove excess elements
+            while (versions[i].size() > length)
+                versions[i].remove( versions[i].size()-1 );
+
+            // add in empty pad elements
+            while (versions[i].size() < length)
+                versions[i].add( emptyString );
+        }
+    }
+
+    /**
+     * Return the individual version strings that make up a Version.
+     */
+    protected List getVersionStrings() {
+        ArrayList strings = new ArrayList();
+
+        StringTokenizer st = new StringTokenizer(versionString, " ");
+        while (st.hasMoreTokens())
+            strings.add( st.nextToken() );
+
+        return strings;
+    }
+
+    /**
+     * Return the constituent parts of a version string.
+     *
+     * @param oneVersion a single version id string (not compound)
+     */
+    protected List getParts(String oneVersion) {
+        ArrayList strings = new ArrayList();
+
+        StringTokenizer st = new StringTokenizer(oneVersion, seperators+"+*");
+        while (st.hasMoreTokens()) {
+            strings.add( st.nextToken() );
+        }
+
+        return strings;
+    }
+
+    public String toString() {
+        return versionString;
+    }
+
+    /**
+     * Test.
+     */
+    /*
+    public static void main(String args[]) {
+        Version jvms[] = {
+            new Version("1.1* 1.3*"),
+            new Version("1.2+"),
+        };
+
+        Version versions[] = {
+            new Version("1.1"),
+            new Version("1.1.8"),
+            new Version("1.2"),
+            new Version("1.3"),
+            new Version("2.0"),
+            new Version("1.3.1"),
+            new Version("1.2.1"),
+            new Version("1.3.1-beta"),
+            new Version("1.1 1.2"),
+            new Version("1.2 1.3"),
+        };
+
+        for (int j = 0; j < jvms.length; j++) {
+            for (int v = 0; v < versions.length; v++) {
+                System.out.print( jvms[j].toString() + " " );
+                if (!jvms[j].matches(versions[v]))
+                    System.out.print( "!" );
+                System.out.println( "matches " + versions[v].toString() );
+            }
+        }
+
+        System.out.println("Test completed");
+    }
+    */
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/CacheEntry.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,174 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.reflect.*;
+import java.security.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * Describes an entry in the cache.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.10 $ 
+ */
+public class CacheEntry {
+
+    /** the remote resource location */
+    private URL location;
+
+    /** the requested version */
+    private Version version;
+
+    /** info about the cached file */
+    private PropertiesFile properties;
+
+
+    /**
+     * Create a CacheEntry for the resources specified as a remote
+     * URL.
+     *
+     * @param location the remote resource location
+     * @param version the version of the resource
+     */
+    public CacheEntry(URL location, Version version) {
+        this.location = location;
+        this.version = version;
+
+        File infoFile = CacheUtil.getCacheFile(location, version);
+        infoFile = new File(infoFile.getPath()+".info"); // replace with something that can't be clobbered
+
+        properties = new PropertiesFile(infoFile, JNLPRuntime.getMessage("CAutoGen"));
+    }
+
+    /**
+     * Initialize the cache entry data from a connection to the
+     * remote resource (does not store data).
+     */
+    void initialize(URLConnection connection) {
+        long modified = connection.getLastModified();
+        long length = connection.getContentLength(); // an int
+
+        properties.setProperty("content-length", Long.toString(length));
+        properties.setProperty("last-modified", Long.toString(modified));
+    }
+
+    /**
+     * Returns the remote location this entry caches.
+     */
+    public URL getLocation() {
+        return location;
+    }
+
+    /**
+     * Returns the time in the local system clock that the file was
+     * most recently checked for an update.
+     */
+    public long getLastUpdated() {
+        try {
+            return Long.parseLong(properties.getProperty("last-updated"));
+        }
+        catch (Exception ex) {
+            return 0;
+        }
+    }
+
+    /**
+     * Sets the time in the local system clock that the file was
+     * most recently checked for an update.
+     */
+    public void setLastUpdated(long updatedTime) {
+        properties.setProperty("last-updated", Long.toString(updatedTime));
+    }
+
+    /**
+     * Returns whether there is a version of the URL contents in
+     * the cache and it is up to date.  This method may not return
+     * immediately.
+     *
+     * @param connection a connection to the remote URL
+     * @return whether the cache contains the version
+     */
+    public boolean isCurrent(URLConnection connection) {
+        boolean cached = isCached();
+
+        if (!cached)
+            return false;
+
+        try {
+            long remoteModified = connection.getLastModified();
+            long cachedModified = Long.parseLong(properties.getProperty("last-modified"));
+
+            if (remoteModified > 0 && remoteModified <= cachedModified)
+                return true;
+            else
+                return false;
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            return cached; // if can't connect return whether already in cache
+        }
+    }
+
+    /**
+     * Returns true if the cache has a local copy of the contents
+     * of the URL matching the specified version string.
+     *
+     * @return true if the resource is in the cache
+     */
+    public boolean isCached() {
+        File localFile = CacheUtil.getCacheFile(location, version);
+        if (!localFile.exists())
+            return false;
+
+        try {
+            long cachedLength = localFile.length();
+            long remoteLength = Long.parseLong(properties.getProperty("content-length", "-1"));
+
+            if (remoteLength >= 0 && cachedLength != remoteLength)
+                return false;
+            else
+                return true;
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            return false; // should throw?
+        }
+    }
+
+    /**
+     * Save the current information for the cache entry.
+     */
+    protected void store() {
+        properties.store();
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/CacheUtil.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,394 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.reflect.*;
+import java.security.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * Provides static methods to interact with the cache, download
+ * indicator, and other utility methods.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.17 $
+ */
+public class CacheUtil {
+
+    private static String R(String key, Object param) { 
+        return JNLPRuntime.getMessage(key, new Object[] {param}); 
+    }
+
+    /**
+     * Compares a URL using string compare of its protocol, host,
+     * port, path, query, and anchor.  This method avoids the host
+     * name lookup that URL.equals does for http: protocol URLs.
+     * It may not return the same value as the URL.equals method
+     * (different hostnames that resolve to the same IP address,
+     * ie sourceforge.net and www.sourceforge.net).
+     */
+    public static boolean urlEquals(URL u1, URL u2) {
+        if (u1==u2)
+            return true;
+        if (u1==null || u2==null)
+            return false;
+
+        if (!compare(u1.getProtocol(), u2.getProtocol(), true) ||
+            !compare(u1.getHost(), u2.getHost(), true) ||
+            //u1.getDefaultPort() != u2.getDefaultPort() || // only in 1.4
+            !compare(u1.getPath(), u2.getPath(), false) ||
+            !compare(u1.getQuery(), u2.getQuery(), false) ||
+            !compare(u1.getRef(), u2.getRef(), false))
+            return false;
+        else
+            return true;
+    }
+
+    /**
+     * Caches a resource and returns a URL for it in the cache;
+     * blocks until resource is cached.  If the resource location is
+     * not cacheable (points to a local file, etc) then the original
+     * URL is returned.<p>
+     *
+     * @param location location of the resource
+     * @param version the version, or null
+     * @return either the location in the cache or the original location
+     */
+    public static URL getCachedResource(URL location, String cookieStr, Version version, UpdatePolicy policy) {
+        ResourceTracker rt = new ResourceTracker();
+        rt.addResource(location, cookieStr, version, policy);
+        try {
+            File f = rt.getCacheFile(location);
+            return f.toURL();
+        }
+        catch (MalformedURLException ex) {
+            return location;
+        }
+    }
+
+    /**
+     * Compare strings that can be null.
+     */
+    private static boolean compare(String s1, String s2, boolean ignore) {
+        if (s1==s2)
+            return true;
+        if (s1==null || s2==null)
+            return false;
+
+        if (ignore)
+            return s1.equalsIgnoreCase(s2);
+        else
+            return s1.equals(s2);
+    }
+
+    /**
+     * Returns the Permission object necessary to access the
+     * resource, or null if no permission is needed.
+     */
+    public static Permission getReadPermission(URL location, Version version) {
+        if (CacheUtil.isCacheable(location, version)) {
+            File file = CacheUtil.getCacheFile(location, version);
+
+            return new FilePermission(file.getPath(), "read");
+        }
+        else {
+            try {
+                // this is what URLClassLoader does
+                return location.openConnection().getPermission();
+            }
+            catch (java.io.IOException ioe) {
+                // should try to figure out the permission
+            	if (JNLPRuntime.isDebug())
+            		ioe.printStackTrace();
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns whether there is a version of the URL contents in the
+     * cache and it is up to date.  This method may not return
+     * immediately.
+     *
+     * @param source the source URL
+     * @param version the versions to check for
+     * @param connection a connection to the URL, or null
+     * @return whether the cache contains the version
+     * @throws IllegalArgumentException if the source is not cacheable
+     */
+    public static boolean isCurrent(URL source, Version version, URLConnection connection) {
+
+        if (!isCacheable(source, version))
+            throw new IllegalArgumentException(R("CNotCacheable", source));
+
+        try {
+            if (connection == null)
+                connection = source.openConnection();
+
+            connection.connect();
+
+            CacheEntry entry = new CacheEntry(source, version); // could pool this
+            boolean result = entry.isCurrent(connection);
+
+            if (JNLPRuntime.isDebug())
+                System.out.println("isCurrent: "+source+" = "+result);
+
+            return result;
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            return isCached(source, version); // if can't connect return whether already in cache
+        }
+    }
+
+    /**
+     * Returns true if the cache has a local copy of the contents of
+     * the URL matching the specified version string.
+     *
+     * @param source the source URL
+     * @param version the versions to check for
+     * @return true if the source is in the cache
+     * @throws IllegalArgumentException if the source is not cacheable
+     */
+    public static boolean isCached(URL source, Version version) {
+        if (!isCacheable(source, version))
+            throw new IllegalArgumentException(R("CNotCacheable", source));
+
+        CacheEntry entry = new CacheEntry(source, version); // could pool this
+        boolean result = entry.isCached();
+
+        if (JNLPRuntime.isDebug())
+            System.out.println("isCached: "+source+" = "+result);
+
+        return result;
+    }
+
+    /**
+     * Returns whether the resource can be cached as a local file;
+     * if not, then URLConnection.openStream can be used to obtain
+     * the contents.
+     */
+    public static boolean isCacheable(URL source, Version version) {
+        if (source == null)
+            return false;
+
+        if (source.getProtocol().equals("file"))
+            return false;
+
+        if (source.getProtocol().equals("jar"))
+            return false;
+
+        return true;
+    }
+
+    /**
+     * Returns the file for the locally cached contents of the
+     * source.  This method returns the file location only and does
+     * not download the resource.  The latest version of the
+     * resource that matches the specified version will be returned.
+     *
+     * @param source the source URL
+     * @param version the version id of the local file
+     * @return the file location in the cache, or null if no versions cached
+     * @throws IllegalArgumentException if the source is not cacheable
+     */
+    public static File getCacheFile(URL source, Version version) {
+        // ensure that version is an version id not version string
+
+        if (!isCacheable(source, version))
+            throw new IllegalArgumentException(R("CNotCacheable", source));
+
+        try {
+            File localFile = urlToPath(source, "cache");
+            localFile.getParentFile().mkdirs();
+
+            return localFile;
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            return null;
+        }
+    }
+
+    /**
+     * Returns a buffered output stream open for writing to the
+     * cache file.
+     *
+     * @param source the remote location
+     * @param version the file version to write to
+     */
+    public static OutputStream getOutputStream(URL source, Version version) throws IOException {
+        File localFile = getCacheFile(source, version);
+        OutputStream out = new FileOutputStream(localFile);
+
+        return new BufferedOutputStream(out);
+    }
+
+    /**
+     * Copies from an input stream to an output stream.  On
+     * completion, both streams will be closed.  Streams are
+     * buffered automatically.
+     */
+    public static void streamCopy(InputStream is, OutputStream os) throws IOException {
+        if (!(is instanceof BufferedInputStream))
+            is = new BufferedInputStream(is);
+
+        if (!(os instanceof BufferedOutputStream))
+            os = new BufferedOutputStream(os);
+
+        try {
+            byte b[] = new byte[4096];
+            while (true) {
+                int c = is.read(b, 0, b.length);
+                if (c == -1)
+                    break;
+
+                os.write(b, 0, c);
+            }
+        }
+        finally {
+            is.close();
+            os.close();
+        }
+    }
+
+    /**
+     * Converts a URL into a local path string within the runtime's
+     * base directory.
+     *
+     * @param location the url
+     * @param subdir subdirectory under the base directory
+     * @return the file
+     */
+    public static File urlToPath(URL location, String subdir) {
+        StringBuffer path = new StringBuffer();
+
+        if (subdir != null) {
+            path.append(subdir);
+            path.append(File.separatorChar);
+        }
+
+        path.append(location.getProtocol());
+        path.append(File.separatorChar);
+        path.append(location.getHost());
+        path.append(File.separatorChar);
+        path.append(location.getPath().replace('/', File.separatorChar));
+
+        return new File(JNLPRuntime.getBaseDir(), fixPath(path.toString()));
+    }
+
+    /**
+     * Clean up a string by removing characters that can't appear in
+     * a local file name.
+     */
+    private static String fixPath(String path) {
+        char badChars[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
+
+        for (int i=0; i < badChars.length; i++)
+            if (badChars[i] != File.separatorChar)
+                if (-1 != path.indexOf(badChars[i]))
+                    path = path.replace(badChars[i], 'X');
+
+        return path;
+    }
+
+    /**
+     * Waits until the resources are downloaded, while showing a
+     * progress indicator.
+     *
+     * @param tracker the resource tracker
+     * @param resources the resources to wait for
+     * @param title name of the download
+     */
+    public static void waitForResources(ApplicationInstance app, ResourceTracker tracker, URL resources[], String title) {
+        DownloadIndicator indicator = JNLPRuntime.getDefaultDownloadIndicator();
+        DownloadServiceListener listener = null;
+
+        try {
+            if (indicator == null) {
+                tracker.waitForResources(resources, 0);
+                return;
+            }
+
+            // see if resources can be downloaded very quickly; avoids
+            // overhead of creating display components for the resources
+            if (tracker.waitForResources(resources, indicator.getInitialDelay())) 
+                return;
+
+            // only resources not starting out downloaded are displayed
+            List urlList = new ArrayList();
+            for (int i=0; i < resources.length; i++) {
+                if (!tracker.checkResource(resources[i]))
+                    urlList.add(resources[i]);
+            }
+            URL undownloaded[] = (URL[]) urlList.toArray( new URL[urlList.size()] );
+
+            listener = indicator.getListener(app, title, undownloaded);
+
+            do {
+                long read = 0;
+                long total = 0;
+
+                for (int i=0; i < undownloaded.length; i++) {
+                    // add in any -1's; they're insignificant
+                    total += tracker.getTotalSize(undownloaded[i]);
+                    read += tracker.getAmountRead(undownloaded[i]);
+                }
+
+                int percent = (int)( (100*read)/Math.max(1,total) );
+
+                for (int i=0; i < undownloaded.length; i++)
+                    listener.progress(undownloaded[i], "version",
+                                      tracker.getAmountRead(undownloaded[i]),
+                                      tracker.getTotalSize(undownloaded[i]),
+                                      percent);
+            }
+            while (!tracker.waitForResources(resources, indicator.getUpdateRate()));
+
+            // make sure they read 100% until indicator closes
+            for (int i=0; i < undownloaded.length; i++)
+                listener.progress(undownloaded[i], "version",
+                                  tracker.getTotalSize(undownloaded[i]),
+                                  tracker.getTotalSize(undownloaded[i]),
+                                  100);
+
+        }
+        catch (InterruptedException ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+        }
+        finally {
+            if (listener != null)
+                indicator.disposeListener(listener);
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,321 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+import java.util.*;
+import java.util.List;
+import javax.swing.*;
+import javax.swing.Timer;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * Show the progress of downloads.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.3 $ 
+ */
+public class DefaultDownloadIndicator implements DownloadIndicator {
+
+    // todo: rewrite this to cut down on size/complexity; smarter
+    // panels (JList, renderer) understand resources instead of
+    // nested panels and grid-bag mess.
+
+    // todo: fix bug where user closes download box and it
+    // never(?) reappears.
+
+    // todo: UI for user to cancel/restart download
+
+    // todo: this should be synchronized at some point but conflicts
+    // aren't very likely.
+
+    private static String downloading = JNLPRuntime.getMessage("CDownloading");
+    private static String complete = JNLPRuntime.getMessage("CComplete");
+
+    /** time to wait after completing but before window closes */
+    private static final int CLOSE_DELAY = 750;
+
+    /** the display window */
+    private static JFrame frame; 
+
+    /** shared constraint */
+    static GridBagConstraints vertical;
+    static GridBagConstraints verticalIndent;
+    static { 
+        vertical = new GridBagConstraints();
+        vertical.gridwidth = GridBagConstraints.REMAINDER;
+        vertical.weightx = 1.0;
+        vertical.fill = GridBagConstraints.HORIZONTAL;
+        vertical.anchor = GridBagConstraints.WEST;
+
+        verticalIndent = (GridBagConstraints) vertical.clone();
+        verticalIndent.insets = new Insets(0, 10, 3, 0);
+    }
+
+    /**
+     * Return the update rate.
+     */
+    public int getUpdateRate() {
+        return 150; //ms
+    }
+
+    /**
+     * Return the initial delay before obtaining a listener.
+     */
+    public int getInitialDelay() {
+        return 300; //ms
+    }
+
+    /**
+     * Return a download service listener that displays the progress
+     * in a shared download info window.
+     *
+     * @param app the downloading application, or null if N/A
+     * @param downloadName name identifying the download to the user
+     * @param resources initial urls to display (not required)
+     */
+    public DownloadServiceListener getListener(ApplicationInstance app, String downloadName, URL resources[]) {
+        DownloadPanel result = new DownloadPanel(downloadName);
+
+        if (frame == null) {
+            frame = new JFrame(downloading+"...");
+            frame.getContentPane().setLayout(new GridBagLayout());
+        }
+
+        if (resources != null)
+            for (int i=0; i < resources.length; i++)
+                result.addProgressPanel(resources[i], null);
+
+        frame.getContentPane().add(result, vertical);
+        frame.pack();
+
+        if (!frame.isVisible()) {
+            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+            Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(frame.getGraphicsConfiguration());
+            Dimension screen = new Dimension(screenSize.width - insets.left , 
+                    screenSize.height - insets.top);
+            frame.setLocation(screen.width-frame.getWidth(),
+                              screen.height-frame.getHeight());
+        }
+
+        frame.show();
+
+        return result;
+    }
+
+    /**
+     * Remove a download service listener that was obtained by
+     * calling the getDownloadListener method from the shared
+     * download info window.
+     */
+    public void disposeListener(final DownloadServiceListener listener) {
+        if (!(listener instanceof DownloadPanel))
+            return;
+
+        ActionListener hider = new ActionListener() {
+            public void actionPerformed(ActionEvent evt) {
+                if (frame.getContentPane().getComponentCount() == 1)
+                    frame.hide();
+
+                frame.getContentPane().remove((DownloadPanel) listener);
+                frame.pack();
+            }
+        };
+
+        Timer timer = new Timer(CLOSE_DELAY, hider);
+        timer.setRepeats(false);
+        timer.start();
+    }
+
+
+
+    /**
+     * Groups the url progress in a panel.
+     */
+    static class DownloadPanel extends JPanel implements DownloadServiceListener {
+
+        /** the download name */
+        private String downloadName;
+
+        /** Downloading part: */
+        private JLabel header = new JLabel();
+
+        /** list of URLs being downloaded */
+        private List urls = new ArrayList();
+
+        /** list of ProgressPanels */
+        private List panels = new ArrayList();
+
+
+        /**
+         * Create a new download panel for with the specified download
+         * name.
+         */
+        protected DownloadPanel(String downloadName) {
+            setLayout(new GridBagLayout());
+
+            this.downloadName = downloadName;
+            this.add(header, vertical);
+            header.setFont(header.getFont().deriveFont(Font.BOLD));
+
+            setOverallPercent(0);
+        }
+
+        /**
+         * Add a ProgressPanel for a URL.
+         */
+        protected void addProgressPanel(URL url, String version) {
+            if (!urls.contains(url)) {
+                ProgressPanel panel = new ProgressPanel(url, version);
+
+                add(panel, verticalIndent);
+                frame.pack();
+
+                urls.add(url);
+                panels.add(panel);
+            }
+        }
+
+        /**
+         * Update the download progress of a url.
+         */
+        protected void update(final URL url, final String version, final long readSoFar, final long total, final int overallPercent) {
+            Runnable r = new Runnable() {
+                public void run() {
+                    if (!urls.contains(url))
+                        addProgressPanel(url, version);
+
+                    setOverallPercent(overallPercent);
+
+                    ProgressPanel panel = (ProgressPanel) panels.get(urls.indexOf(url));
+                    panel.setProgress(readSoFar, total);
+                    panel.repaint();
+                }
+            };
+            SwingUtilities.invokeLater(r);
+        }
+
+        /**
+         * Sets the overall percent completed.
+         */
+        public void setOverallPercent(int percent) {
+            // don't get whole string from resource and sub in
+            // values because it'll be doing a MessageFormat for
+            // each update.
+            header.setText(downloading+" "+downloadName+": "+percent+"% "+complete+".");
+        }
+
+        /**
+         * Called when a download failed.
+         */
+        public void downloadFailed(URL url, String version) {
+            update(url, version, -1, -1, -1);
+        }
+
+        /**
+         * Called when a download has progressed.
+         */
+        public void progress(URL url, String version, long readSoFar, long total, int overallPercent) {
+            update(url, version, readSoFar, total, overallPercent);
+        }
+
+        /**
+         * Called when an archive is patched.
+         */
+        public void upgradingArchive(URL url, String version, int patchPercent, int overallPercent) {
+            update(url, version, patchPercent, 100, overallPercent);
+        }
+
+        /**
+         * Called when a download is being validated.
+         */
+        public void validating(URL url, String version, long entry, long total, int overallPercent) {
+            update(url, version, entry, total, overallPercent);
+        }
+
+    };
+
+
+
+    /**
+     * A progress bar with the URL next to it.
+     */
+    static class ProgressPanel extends JPanel {
+        private JPanel bar = new JPanel();
+
+        private long total;
+        private long readSoFar;
+
+        ProgressPanel(URL url, String version) {
+            JLabel location = new JLabel(" "+url.getHost()+"/"+url.getFile());
+
+            bar.setMinimumSize(new Dimension(80,15));
+            bar.setPreferredSize(new Dimension(80,15));
+            bar.setOpaque(false);
+
+            setLayout(new GridBagLayout());
+
+            GridBagConstraints gbc = new GridBagConstraints();
+            gbc.weightx = 0.0;
+            gbc.fill = GridBagConstraints.NONE;
+            gbc.gridwidth = GridBagConstraints.RELATIVE;
+            add(bar, gbc);
+
+            gbc.insets = new Insets(0, 3, 0, 0);
+            gbc.weightx = 1.0;
+            gbc.fill = GridBagConstraints.HORIZONTAL;
+            gbc.gridwidth = GridBagConstraints.REMAINDER;
+            gbc.anchor = GridBagConstraints.WEST;
+            add(location, gbc);
+        }
+
+        public void setProgress(long readSoFar, long total) {
+            this.readSoFar = readSoFar;
+            this.total = total;
+        }
+
+        public void paintComponent(Graphics g) {
+            super.paintComponent(g);
+
+            int x = bar.getX();
+            int y = bar.getY();
+            int h = bar.getHeight();
+            int w = bar.getWidth();
+
+            if (readSoFar <= 0 || total <= 0) {
+                // make barber pole
+            }
+            else {
+                double progress = (double)readSoFar / (double)total;
+                int divide = (int)(w * progress);
+
+                g.setColor(Color.white);
+                g.fillRect(x, y, w, h);
+                g.setColor(Color.blue);
+                g.fillRect(x+1, y+1, divide-1, h-1);
+            }
+        }
+    };
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/DownloadIndicator.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,92 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.net.*;
+import java.util.*;
+import java.util.List;
+import javax.swing.*;
+import javax.swing.Timer;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * A DownloadIndicator creates DownloadServiceListeners that are
+ * notified of resources being transferred and their progress.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.8 $ 
+ */
+public interface DownloadIndicator {
+
+    /**
+     * Return a download service listener that displays the progress
+     * of downloading resources.  Update messages may be reported
+     * for URLs that are not included initially.<p>
+     *
+     * Progress messages are sent as if the DownloadServiceListener
+     * were listening to a DownloadService request.  The listener
+     * will receive progress messages from time to time during the
+     * download. <p>
+     *
+     * @param app JNLP application downloading the files, or null if not applicable
+     * @param downloadName name identifying the download to the user
+     * @param resources initial urls to display, empty if none known at start
+     */
+    public DownloadServiceListener getListener(ApplicationInstance app,
+                                               String downloadName, 
+                                               URL resources[]);
+
+    /**
+     * Indicates that a download service listener that was obtained
+     * from the getDownloadListener method will no longer be used.
+     * This method can be used to ensure that progress dialogs are
+     * properly removed once a particular download is finished.
+     *
+     * @param listener the listener that is no longer in use
+     */
+    public void disposeListener(DownloadServiceListener listener);
+
+    /**
+     * Return the desired time in milliseconds between updates.
+     * Updates are not guarenteed to occur based on this value; for
+     * example, they may occur based on the download percent or some
+     * other factor.
+     *
+     * @return rate in milliseconds, must be &gt;= 0
+     */
+    public int getUpdateRate();
+
+    /**
+     * Return a time in milliseconds to wait for a download to
+     * complete before obtaining a listener for the download.  This
+     * value can be used to skip lengthy operations, such as
+     * initializing a GUI, for downloads that complete quickly.  The
+     * getListener method is not called if the download completes
+     * in less time than the returned delay.
+     *
+     * @return delay in milliseconds, must be &gt;= 0
+     */
+    public int getInitialDelay();
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/Resource.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,282 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * Information about a single resource to download.
+ * This class tracks the downloading of various resources of a
+ * JNLP file to local files.  It can be used to download icons,
+ * jnlp and extension files, jars, and jardiff files using the
+ * version based protocol or any file using the basic download
+ * protocol.<p>
+ *
+ * Resources can be put into download groups by specifying a part
+ * name for the resource.  The resource tracker can also be
+ * configured to prefetch resources, which are downloaded in the
+ * order added to the media tracker.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.9 $ 
+ */
+public class Resource {
+
+    // todo: fix resources to handle different versions
+
+    // todo: IIRC, any resource is checked for being up-to-date
+    // only once, regardless of UpdatePolicy.  verify and fix.
+
+    /** status bits */
+    public static final int UNINITIALIZED = 0;
+    public static final int CONNECT = 1;
+    public static final int CONNECTING = 2;
+    public static final int CONNECTED = 4;
+    public static final int DOWNLOAD = 8;
+    public static final int DOWNLOADING = 16;
+    public static final int DOWNLOADED = 32;
+    public static final int ERROR = 64;
+    public static final int STARTED = 128; // enqueued or being worked on
+
+    /** list of weak references of resources currently in use */
+    private static WeakList resources = new WeakList();
+
+    /** weak list of trackers monitoring this resource */
+    private WeakList trackers = new WeakList();
+
+    /** the remote location of the resource */
+    URL location;
+    
+    /** cookie string to send with the resource request */
+    String cookieStr;
+
+    /** the local file downloaded to */
+    File localFile;
+
+    /** the requested version */
+    Version requestVersion;
+
+    /** the version downloaded from server */
+    Version downloadVersion;
+
+    /** connection to resource */
+    URLConnection connection;
+
+    /** amount in bytes transferred */
+    long transferred = 0;
+
+    /** total size of the resource, or -1 if unknown */
+    long size = -1;
+
+    /** the status of the resource */
+    int status = UNINITIALIZED;
+    
+    /** Update policy for this resource */
+    UpdatePolicy updatePolicy;
+
+    /**
+     * Create a resource.
+     */
+    private Resource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
+        this.location = location;
+        this.requestVersion = requestVersion;
+        this.updatePolicy = updatePolicy;
+        this.cookieStr = cookieStr;
+    }
+
+    /**
+     * Return a shared Resource object representing the given
+     * location and version.
+     */
+    public static Resource getResource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
+        synchronized (resources) {
+            Resource resource = new Resource(location, cookieStr, updatePolicy, requestVersion);
+
+            int index = resources.indexOf(resource);
+            if (index >= 0) { // return existing object
+                Resource result = (Resource) resources.get(index);
+                if (result != null)
+                    return result;
+            }
+
+            resources.add(resource);
+            resources.trimToSize();
+
+            return resource;
+        }
+    }
+
+    /**
+     * Returns the remote location of the resource.
+     */
+    public URL getLocation() {
+        return location;
+    }
+    
+    /**
+     * Returns the cookie string associated with this resource
+     */
+    public String getCookieStr() {
+        return cookieStr;
+    }
+
+    /**
+     * Returns the tracker that first created or monitored the
+     * resource, or null if no trackers are monitoring the resource.
+     */
+    ResourceTracker getTracker() {
+        synchronized (trackers) {
+            List t = trackers.hardList();
+            if (t.size() > 0)
+                return (ResourceTracker) t.get(0);
+
+            return null;
+        }
+    }
+
+    /**
+     * Returns true if any of the specified flags are set.
+     */
+    public boolean isSet(int flag) {
+        if (flag == UNINITIALIZED)
+            return status == UNINITIALIZED;
+        else
+            return (status & flag) != 0;
+    }
+
+    /**
+     * Returns the update policy for this resource
+     * 
+     * @return The update policy
+     */
+    public UpdatePolicy getUpdatePolicy() {
+        return this.updatePolicy;
+    }
+
+    /**
+     * Returns a human-readable status string.
+     */
+    private String getStatusString(int flag) {
+        StringBuffer result = new StringBuffer();
+
+        if (flag == 0) result.append("<> ");
+        if ((flag & CONNECT) != 0) result.append("CONNECT ");
+        if ((flag & CONNECTING) != 0) result.append("CONNECTING ");
+        if ((flag & CONNECTED) != 0) result.append("CONNECTED ");
+        if ((flag & DOWNLOAD) != 0) result.append("DOWNLOAD ");
+        if ((flag & DOWNLOADING) != 0) result.append("DOWNLOADING ");
+        if ((flag & DOWNLOADED) != 0) result.append("DOWNLOADED ");
+        if ((flag & ERROR) != 0) result.append("ERROR ");
+        if ((flag & STARTED) != 0) result.append("STARTED ");
+
+        return result.deleteCharAt(result.length()-1).toString();
+    }
+
+    /**
+     * Changes the status by clearing the flags in the first
+     * parameter and setting the flags in the second.  This method
+     * is synchronized on this resource.
+     */
+    public void changeStatus(int clear, int add) {
+        int orig = 0;
+
+        synchronized(this) {
+            orig = status;
+
+            this.status &= ~clear;
+            this.status |= add;
+        }
+
+        if (JNLPRuntime.isDebug())
+            if (status != orig) {
+                System.out.print("Status: "+getStatusString(status));
+                if ((status & ~orig) != 0) 
+                    System.out.print(" +("+getStatusString(status & ~orig)+")");
+                if ((~status & orig) != 0) 
+                    System.out.print(" -("+getStatusString(~status & orig)+")");
+                System.out.println(" @ "+location.getPath());
+            }
+    }
+
+    /**
+     * Removes the tracker to the list of trackers monitoring this
+     * resource.
+     */
+    public void removeTracker(ResourceTracker tracker) {
+        synchronized (trackers) {
+            trackers.remove(tracker);
+            trackers.trimToSize();
+        }
+    }
+
+    /**
+     * Adds the tracker to the list of trackers monitoring this
+     * resource.
+     */
+    public void addTracker(ResourceTracker tracker) {
+        synchronized (trackers) {
+            List t = trackers.hardList(); // prevent GC between contains and add
+            if (!t.contains(tracker))
+                trackers.add(tracker);
+
+            trackers.trimToSize();
+        }
+    }
+
+    /**
+     * Instructs the trackers monitoring this resource to fire a
+     * download event.
+     */
+    protected void fireDownloadEvent() {
+        List send;
+
+        synchronized (trackers) {
+            send = trackers.hardList();
+        }
+
+        for (int i=0; i < send.size(); i++) {
+            ResourceTracker rt = (ResourceTracker) send.get(i);
+            rt.fireDownloadEvent(this);
+        }
+    }
+
+    public boolean equals(Object other) {
+        if (other instanceof Resource) {
+            // this prevents the URL handler from looking up the IP
+            // address and doing name resolution; much faster so less
+            // time spent in synchronized addResource determining if
+            // Resource is already in a tracker, and better for offline
+            // mode on some OS.
+            return CacheUtil.urlEquals(location, ((Resource)other).location);
+        }
+        return false;
+    }
+
+    public String toString() {
+        return "location="+location.toString() + " state="+getStatusString(status);
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/ResourceTracker.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,973 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.event.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * This class tracks the downloading of various resources of a
+ * JNLP file to local files in the cache.  It can be used to
+ * download icons, jnlp and extension files, jars, and jardiff
+ * files using the version based protocol or any file using the
+ * basic download protocol (jardiff and version not implemented
+ * yet).<p>
+ *
+ * The resource tracker can be configured to prefetch resources,
+ * which are downloaded in the order added to the media
+ * tracker.<p>
+ *
+ * Multiple threads are used to download and cache resources that
+ * are actively being waited for (blocking a caller) or those that
+ * have been started downloading by calling the startDownload
+ * method.  Resources that are prefetched are downloaded one at a
+ * time and only if no other trackers have requested downloads.
+ * This allows the tracker to start downloading many items without
+ * using many system resources, but still quickly download items
+ * as needed.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.22 $ 
+ */
+public class ResourceTracker {
+
+    // todo: use event listener arrays instead of lists
+
+    // todo: see if there is a way to set the socket options just
+    // for use by the tracker so checks for updates don't hang for
+    // a long time.
+
+    // todo: ability to restart/retry a hung download
+
+    // todo: move resource downloading/processing code into Resource
+    // class, threading stays in ResourceTracker
+
+    // todo: get status method? and some way to convey error status
+    // to the caller.
+
+    // todo: might make a tracker be able to download more than one
+    // version of a resource, but probably not very useful.
+
+
+    // defines 
+    //    ResourceTracker.Downloader (download threads)
+
+    // separately locks on (in order of aquire order, ie, sync on prefetch never syncs on lock):
+    //   lock, prefetch, this.resources, each resource, listeners
+
+    /** notified on initialization or download of a resource */
+    private static Object lock = new Integer(0); // used to lock static structures
+
+    // shortcuts
+    private static final int UNINITIALIZED = Resource.UNINITIALIZED;
+    private static final int CONNECT = Resource.CONNECT;
+    private static final int CONNECTING = Resource.CONNECTING;
+    private static final int CONNECTED = Resource.CONNECTED;
+    private static final int DOWNLOAD = Resource.DOWNLOAD;
+    private static final int DOWNLOADING = Resource.DOWNLOADING;
+    private static final int DOWNLOADED = Resource.DOWNLOADED;
+    private static final int ERROR = Resource.ERROR;
+    private static final int STARTED = Resource.STARTED;
+
+    /** max threads */
+    private static final int maxThreads = 5;
+
+    /** running threads */
+    private static int threads = 0;
+
+    /** weak list of resource trackers with resources to prefetch */
+    private static WeakList prefetchTrackers = new WeakList();
+
+    /** resources requested to be downloaded */
+    private static ArrayList queue = new ArrayList();
+
+    /** resource trackers threads are working for (used for load balancing across multi-tracker downloads) */
+    private static ArrayList active = new ArrayList(); // 
+
+    /** the resources known about by this resource tracker */
+    private List resources = new ArrayList();
+
+    /** download listeners for this tracker */
+    private List listeners = new ArrayList();
+
+    /** whether to download parts before requested */ 
+    private boolean prefetch;
+
+
+    /**
+     * Creates a resource tracker that does not prefetch resources.
+     */
+    public ResourceTracker() {
+        this(false);
+    }
+
+    /**
+     * Creates a resource tracker.
+     *
+     * @param prefetch whether to download resources before requested. 
+     */
+    public ResourceTracker(boolean prefetch) {
+        this.prefetch = prefetch;
+
+        if (prefetch) {
+            synchronized (prefetchTrackers) {
+                prefetchTrackers.add(this);
+                prefetchTrackers.trimToSize();
+            }
+        }
+    }
+
+    /**
+     * Add a resource identified by the specified location and
+     * version.  The tracker only downloads one version of a given
+     * resource per instance (ie cannot download both versions 1 and
+     * 2 of a resource in the same tracker).
+     *
+     * @param location the location of the resource
+     * @param version the resource version
+     * @param updatePolicy whether to check for updates if already in cache
+     */
+    public void addResource(URL location, String cookieStr, Version version, UpdatePolicy updatePolicy) {
+        if (location == null)
+            throw new IllegalArgumentException("location==null");
+
+        Resource resource = Resource.getResource(location, cookieStr, updatePolicy, version);
+        boolean downloaded = false;
+
+        synchronized (resources) {
+            if (resources.contains(resource))
+                return;
+            resource.addTracker(this);
+            resources.add(resource);
+        }
+
+        // checkCache may take a while (loads properties file).  this
+        // should really be synchronized on resources, but the worst
+        // case should be that the resource will be updated once even
+        // if unnecessary.
+        downloaded = checkCache(resource, updatePolicy);
+
+        synchronized (lock) {
+            if (!downloaded)
+                if (prefetch && threads == 0) // existing threads do pre-fetch when queue empty
+                    startThread();
+        }
+    }
+
+    /**
+     * Removes a resource from the tracker.  This method is useful
+     * to allow memory to be reclaimed, but calling this method is
+     * not required as resources are reclaimed when the tracker is
+     * collected.
+     *
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public void removeResource(URL location) {
+        synchronized (resources) {
+            Resource resource = getResource(location);
+
+            if (resource != null) {
+                resources.remove(resource);
+                resource.removeTracker(this);
+            }
+
+            // should remove from queue? probably doesn't matter
+        }
+    }
+
+    /**
+     * Check the cache for a resource, and initialize the resource
+     * as already downloaded if found. <p>
+     *
+     * @param updatePolicy whether to check for updates if already in cache
+     * @return whether the resource are already downloaded 
+     */
+    private boolean checkCache(Resource resource, UpdatePolicy updatePolicy) {
+        if (!CacheUtil.isCacheable(resource.location, resource.downloadVersion)) {
+            // pretend that they are already downloaded; essentially
+            // they will just 'pass through' the tracker as if they were
+            // never added (for example, not affecting the total download size).
+            synchronized (resource) {
+                resource.changeStatus(0, DOWNLOADED|CONNECTED|STARTED);
+            }
+            fireDownloadEvent(resource);
+            return true;
+        }
+
+        if (updatePolicy != UpdatePolicy.ALWAYS && updatePolicy != UpdatePolicy.FORCE) { // save loading entry props file
+            CacheEntry entry = new CacheEntry(resource.location, resource.downloadVersion);
+
+            if (entry.isCached() && !updatePolicy.shouldUpdate(entry)) {
+                if (JNLPRuntime.isDebug())
+                    System.out.println("not updating: "+resource.location);
+
+                synchronized (resource) {
+                    resource.localFile = CacheUtil.getCacheFile(resource.location, resource.downloadVersion);
+                    resource.size = resource.localFile.length();
+                    resource.transferred = resource.localFile.length();
+                    resource.changeStatus(0, DOWNLOADED|CONNECTED|STARTED);
+                }
+                fireDownloadEvent(resource);
+                return true;
+            }
+        }
+        
+        if (updatePolicy == UpdatePolicy.FORCE) { // ALWAYS update
+            // When we are "always" updating, we update for each instance. Reset resource status.
+            resource.changeStatus(Integer.MAX_VALUE, 0);
+        }
+
+        // may or may not be cached, but check update when connection
+        // is open to possibly save network communication time if it
+        // has to be downloaded, and allow this call to return quickly
+        return false;
+    }
+
+    /**
+     * Adds the listener to the list of objects interested in
+     * receivind DownloadEvents.<p>
+     *
+     * @param location the resource to add a callback for
+     * @param runnable the runnable to call when resource is completed
+     */
+    public void addDownloadListener(DownloadListener listener) {
+        synchronized (listeners) {
+            if (!listeners.contains(listener))
+                listeners.add(listener);
+        }
+    }
+
+    /**
+     * Removes a download listener.
+     */
+    public void removeDownloadListener(DownloadListener listener) {
+        synchronized (listeners) {
+            listeners.remove(listener);
+        }
+    }
+
+    /**
+     * Fires the download event corresponding to the resource's
+     * state.  This method is typicall called by the Resource itself
+     * on each tracker that is monitoring the resource.  Do not call
+     * this method with any locks because the listeners may call
+     * back to this ResourceTracker.
+     */
+    protected void fireDownloadEvent(Resource resource) {
+        DownloadListener l[] = null;
+        synchronized (listeners) {
+            l = (DownloadListener[]) listeners.toArray(new DownloadListener[0]);
+        }
+
+        int status;
+        synchronized (resource) {
+            status = resource.status;
+        }
+
+        DownloadEvent event = new DownloadEvent(this, resource);
+        for (int i=0; i < l.length; i++) {
+            if (0 != ((ERROR|DOWNLOADED) & status))
+                l[i].downloadCompleted(event);
+            else if (0 != (DOWNLOADING & status))
+                l[i].downloadStarted(event);
+            else if (0 != (CONNECTING & status))
+                l[i].updateStarted(event);
+        }
+    }
+
+    /**
+     * Returns a URL pointing to the cached location of the
+     * resource, or the resource itself if it is a non-cacheable
+     * resource.<p>
+     *
+     * If the resource has not downloaded yet, the method will block
+     * until it has been transferred to the cache.<p>
+     *
+     * @param location the resource location
+     * @return the resource, or null if it could not be downloaded
+     * @throws IllegalArgumentException if the resource is not being tracked
+     * @see CacheUtil#isCacheable
+     */
+    public URL getCacheURL(URL location) {
+        try {
+            File f = getCacheFile(location);
+            if (f != null)
+                return f.toURL();
+        }
+        catch (MalformedURLException ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+        }
+
+        return location;
+    }
+
+    /**
+     * Returns a file containing the downloaded resource.  If the
+     * resource is non-cacheable then null is returned unless the
+     * resource is a local file (the original file is returned).<p>
+     *
+     * If the resource has not downloaded yet, the method will block
+     * until it has been transferred to the cache.<p>
+     *
+     * @param location the resource location
+     * @return a local file containing the resource, or null
+     * @throws IllegalArgumentException if the resource is not being tracked
+     * @see CacheUtil#isCacheable
+     */
+    public File getCacheFile(URL location) {
+        try {
+            Resource resource = getResource(location);
+            if (!resource.isSet(DOWNLOADED|ERROR))
+                waitForResource(location, 0);
+
+            if (resource.isSet(ERROR))
+                return null;
+
+            if (resource.localFile != null)
+                return resource.localFile;
+
+            if (location.getProtocol().equalsIgnoreCase("file")) {
+                File file = new File(location.getFile());
+                if (file.exists())
+                    return file;
+            }
+
+            return null;
+        }
+        catch (InterruptedException ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            return null; // need an error exception to throw
+        }
+    }
+
+    /**
+     * Returns an input stream that reads the contents of the
+     * resource.  For non-cacheable resources, an InputStream that
+     * reads from the source location is returned.  Otherwise the
+     * InputStream reads the cached resource.<p>
+     *
+     * This method will block while the resource is downloaded to
+     * the cache.
+     *
+     * @throws IOException if there was an error opening the stream
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public InputStream getInputStream(URL location) throws IOException {
+        try {
+            Resource resource = getResource(location);
+            if (!resource.isSet(DOWNLOADED|ERROR))
+                waitForResource(location, 0);
+
+            if (resource.localFile != null)
+                return new FileInputStream(resource.localFile);
+
+            return resource.location.openStream();
+        }
+        catch (InterruptedException ex) {
+            throw new IOException("wait was interrupted");
+        }
+    }
+
+    /**
+     * Wait for a group of resources to be downloaded and made
+     * available locally.
+     *
+     * @param urls the resources to wait for
+     * @param timeout the time in ms to wait before returning, 0 for no timeout
+     * @return whether the resources downloaded before the timeout
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public boolean waitForResources(URL urls[], long timeout) throws InterruptedException {
+        Resource resources[] = new Resource[ urls.length ];
+
+        synchronized(resources) { 
+            // keep the lock so getResource doesn't have to aquire it each time
+            for (int i=0; i < urls.length; i++)
+                resources[i] = getResource(urls[i]);
+        }
+
+        if (resources.length > 0)
+            return wait(resources, timeout);
+
+        return true;
+    }
+
+    /**
+     * Wait for a particular resource to be downloaded and made
+     * available.
+     *
+     * @param location the resource to wait for
+     * @param timeout the timeout, or 0 to wait until completed
+     * @return whether the resource downloaded before the timeout
+     * @throws InterruptedException if another thread interrupted the wait
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public boolean waitForResource(URL location, long timeout) throws InterruptedException {
+        return wait(new Resource[] { getResource(location) }, timeout);
+    }
+
+    /**
+     * Returns the number of bytes downloaded for a resource.
+     *
+     * @param location the resource location
+     * @return the number of bytes transferred
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public long getAmountRead(URL location) {
+        // not atomic b/c transferred is a long, but so what (each
+        // byte atomic? so probably won't affect anything...)
+        return getResource(location).transferred;
+    }
+
+    /**
+     * Returns whether a resource is available for use (ie, can be
+     * accessed with the getCacheFile method).
+     *
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public boolean checkResource(URL location) {
+        return getResource(location).isSet(DOWNLOADED|ERROR); // isSet atomic
+    }
+
+    /**
+     * Starts loading the resource if it is not already being
+     * downloaded or already cached.  Resources started downloading
+     * using this method may download faster than those prefetched
+     * by the tracker because the tracker will only prefetch one
+     * resource at a time to conserve system resources.
+     *
+     * @return true if the resource is already downloaded (or an error occurred) 
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public boolean startResource(URL location) {
+        Resource resource = getResource(location);
+
+        return startResource(resource);
+    }
+
+    /**
+     * Sets the resource status to connect and download, and
+     * enqueues the resource if not already started.
+     *
+     * @return true if the resource is already downloaded (or an error occurred) 
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    private boolean startResource(Resource resource) {
+        boolean enqueue = false;
+
+        synchronized (resource) {
+            if (resource.isSet(ERROR))
+                return true;
+
+            enqueue = !resource.isSet(STARTED);
+
+            if (!resource.isSet(CONNECTED | CONNECTING))
+                resource.changeStatus(0, CONNECT|STARTED);
+            if (!resource.isSet(DOWNLOADED | DOWNLOADING))
+                resource.changeStatus(0, DOWNLOAD|STARTED);
+
+            if (!resource.isSet(DOWNLOAD|CONNECT))
+                enqueue = false;
+        }
+
+        if (enqueue)
+            queueResource(resource);
+
+        return !enqueue;
+    }
+
+    /**
+     * Returns the number of total size in bytes of a resource, or
+     * -1 it the size is not known.
+     *
+     * @param location the resource location
+     * @return the number of bytes, or -1
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    public long getTotalSize(URL location) {
+        return getResource(location).size; // atomic
+    }
+
+    /**
+     * Start a new download thread if there are not too many threads
+     * already running.<p>
+     *
+     * Calls to this method should be synchronized on lock.
+     */
+    protected void startThread() {
+        if (threads < maxThreads) {
+            threads++;
+
+            Thread thread = new Thread(new Downloader());
+            thread.start();
+        }
+    }
+
+    /**
+     * A thread is ending, called by the thread itself.<p>
+     *
+     * Calls to this method should be synchronized.
+     */
+    private void endThread() {
+        threads--;
+
+        if (threads < 0) {
+            // this should never happen but try to recover
+            threads = 0;
+
+            if (queue.size() > 0) // if any on queue make sure a thread is running
+                startThread(); // look into whether this could create a loop
+
+            throw new RuntimeException("tracker threads < 0");
+        }
+
+        if (threads == 0) {
+            synchronized (prefetchTrackers) { 
+                queue.trimToSize(); // these only accessed by threads so no sync needed
+                active.clear(); // no threads so no trackers actively downloading
+                active.trimToSize();
+                prefetchTrackers.trimToSize();
+            }
+        }
+    }
+
+    /**
+     * Add a resource to the queue and start a thread to download or
+     * initialize it.
+     */
+    private void queueResource(Resource resource) {
+        synchronized (lock) {
+            if (!resource.isSet(CONNECT|DOWNLOAD))
+                throw new IllegalArgumentException("Invalid resource state (resource: "+resource+")");
+
+            queue.add(resource);
+            startThread();
+        }
+    }
+
+    /**
+     * Process the resource by either downloading it or initializing
+     * it.
+     */
+    private void processResource(Resource resource) {
+        boolean doConnect = false;
+        boolean doDownload = false;
+
+        synchronized (resource) {
+            if (resource.isSet(CONNECTING))
+                doConnect = true;
+        }
+        if (doConnect)
+            initializeResource(resource);
+
+        synchronized (resource) {
+            // return to queue if we just initalized but it still needs
+            // to download (not cached locally / out of date)
+            if (resource.isSet(DOWNLOAD)) // would be DOWNLOADING if connected before this method
+                queueResource(resource);
+
+            if (resource.isSet(DOWNLOADING))
+                doDownload = true;
+        }
+        if (doDownload)
+            downloadResource(resource);
+    }
+
+    /**
+     * Downloads an resource to a file.
+     */
+    private void downloadResource(Resource resource) {
+        resource.fireDownloadEvent(); // fire DOWNLOADING
+
+        try {
+            // create out second in case in does not exist
+            URLConnection con = getVersionedResourceURL(resource).openConnection();
+            
+            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
+                con.setRequestProperty("Cookie", resource.getCookieStr());
+
+            InputStream in = new BufferedInputStream(con.getInputStream());
+            OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion);
+            byte buf[] = new byte[1024];
+            int rlen;
+
+            while (-1 != (rlen = in.read(buf))) {
+                resource.transferred += rlen;
+                out.write(buf, 0, rlen);
+            }
+
+            in.close();
+            out.close();
+
+            // explicitly close the URLConnection.
+            if (con instanceof HttpURLConnection)
+                ((HttpURLConnection)con).disconnect();
+
+            resource.changeStatus(DOWNLOADING, DOWNLOADED);
+            synchronized(lock) {
+                lock.notifyAll(); // wake up wait's to check for completion
+            }
+            resource.fireDownloadEvent(); // fire DOWNLOADED
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            resource.changeStatus(0, ERROR);
+            synchronized(lock) {
+                lock.notifyAll(); // wake up wait's to check for completion
+            }
+            resource.fireDownloadEvent(); // fire ERROR
+        }
+    }
+
+    /**
+     * Open a URL connection and get the content length and other
+     * fields.
+     */
+    private void initializeResource(Resource resource) {
+        resource.fireDownloadEvent(); // fire CONNECTING
+
+        try {
+            File localFile = CacheUtil.getCacheFile(resource.location, resource.downloadVersion);
+
+            // connect
+            URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized
+            
+            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
+                connection.setRequestProperty("Cookie", resource.getCookieStr());
+
+            int size = connection.getContentLength();
+            boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE;
+
+            synchronized(resource) {
+                resource.localFile = localFile;
+                // resource.connection = connection;
+                resource.size = size;
+                resource.changeStatus(CONNECT|CONNECTING, CONNECTED);
+
+                // check if up-to-date; if so set as downloaded
+                if (current)
+                    resource.changeStatus(DOWNLOAD|DOWNLOADING, DOWNLOADED);
+            }
+
+            // update cache entry
+            CacheEntry entry = new CacheEntry(resource.location, resource.requestVersion);
+            if (!current)
+                entry.initialize(connection);
+
+            entry.setLastUpdated(System.currentTimeMillis());
+            entry.store();
+
+            synchronized(lock) {
+                lock.notifyAll(); // wake up wait's to check for completion
+            }
+            resource.fireDownloadEvent(); // fire CONNECTED
+
+            // explicitly close the URLConnection.
+			if (connection instanceof HttpURLConnection)
+                ((HttpURLConnection)connection).disconnect();
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            resource.changeStatus(0, ERROR);
+            synchronized(lock) {
+                lock.notifyAll(); // wake up wait's to check for completion
+            }
+            resource.fireDownloadEvent(); // fire ERROR
+        }
+    }
+
+    
+ 
+    private URL getVersionedResourceURL(Resource resource) {
+        String actualLocation = resource.location.getProtocol() + "://"
+                + resource.location.getHost();
+        if (resource.location.getPort() != -1) {
+            actualLocation += ":" + resource.location.getPort();
+        }
+        actualLocation += resource.location.getPath();
+        if (resource.requestVersion != null
+                && resource.requestVersion.isVersionId()) {
+            actualLocation += "?version-id=" + resource.requestVersion;
+        }
+        URL versionedURL;
+        try {
+            versionedURL = new URL(actualLocation);
+        } catch (MalformedURLException e) {
+            return resource.location;
+        }
+        return versionedURL;
+    }
+ 
+    
+    /**
+     * Pick the next resource to download or initialize.  If there
+     * are no more resources requested then one is taken from a
+     * resource tracker with prefetch enabled.<p>
+     *
+     * The resource state is advanced before it is returned
+     * (CONNECT-&gt;CONNECTING).<p>
+     *
+     * Calls to this method should be synchronized on lock.<p>
+     *
+     * @return the resource to initialize or download, or null
+     */
+    private static Resource selectNextResource() {
+        Resource result;
+
+        // pick from queue
+        result = selectByFlag(queue, CONNECT, ERROR); // connect but not error
+        if (result == null)
+            result = selectByFlag(queue, DOWNLOAD, ERROR|CONNECT|CONNECTING);
+
+        // remove from queue if found
+        if (result != null)
+            queue.remove(result);
+
+        // prefetch if nothing found so far and this is the last thread
+        if (result == null && threads == 1)
+            result = getPrefetch();
+
+        if (result == null)
+            return null;
+
+        synchronized (result) {
+            if (result.isSet(CONNECT)) {
+                result.changeStatus(CONNECT, CONNECTING);
+            }
+            else if (result.isSet(DOWNLOAD)) {
+                // only download if *not* connecting, when done connecting
+                // select next will pick up the download part.  This makes
+                // all requested connects happen before any downloads, so
+                // the size is known as early as possible.
+                result.changeStatus(DOWNLOAD, DOWNLOADING);
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Returns the next resource to be prefetched before
+     * requested.<p>
+     *
+     * Calls to this method should be synchronized on lock.<p>
+     */
+    private static Resource getPrefetch() {
+        Resource result = null;
+        Resource alternate = null;
+
+        // first find one to initialize 
+        synchronized (prefetchTrackers) {
+            for (int i=0; i < prefetchTrackers.size() && result == null; i++) {
+                ResourceTracker tracker = (ResourceTracker) prefetchTrackers.get(i);
+                if (tracker == null)
+                    continue;
+
+                synchronized (tracker.resources) {
+                    result = selectByFlag(tracker.resources, UNINITIALIZED, ERROR);
+
+                    if (result == null && alternate == null)
+                        alternate = selectByFlag(tracker.resources, CONNECTED, ERROR|DOWNLOADED|DOWNLOADING|DOWNLOAD);
+                }
+            }
+        }
+
+        // if none to initialize, switch to download
+        if (result == null)
+            result = alternate;
+
+        if (result == null)
+            return null;
+
+        synchronized (result) {
+            ResourceTracker tracker = result.getTracker();
+            if (tracker == null)
+                return null; // GC of tracker happened between above code and here
+
+            // prevents startResource from putting it on queue since
+            // we're going to return it.
+            result.changeStatus(0, STARTED);
+
+            tracker.startResource(result);
+        }
+
+        return result;
+    }
+
+    /**
+     * Selects a resource from the source list that has the
+     * specified flag set.<p>
+     *
+     * Calls to this method should be synchronized on lock and
+     * source list.<p>
+     */
+    private static Resource selectByFlag(List source, int flag, int notflag) {
+        Resource result = null;
+        int score = Integer.MAX_VALUE;
+
+        for (int i=0; i < source.size(); i++) {
+            Resource resource = (Resource) source.get(i);
+            boolean selectable = false;
+
+            synchronized (resource) {
+                if (resource.isSet(flag) && !resource.isSet(notflag))
+                    selectable = true;
+            }
+
+            if (selectable) {
+                int activeCount = 0;
+
+                for (int j=0; j < active.size(); j++)
+                    if ((ResourceTracker)active.get(j) == resource.getTracker())
+                        activeCount++;
+
+                // try to spread out the downloads so that a slow host
+                // won't monopolize the downloads
+                if (activeCount < score) {
+                    result = resource;
+                    score = activeCount;
+                }
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Return the resource matching the specified URL.
+     *
+     * @throws IllegalArgumentException if the resource is not being tracked
+     */
+    private Resource getResource(URL location) {
+        synchronized (resources) {
+            for (int i=0; i < resources.size(); i++) {
+                Resource resource = (Resource) resources.get(i);
+
+                if (CacheUtil.urlEquals(resource.location, location))
+                    return resource;
+            }
+        }
+
+        throw new IllegalArgumentException("Location does not specify a resource being tracked.");
+    }
+
+    /**
+     * Wait for some resources.
+     *
+     * @param resources the resources to wait for
+     * @param timeout the timeout, or 0 to wait until completed
+     * @returns true if the resources were downloaded or had errors,
+     * false if the timeout was reached
+     * @throws InterruptedException if another thread interrupted the wait
+     */
+    private boolean wait(Resource resources[], long timeout) throws InterruptedException {
+        long startTime = System.currentTimeMillis();
+
+        // start them downloading / connecting in background
+        for (int i=0; i < resources.length; i++)
+            startResource(resources[i]);
+
+        // wait for completion
+        while (true) {
+            boolean finished = true;
+
+            synchronized (lock) {
+                // check for completion 
+                for (int i=0; i < resources.length; i++) {
+                	//NetX Deadlocking may be solved by removing this 
+                	//synch block.
+                    synchronized (resources[i]) {
+                        if (!resources[i].isSet(DOWNLOADED | ERROR)) {
+                            finished = false;
+                            break;
+                        }
+                    }
+                }
+                if (finished)
+                    return true;
+
+                // wait
+                long waitTime = 0;
+
+                if (timeout > 0) {
+                    waitTime = timeout - (System.currentTimeMillis()-startTime);
+                    if (waitTime <= 0)
+                        return false;
+                }
+
+                lock.wait(waitTime);
+            }
+        }
+    }
+
+
+    // inner classes
+
+    /** 
+     * This class downloads and initializes the queued resources.
+     */
+    class Downloader implements Runnable {
+        Resource resource = null;
+
+        public void run() {
+            while (true) {
+                synchronized (lock) {
+                    // remove from active list, used for load balancing
+                    if (resource != null)
+                        active.remove(resource.getTracker());
+
+                    resource = selectNextResource();
+
+                    if (resource == null) {
+                        endThread();
+                        break;
+                    }
+
+                    // add to active list, used for load balancing
+                    active.add(resource.getTracker());
+                }
+
+                try {
+                    processResource(resource);
+                }
+                catch (Exception ex) {
+                    if (JNLPRuntime.isDebug())
+                        ex.printStackTrace();
+                }
+            }
+            // should have a finally in case some exception is thrown by
+            // selectNextResource();
+        }
+    };
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/UpdatePolicy.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,90 @@
+// Copyright (C) 2002 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.cache;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.reflect.*;
+import java.security.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+/**
+ * A policy that determines when a resource should be checked for
+ * an updated version.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.3 $ 
+ */
+public class UpdatePolicy {
+
+    // todo: implement session updating
+
+    // todo: doesn't seem to work in the same JVM, probably because
+    // Resource is being held by a tracker so it isn't collected;
+    // then next time a tracker adds the resource even if
+    // shouldUpdate==true it's state is already marked
+    // CONNECTED|DOWNLOADED.  Let the resource be collected or reset
+    // to UNINITIALIZED.
+
+    public static UpdatePolicy ALWAYS = new UpdatePolicy(0);
+    public static UpdatePolicy SESSION = new UpdatePolicy(-1);
+    public static UpdatePolicy FORCE = new UpdatePolicy(Long.MIN_VALUE);
+    public static UpdatePolicy NEVER = new UpdatePolicy(Long.MAX_VALUE);
+
+    private long timeDiff = -1;
+
+
+    /**
+     * Create a new update policy; this policy always updates the
+     * entry unless the shouldUpdate method is overridden.
+     */
+    public UpdatePolicy() {
+    }
+
+    /**
+     * Create an update policy that only checks a file for being
+     * updated if it has not been checked for longer than the
+     * specified time.
+     *
+     * @param timeDiff how long in ms until update needed
+     */
+    public UpdatePolicy(long timeDiff) {
+        this.timeDiff = timeDiff;
+    }
+
+    /**
+     * Returns whether the resource should be checked for being
+     * up-to-date.
+     */
+    public boolean shouldUpdate(CacheEntry entry) {
+        long updated = entry.getLastUpdated();
+        long current = System.currentTimeMillis();
+
+        if (current - updated >= timeDiff)
+            return true;
+        else
+            return false;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/cache/package.html	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+This package contains the JNLP cache.
+
+<h2>Package Specification</h2>
+
+<ul>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/event/ApplicationEvent.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,57 @@
+// Copyright (C) 2002 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp.event;
+
+import java.util.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * This event is sent when an application is terminated.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $ 
+ */
+public class ApplicationEvent extends EventObject {
+
+    /** the application instance */
+    private ApplicationInstance application;
+
+
+    /**
+     * Creates a launch event for the specified application
+     * instance.
+     *
+     * @param source the application instance
+     */
+    public ApplicationEvent(ApplicationInstance source) {
+        super(source);
+
+        this.application = source;
+    }
+
+    /** 
+     * Returns the application instance.
+     */
+    public ApplicationInstance getApplication() {
+        return application;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/event/ApplicationListener.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,38 @@
+// Copyright (C) 2002 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.event;
+
+import java.util.*;
+
+
+/**
+ * The listener that is notified when an application instance is
+ * terminated.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $ 
+ */
+public interface ApplicationListener extends EventListener {
+
+    /**
+     * Invoked when the application is destroyed.
+     */
+    public void applicationDestroyed(ApplicationEvent applicationEvent);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/event/DownloadEvent.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,72 @@
+// Copyright (C) 2002 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp.event;
+
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * This event is sent during the launch of an
+ * application.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.3 $ 
+ */
+public class DownloadEvent extends EventObject {
+
+    /** the tracker */
+    private ResourceTracker tracker;
+
+    /** the resource */
+    private Resource resource;
+
+
+    /**
+     * Creates a launch event for the specified application
+     * instance.
+     *
+     * @param source the resource tracker
+     * @param resource the resource
+     */
+    public DownloadEvent(ResourceTracker source, Resource resource) {
+        super(source);
+
+        this.tracker = source;
+        this.resource = resource;
+    }
+
+    /**
+     * Returns the tracker that owns the resource.
+     */
+    public ResourceTracker getTracker() {
+        return tracker;
+    }
+
+    /** 
+     * Returns the location of the resource being downloaded.
+     */
+    public URL getResourceLocation() {
+        return resource.getLocation();
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/event/DownloadListener.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,51 @@
+// Copyright (C) 2002 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.event;
+
+import java.util.*;
+
+
+/**
+ * The listener that is notified of the state of resources being
+ * downloaded by a ResourceTracker.  Events may be delivered on a
+ * background thread, and the event methods should complete
+ * quickly so that they do not slow down other downloading in
+ * progress by tying up a thread.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.3 $ 
+ */
+public interface DownloadListener extends EventListener {
+
+    /**
+     * Called when a resource is checked for being up-to-date.
+     */
+    public void updateStarted(DownloadEvent downloadEvent);
+
+    /**
+     * Called when a download starts.
+     */
+    public void downloadStarted(DownloadEvent downloadEvent);
+
+    /**
+     * Called when a download completed or there was an error.
+     */
+    public void downloadCompleted(DownloadEvent downloadEvent);
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/event/package.html	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+This package contains the JNLP events.
+
+<h2>Package Specification</h2>
+
+<ul>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/package.html	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+This package contains the classes that represent the parts of a
+Java Network Launching Protocol (JNLP) file as objects, and a way
+to launch a JNLP file as an application, applet, or installer.
+
+<h2>Package Specification</h2>
+
+<ul>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/resources/Manifest.mf	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Created-By: jnlp.sourceforge.net
+Specification-Title: netx JNLP client
+Sealed: true
+Main-Class: net.sourceforge.jnlp.runtime.Boot13
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,163 @@
+# Default (English) UI messages for netx
+# L=Launcher, B=Boot, P=Parser, C=cache S=security
+#
+# General
+NullParameter=Null parameter
+ButOk=OK
+ButCancel=\ Cancel\ 
+ButBrowse=Browse...
+
+# LS - Severity
+LSMinor=Minor
+LSFatal=Fatal
+
+# LC - Category 
+LCSystem=System Error
+LCExternalLaunch=External Launch Error
+LCFileFormat=File Format Error
+LCReadError=Read Error
+LCClient=Application Error
+LCLaunching=Launch Error
+LCNotSupported=Unsupported Feature
+LCInit=Initialization Error
+ 
+LAllThreadGroup=All JNLP applications
+LNullUpdatePolicy=Update policy cannot be null.
+ 
+LThreadInterrupted=Thread interrupted while waiting for file to launch.
+LThreadInterruptedInfo=
+LCouldNotLaunch=Could not launch JNLP file.
+LCouldNotLaunchInfo=
+LCantRead=Could not read or parse the JNLP file.
+LCantReadInfo=
+LNullLocation=Could not determine .jnlp file location.
+LNullLocationInfo=An attempt was made to launch a JNLP file in another JVM, but the file could not be located.  In order to launch in an external JVM, the runtime must be able to locate the .jnlp file either in the local filesystem or on a server.
+LNetxJarMissing=Could not determine location of netx.jar.
+LNetxJarMissingInfo=An attempt was made to lauch a JNLP file in another JVM, but the netx.jar could not be located.  In order to launch in an external JVM, the runtime must be able to locate the netx.jar file.
+LNotToSpec=JNLP file not strictly to spec.
+LNotToSpecInfo=The JNLP file contains data that is prohibited by the JNLP specification.  The runtime can attempt to ignore the invalid information and continue launching the file.
+LNotApplication=Not an application file.
+LNotApplicationInfo=An attempt was made to load a non-application file as an application.
+LNotApplet=Not an applet file.
+LNotAppletInfo=An attempt was made to load a non-applet file as an applet.
+LNoInstallers=Installers not supported.
+LNoInstallersInfo=JNLP installer files are not yet supported.
+LInitApplet=Could not initialize applet.
+LInitAppletInfo=
+LInitApplication=Could not initialize application.
+LInitApplicationInfo=
+LNotLaunchable=Not a launchable JNLP file.
+LNotLaunchableInfo=File must be a JNLP application, applet, or installer type.
+LCantDetermineMainClass=Unknown Main-Class.
+LCantDetermineMainClassInfo=Could not determine the main class for this application.
+
+JNotApplet=File is not an applet.
+JNotApplication=File is not an application.
+JNotComponent=File is not a component.
+JNotInstaller=File is not an installer.
+JInvalidExtensionDescriptor=Extension does not refer to a component or installer (name={1}, location={2}).
+
+LNotVerified=Jars not verified.
+LCancelOnUserRequest=Canceled on user request.
+LFatalVerification=A fatal error occurred while trying to verify jars.
+LFatalVerificationInfo=
+
+LNotVerifiedDialog=Not all jars could be verified.
+LAskToContinue=Would you still like to continue running this application?
+
+# Parser
+PInvalidRoot=Root node is not a jnlp node
+PSpecUnsupported=Spec version not supported (supports {0})
+PNoResources=No resources section defined
+PUntrustedNative=nativelib element cannot be specified unless a trusted environment is requested.
+PExtensionHasJ2SE=j2se element cannot be specified in a component extension file.
+PInnerJ2SE=j2se element cannot be specified within a j2se element.
+PTwoMains=Duplicate main JAR defined in a resources element (there can be only one)
+PNativeHasMain=Cannot specify main attribute on native JARs.
+PNoInfoElement=No information section defined
+PTwoDescriptions=Duplicate description of kind {0}
+PSharing=Element "sharing-allowed" is illegal in a standard JNLP file
+PTwoSecurity=Only one security element allowed per JNLPFile.
+PEmptySecurity=Security element specified but does not contain a permissions element.
+PTwoDescriptors=Only one application descriptor element allowed per JNLPFile.
+PUnknownApplet=Unknown Applet
+PBadWidth=Invalid applet width.
+PBadHeight=Invalid applet height.
+PUrlNotInCodebase=Relative URL does not specify a subdirectory of the codebase. (node={0}, href={1}, base={2})
+PBadRelativeUrl=Invalid relative URL (node={0}, href={1}, base={2})
+PBadNonrelativeUrl=Invalid non-relative URL (node={0}, href={0}).
+PNeedsAttribute=The {0} element must specify a {1} attribute.
+PBadXML=Invalid XML document syntax.
+
+# Runtime
+BLaunchAbout=Launching about window...
+BNeedsFile=Must specify a .jnlp file
+BFileLoc=JNLP file location
+BArgNA=Arguments not used for this type of JNLP file (ignored).
+BParamNA=Parameters not used for this type of JNLP file (ignored).
+BBadProp=Incorrect property format {0} (should be key=value)
+BBadParam=Incorrect parameter format {0} (should be name=value)
+BNoDir=Directory {0} does not exist.
+BNoBase=No base directory (contains cache and other data)
+RNoResource=Missing Resource: {0}
+RShutdown=This exception to prevent shutdown of JVM, but the process has been terminated.
+RExitTaken=Exit class already set and caller is not exit class.
+RCantReplaceSM=Changing the SecurityManager is not allowed.
+RDenyStopped=Stopped applications have no permissions.
+RExitNoApp=Can not exit the JVM because the current application cannot be determined.
+
+# Boot options, message should be shorter than this ---------------->
+BOUsage=javaws [-run-options] <jnlp file>
+BOUsage2=javaws [-control-options]
+BOBasedir   = Directory where the cache is kept.
+BOJnlp      = Location of JNLP file to launch (url or file).
+BOArg       = Adds an application argument before launching.
+BOParam     = Adds an applet parameter before launching.
+BOProperty  = Sets a system property before launching.
+BOUpdate    = Update check if seconds since last checked.
+BOLicense   = Display the GPL license and exit.
+BOVerbose   = Enable verbose output.
+BOAbout     = Shows a sample application.
+BONosecurity= Disables the secure runtime environment.
+BONoupdate  = Disables checking for updates.
+BOHeadless  = Disables download window, other UIs.
+BOStrict    = Enables strict checking of JNLP file format.
+BOViewer    = Shows the trusted certificate viewer.
+BOUmask     = Sets the umask for files created by an application.
+BOHelp      = Print this message and exit.
+
+# Cache
+CAutoGen=automatically generated - do not edit
+CNotCacheable={0} is not a cacheable resource
+CDownloading=Downloading
+CComplete=Complete
+CChooseCache=Choose a cache directory...
+CChooseCacheInfo=Netx needs a location for storing cache files.
+CChooseCacheDir=Cache directory
+
+# Security
+SFileReadAccess=The application has requested read access to a file on the machine. Do you want to allow this action?
+SFileWriteAccess=The application has requested write access to a file on the machine. Do you want to allow this action?
+SSigUnverified=The application's digital signature cannot be verified. Do you want to run the application?
+SSigVerified=The application's digital signature has been verified. Do you want to run the application?
+SSignatureError=The application's digital signature has an error. Do you want to run the application?
+SUntrustedSource=The digital signature could not be verified by a trusted source. Only run if you trust the origin of the application.
+STrustedSource=The digital signature has been validated by a trusted source.
+SClipboardReadAccess=The application has requested read-only access to the system clipboard. Do you want to allow this action?
+SClipboardWriteAccess=The application has requested write-only access to the system clipboard. Do you want to allow this action?
+SPrinterAccess=The application has requested printer access. Do you want to allow this action?
+SNetworkAccess=The application has requested permission to establish connections to {0}. Do you want to allow this action?
+
+# Security - used for the More Information dialog
+SBadKeyUsage=Resources contain entries whose signer certificate's KeyUsage extension doesn't allow code signing.
+SBadExtendedKeyUsage=Resources contain entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing.
+SBadNetscapeCertType=Resources contain entries whose signer certificate's NetscapeCertType extension doesn't allow code signing.
+SHasUnsignedEntry=Resources contain unsigned entries which have not been integrity-checked.
+SHasExpiredCert=The digital signature has expired.
+SHasExpiringCert=Resources contain entries whose signer certificate will expire within six months.
+SNotYetValidCert=Resources contain entries whose signer certificate is not yet valid.
+SUntrustedCertificate=The digital signature was generated with an untrusted certificate.
+STrustedCertificate=The digital signature was generated with a trusted certificate.
+SRunWithoutRestrictions=This application will be run without the security restrictions normally provided by java.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/resources/about.jnlp	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="about.jnlp" codebase="http://icedtea.classpath.org/netx/">
+  <information>
+    <title>About window for NetX</title>
+    <vendor>NetX</vendor>
+    <homepage href="http://jnlp.sourceforge.net/netx/"/>
+    <description>Displays information about NetX</description>
+    <offline/>
+  </information>
+  <resources>
+    <j2se version="1.4+"/>
+    <jar href="about.jar"/>
+  </resources>
+  <security>
+    <all-permissions/>
+  </security>
+  <application-desc main-class="net.sourceforge.jnlp.about.Main">
+  </application-desc>
+</jnlp>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/resources/default.jnlp	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="default.jnlp" codebase="http://icedtea.classpath.org/netx/">
+  <information>
+    <title>About window for NetX</title>
+    <vendor>NetX</vendor>
+    <homepage href="http://jnlp.sourceforge.net/netx/"/>
+    <description>Displays information about NetX</description>
+    <offline/>
+  </information>
+  <resources>
+    <j2se version="1.4+"/>
+    <jar href="default.jar"/>
+  </resources>
+  <security>
+    <all-permissions/>
+  </security>
+  <application-desc main-class="net.sourceforge.jnlp.about.Main">
+  </application-desc>
+</jnlp>
+
Binary file netx/net/sourceforge/jnlp/resources/info-small.png has changed
Binary file netx/net/sourceforge/jnlp/resources/install.png has changed
Binary file netx/net/sourceforge/jnlp/resources/netx-icon.png has changed
Binary file netx/net/sourceforge/jnlp/resources/warning-small.png has changed
Binary file netx/net/sourceforge/jnlp/resources/warning.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,68 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.awt.*;
+
+/**
+ * Thread group for a JNLP application.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $ 
+ */
+public class AppThreadGroup extends ThreadGroup {
+
+    /** the app */
+    private ApplicationInstance app = null;
+
+
+    /**
+     * Creates new JavaAppThreadGroup
+     *
+     * @param name of the App
+     */
+    public AppThreadGroup(ThreadGroup parent, String name) {
+        super(parent, name);
+    }
+
+    /**
+     * Sets the JNLP app this group is for; can only be called once.
+     */
+    public void setApplication(ApplicationInstance app) {
+        if (this.app != null)
+            throw new IllegalStateException("Application can only be set once");
+
+        this.app = app;
+    }
+
+    /**
+     * Returns the JNLP app for this thread group.
+     */
+    public ApplicationInstance getApplication() {
+        return app;
+    }
+
+    /**
+     * Handle uncaught exceptions for the app.
+     */
+    public void uncaughtException(Thread t, Throwable e) {
+        super.uncaughtException(t, e);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,109 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.net.*;
+import java.io.*;
+import java.applet.*;
+import javax.sound.sampled.*;
+
+// based on Deane Richan's AppletAudioClip
+
+/**
+ * An applet audio clip using the javax.sound API.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.8 $ 
+ */
+public class AppletAudioClip implements AudioClip {
+
+    /** the clip */
+    private Clip clip;
+
+
+    /** 
+     * Creates new AudioClip.  If the clip cannot be opened no
+     * exception is thrown, instead the methods of the AudioClip
+     * return without performing any operations.
+     *
+     * @param location the clip location
+     */
+    public AppletAudioClip(URL location) {
+        try {
+            AudioInputStream stream = AudioSystem.getAudioInputStream(location);
+
+            clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
+            clip.open(stream);
+        }
+        catch (Exception ex) {
+            System.err.println("Error loading sound:"+location.toString());
+            clip = null;
+        }
+    }
+
+    /**
+     * Plays the clip in a continuous loop until the stop method is
+     * called.
+     */
+    public void loop() {
+        if (clip == null)
+            return;
+
+        clip.loop(Clip.LOOP_CONTINUOUSLY);
+    }
+
+    /**
+     * Plays the clip from the beginning.
+     */
+    public void play() {
+        if (clip == null)
+            return;
+
+        // applet audio clip resets to beginning when played again
+        clip.stop();
+        clip.setFramePosition(0);
+        clip.start();
+    }
+
+    /**
+     * Stops playing the clip.
+     */
+    public void stop() {
+        if (clip == null)
+            return;
+
+        clip.stop();
+    }
+
+    /**
+     * Stops playing the clip and disposes it; the clip cannot be
+     * played after being disposed.
+     */
+    void dispose() {
+        if (clip != null) {
+            clip.stop();
+            clip.flush();
+            clip.close();
+        }
+
+        clip = null;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,354 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+import java.util.List;
+import java.lang.reflect.InvocationTargetException;
+import java.net.*;
+import java.io.*;
+import javax.swing.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * The applet environment including stub, context, and frame.  The
+ * default environment puts the applet in a non-resiable frame;
+ * this can be changed by obtaining the frame and setting it
+ * resizable.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.12 $ 
+ */
+public class AppletEnvironment implements AppletContext, AppletStub {
+
+    /** the JNLP file */
+    private JNLPFile file;
+
+    /** the applet instance */
+    private AppletInstance appletInstance;
+
+    /** the applet */
+    private Applet applet;
+
+    /** the parameters */
+    private Map parameters;
+
+    /** the applet container */
+    private Container cont;
+
+    /** weak references to the audio clips */
+    private WeakList weakClips = new WeakList();
+
+    /** whether the applet has been started / displayed */
+    private boolean appletStarted = false;
+
+    /** whether the applet has been destroyed */
+    private boolean destroyed = false;
+
+
+    /**
+     * Create a new applet environment for the applet specified by
+     * the JNLP file.
+     */
+    public AppletEnvironment(JNLPFile file, final AppletInstance appletInstance, Container cont) {
+        this.file = file;
+        this.appletInstance = appletInstance;
+        this.applet = appletInstance.getApplet();
+
+        parameters = file.getApplet().getParameters();
+        this.cont = cont;
+    }
+
+    /**
+     * Create a new applet environment for the applet specified by
+     * the JNLP file, in a new frame.
+     */
+    public AppletEnvironment(JNLPFile file, final AppletInstance appletInstance) {
+        this(file, appletInstance, null);
+
+        Frame frame = new Frame(file.getApplet().getName() + " - Applet");
+        frame.setResizable(false);
+
+        appletInstance.addWindow(frame);
+        // may not need this once security manager can close windows
+        // that do not have app code on the stack
+        WindowListener closer = new WindowAdapter() {
+            public void windowClosing(WindowEvent event) {
+                appletInstance.destroy();
+                System.exit(0);
+            }
+        };
+        frame.addWindowListener(closer);
+        this.cont = frame;
+    }
+
+    /**
+     * Checks whether the applet has been destroyed, and throws an
+     * IllegalStateException if the applet has been destroyed of.
+     *
+     * @throws IllegalStateException
+     */
+    private void checkDestroyed() {
+        if (destroyed)
+            throw new IllegalStateException("Illegal applet stub/context access: applet destroyed.");
+    }
+
+    /**
+     * Disposes the applet's resources and disables the applet
+     * environment from further use; after calling this method the
+     * applet stub and context methods throw IllegalStateExceptions.
+     */
+    public void destroy() {
+        destroyed = true;
+
+        List clips = weakClips.hardList();
+        for (int i = 0; i < clips.size(); i++) {
+            ((AppletAudioClip)clips.get(i)).dispose();
+        }
+    }
+
+    /**
+     * Returns the frame that contains the applet.  Disposing this
+     * frame will destroy the applet.
+     */
+    public Container getAppletFrame() {
+        // TODO: rename this method to getAppletContainer ?
+        return cont;
+    }
+
+    /**
+     * Initialize, start, and show the applet.
+     */
+    public void startApplet() {
+        checkDestroyed();
+
+        if (appletStarted)
+            return;
+
+        appletStarted = true;
+
+        try {
+            AppletDesc appletDesc = file.getApplet();
+
+            if (cont instanceof AppletStub)
+                applet.setStub((AppletStub)cont);
+            else
+                applet.setStub(this);
+
+            cont.setLayout(new BorderLayout());
+            cont.add("Center", applet);
+            cont.validate();
+
+            // This is only needed if the applet is in its own frame.
+            if (cont instanceof Frame) {
+                Frame frame = (Frame) cont;
+                frame.pack(); // cause insets to be calculated
+
+                Insets insets = frame.getInsets();
+                frame.setSize(appletDesc.getWidth() + insets.left + insets.right,
+                              appletDesc.getHeight() + insets.top + insets.bottom);
+            }
+    
+            try {
+            	SwingUtilities.invokeAndWait(new Runnable() {
+            		public void run() {
+            			// do first because some applets need to be displayed before
+            			// starting (they use Component.getImage or something)
+            			cont.setVisible(true);
+
+            			applet.init();
+            			applet.start();
+
+            			cont.invalidate(); // this should force the applet to
+            			cont.validate();   // the correct size and to repaint
+            			cont.repaint();
+            		}
+            	});
+            } catch (InterruptedException ie) {
+
+            } catch (InvocationTargetException ite) {
+
+            }
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            // should also kill the applet?
+        }
+    }
+
+    // applet context methods 
+
+    /**
+     * Returns the applet if the applet's name is specified,
+     * otherwise return null.
+     */
+    public Applet getApplet(String name) {
+        checkDestroyed();
+
+        if (name != null && name.equals(file.getApplet().getName()))
+            return applet;
+        else
+            return null;
+    }
+
+    /**
+     * Returns an enumeration that contains only the applet
+     * from the JNLP file.
+     */
+    public Enumeration getApplets() {
+        checkDestroyed();
+
+        return Collections.enumeration( Arrays.asList(new Applet[] { applet }) );
+    }
+
+    /**
+     * Returns an audio clip.
+     */
+    public AudioClip getAudioClip(URL location) {
+        checkDestroyed();
+
+        AppletAudioClip clip = new AppletAudioClip(location);
+
+        weakClips.add(clip);
+        weakClips.trimToSize();
+
+        return clip;
+    }
+
+    /**
+     * Return an image loaded from the specified location.
+     */
+    public Image getImage(URL location) {
+        checkDestroyed();
+
+        //return Toolkit.getDefaultToolkit().createImage(location);
+        Image image = (new ImageIcon(location)).getImage();
+
+        return image;
+    }
+
+    /**
+     * Not implemented yet.
+     */
+    public void showDocument(java.net.URL uRL) {
+        checkDestroyed();
+
+    }
+
+    /**
+     * Not implemented yet.
+     */
+    public void showDocument(java.net.URL uRL, java.lang.String str) {
+        checkDestroyed();
+
+    }
+
+    /**
+     * Not implemented yet.
+     */
+    public void showStatus(java.lang.String str) {
+        checkDestroyed();
+
+    }
+
+    /**
+     * Required for JRE1.4, but not implemented yet.
+     */
+    public void setStream(String key, InputStream stream) {
+        checkDestroyed();
+
+    }
+
+    /**
+     * Required for JRE1.4, but not implemented yet.
+     */
+    public InputStream getStream(String key) {
+        checkDestroyed();
+
+        return null;
+    }
+
+    /**
+     * Required for JRE1.4, but not implemented yet.
+     */
+    public Iterator getStreamKeys()  {
+        checkDestroyed();
+
+        return null;
+    }
+
+    // stub methods
+
+    public void appletResize(int width, int height) {
+        checkDestroyed();
+
+        if (cont instanceof Frame) {
+            Frame frame = (Frame) cont;
+            Insets insets = frame.getInsets();
+
+            frame.setSize(width + insets.left + insets.right,
+                          height + insets.top + insets.bottom);
+        }
+    }
+
+    public AppletContext getAppletContext() {
+        checkDestroyed();
+
+        return this;
+    }
+
+    public URL getCodeBase() {
+        checkDestroyed();
+
+        return file.getCodeBase();
+    }
+
+    public URL getDocumentBase() {
+        checkDestroyed();
+
+        return file.getApplet().getDocumentBase();
+    }
+
+    // FIXME: Sun's applet code forces all parameters to lower case.
+    // Does Netx's JNLP code do the same, so we can remove the first lookup?
+    public String getParameter(String name) {
+        checkDestroyed();
+
+        String s = (String) parameters.get(name);
+        if (s != null)
+            return s;
+
+        return (String) parameters.get(name.toLowerCase());
+    }
+
+    public boolean isActive() {
+        checkDestroyed();
+
+        // it won't be started or stopped, so if it can call it's running
+        return true;
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/AppletInstance.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,139 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.applet.*;
+import java.awt.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.util.List;
+import java.security.*;
+import java.lang.reflect.*;
+import java.lang.ref.*;
+
+import net.sourceforge.jnlp.*;
+
+
+/**
+ * Represents a launched application instance created from a JNLP
+ * file.  This class does not control the operation of the applet,
+ * use the AppletEnvironment class to start and stop the applet.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.9 $ 
+ */
+public class AppletInstance extends ApplicationInstance {
+
+    /** whether the applet's stop and destroy methods have been called */
+    private boolean appletStopped = false;
+
+    /** the applet */
+    private Applet applet;
+
+    /** the applet environment */
+    private AppletEnvironment environment;
+
+
+    /**
+     * Create a New Task based on the Specified URL
+     */
+    public AppletInstance(JNLPFile file, ThreadGroup group, ClassLoader loader, Applet applet) {
+        super(file, group, loader);
+
+        this.applet = applet;
+
+        this.environment = new AppletEnvironment(file, this);
+    }
+
+    /**
+     * 
+     */
+    public AppletInstance(JNLPFile file, ThreadGroup group, ClassLoader loader, Applet applet, Container cont) {
+        super(file, group, loader);
+        this.applet = applet;
+        this.environment = new AppletEnvironment(file, this, cont);
+    }
+
+    /**
+     * Sets whether the applet is resizable or not.  Applets default
+     * to being not resizable.
+     */
+    public void setResizable(boolean resizable) {
+        Container c = environment.getAppletFrame();
+        if (c instanceof Frame)
+            ((Frame) c).setResizable(resizable);
+    }
+
+    /**
+     * Returns whether the applet is resizable.
+     */
+    public boolean isResizable() {
+        Container c = environment.getAppletFrame();
+        if (c instanceof Frame)
+            return ((Frame) c).isResizable();
+
+        return false;
+    }
+
+    /**
+     * Returns the application title.
+     */
+    public String getTitle() {
+        return getJNLPFile().getApplet().getName();
+    }
+
+    /**
+     * Returns the applet environment.
+     */
+    public AppletEnvironment getAppletEnvironment() {
+        return environment;
+    }
+
+    /**
+     * Returns the applet.
+     */
+    public Applet getApplet() {
+        return applet;
+    }
+
+    /**
+     * Stop the application and destroy its resources.
+     */
+    public void destroy() {
+        if (appletStopped)
+            return;
+
+        appletStopped = true;
+
+        try {
+            applet.stop();
+            applet.destroy();
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+        }
+
+        environment.destroy();
+
+        super.destroy();
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,248 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.awt.*;
+import java.util.*;
+import java.util.List;
+import java.security.*;
+import javax.swing.event.EventListenerList;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.event.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * Represents a running instance of an application described in a
+ * JNLPFile.  This class provides a way to track the application's
+ * resources and destroy the application.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.15 $ 
+ */
+public class ApplicationInstance {
+
+    // todo: should attempt to unload the environment variables
+    // installed by the application.
+
+
+    /** the file */
+    private JNLPFile file;
+
+    /** the thread group */
+    private ThreadGroup group;
+
+    /** the classloader */
+    private ClassLoader loader;
+
+    /** whether the application has stopped running */
+    private boolean stopped = false;
+
+    /** weak list of windows opened by the application */
+    private WeakList weakWindows = new WeakList();
+
+    /** list of application listeners  */
+    private EventListenerList listeners = new EventListenerList();
+
+	/** whether or not this application is signed */
+	private boolean isSigned = false;
+
+    /**
+     * Create an application instance for the file.
+     */
+    public ApplicationInstance(JNLPFile file, ThreadGroup group, ClassLoader loader) {
+        this.file = file;
+        this.group = group;
+        this.loader = loader;
+        this.isSigned = ((JNLPClassLoader) loader).getSigning();
+    }
+
+    /**
+     * Add an Application listener
+     */
+    public void addApplicationListener(ApplicationListener listener) {
+        listeners.add(ApplicationListener.class, listener);
+    }
+
+    /**
+     * Remove an Application Listener
+     */
+    public void removeApplicationListener(ApplicationListener listener) {
+        listeners.remove(ApplicationListener.class, listener);
+    }
+
+    /**
+     * Notify listeners that the application has been terminated.
+     */
+    protected void fireDestroyed() {
+        Object list[] = listeners.getListenerList();
+        ApplicationEvent event = null;
+
+        for (int i=list.length-1; i>0; i-=2) { // last to first required
+            if (event == null)
+                event = new ApplicationEvent(this);
+
+            ((ApplicationListener)list[i]).applicationDestroyed(event);
+        }
+    }
+
+    /**
+     * Initialize the application's environment (installs
+     * environment variables, etc).
+     */
+    public void initialize() {
+        installEnvironment();
+    }
+
+    /**
+     * Releases the application's resources before it is collected.
+     * Only collectable if classloader and thread group are
+     * also collectable so basically is almost never called (an
+     * application would have to close its windows and exit its
+     * threads but not call System.exit).
+     */
+    public void finalize() {
+        destroy();
+    }
+
+    /**
+     * Install the environment variables.
+     */
+    void installEnvironment() {
+        final PropertyDesc props[] = file.getResources().getProperties();
+
+        PrivilegedAction installProps = new PrivilegedAction() {
+            public Object run() {
+                for (int i=0; i < props.length; i++) {
+                    System.setProperty(props[i].getKey(), props[i].getValue());
+                }
+
+                return null;
+            }
+        };
+        AccessController.doPrivileged(installProps);
+    }
+
+    /** 
+     * Returns the JNLP file for this task.
+     */
+    public JNLPFile getJNLPFile() {
+        return file;
+    }
+
+    /**
+     * Returns the application title.
+     */
+    public String getTitle() {
+        return file.getTitle();
+    }
+
+    /**
+     * Returns whether the application is running.
+     */
+    public boolean isRunning() {
+        return !stopped;
+    }
+
+    /**
+     * Stop the application and destroy its resources.
+     */
+    public void destroy() {
+        if (stopped)
+            return;
+
+        try {
+            // destroy resources
+            for (int i=0; i < weakWindows.size(); i++) {
+                Window w = (Window) weakWindows.get(i);
+                if (w != null)
+                    w.dispose();
+            }
+
+            weakWindows.clear();
+
+             // interrupt threads
+            Thread threads[] = new Thread[ group.activeCount() * 2 ];
+            int nthreads = group.enumerate(threads);
+            for (int i=0; i < nthreads; i++) {
+                if (JNLPRuntime.isDebug())
+                    System.out.println("Interrupt thread: "+threads[i]);
+
+                threads[i].interrupt();
+            }
+
+            // then stop
+            Thread.currentThread().yield();
+            nthreads = group.enumerate(threads);
+            for (int i=0; i < nthreads; i++) {
+                if (JNLPRuntime.isDebug())
+                    System.out.println("Stop thread: "+threads[i]);
+
+                threads[i].stop();
+            }
+
+            // then destroy - except Thread.destroy() not implemented in jdk
+
+       }
+        finally {
+            stopped = true;
+            fireDestroyed();
+        }
+    }
+
+    /**
+     * Returns the thread group.
+     *
+     * @throws IllegalStateException if the app is not running
+     */
+    public ThreadGroup getThreadGroup() throws IllegalStateException {
+        if (stopped)
+            throw new IllegalStateException();
+
+        return group;
+    }
+
+    /** 
+     * Returns the classloader.
+     *
+     * @throws IllegalStateException if the app is not running
+     */
+    public ClassLoader getClassLoader() throws IllegalStateException {
+        if (stopped)
+            throw new IllegalStateException();
+
+        return loader;
+    }
+
+    /**
+     * Adds a window that this application opened.  When the
+     * application is disposed, these windows will also be disposed.
+     */
+    protected void addWindow(Window window) {
+        weakWindows.add(window);
+        weakWindows.trimToSize();
+    }
+
+	/**
+	 * Returns whether or not this jar is signed.
+	 */
+	public boolean isSigned() {
+		return isSigned;
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,442 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+
+import net.sourceforge.jnlp.AppletDesc;
+import net.sourceforge.jnlp.ApplicationDesc;
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.LaunchException;
+import net.sourceforge.jnlp.Launcher;
+import net.sourceforge.jnlp.ParseException;
+import net.sourceforge.jnlp.PropertyDesc;
+import net.sourceforge.jnlp.ResourcesDesc;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.security.VariableX509TrustManager;
+import net.sourceforge.jnlp.security.viewer.CertificateViewer;
+import net.sourceforge.jnlp.services.ServiceUtil;
+
+/**
+ * This is the main entry point for the JNLP client.  The main
+ * method parses the command line parameters and loads a JNLP
+ * file into the secure runtime environment.  This class is meant
+ * to be called from the command line or file association; to
+ * initialize the netx engine from other code invoke the
+ * <code>JNLPRuntime.initialize</code> method after configuring
+ * the runtime.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.21 $
+ */
+public final class Boot implements PrivilegedAction {
+
+    // todo: decide whether a spawned netx (external launch)
+    // should inherit the same options as this instance (store argv?)
+    
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+    private static String R(String key, Object param) { return JNLPRuntime.getMessage(key, new Object[] {param}); }
+
+    private static final String version = "0.5";
+
+    /** the JNLP file to open to display the network-based about window */
+    private static final String aboutFile = 
+        System.getProperty("java.home") + "/lib/about.jnlp";
+
+    /** the text to display before launching the about link */
+    private static final String aboutMessage = ""
+        + "netx v"+version+" - (C)2001-2003 Jon A. Maxwell (jmaxwell@users.sourceforge.net)\n"
+        + "\n"
+        + R("BLaunchAbout");
+
+    private static final String miniLicense = "\n"
+        + "   netx - an open-source JNLP client.\n"
+        + "   Copyright (C) 2001-2003 Jon A. Maxwell (JAM)\n"
+        + "\n"
+        + "   // This library is free software; you can redistribute it and/or\n"
+        + "   modify it under the terms of the GNU Lesser General Public\n"
+        + "   License as published by the Free Software Foundation; either\n"
+        + "   version 2.1 of the License, or (at your option) any later version.\n"
+        + "\n"
+        + "   This library is distributed in the hope that it will be useful,\n"
+        + "   but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+        + "   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
+        + "   Lesser General Public License for more details.\n"
+        + "\n"
+        + "   You should have received a copy of the GNU Lesser General Public\n"
+        + "   License along with this library; if not, write to the Free Software\n"
+        + "   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n"
+        + "\n";
+
+    private static final String helpMessage = "\n"
+        + "Usage:   " + R("BOUsage")+"\n"
+        + "         " + R("BOUsage2")+"\n"
+        + "\n"
+        + "control-options:"+"\n"
+        + "  -about                "+R("BOAbout")+"\n"
+        + "  -viewer               "+R("BOViewer")+"\n"
+        + "\n"
+        + "run-options:"+"\n"
+        + "  -basedir dir          "+R("BOBasedir")+"\n"
+        + "  -arg arg              "+R("BOArg")+"\n"
+        + "  -param name=value     "+R("BOParam")+"\n"
+        + "  -property name=value  "+R("BOProperty")+"\n"
+        + "  -update seconds       "+R("BOUpdate")+"\n"
+        + "  -license              "+R("BOLicense")+"\n"
+        + "  -verbose              "+R("BOVerbose")+"\n"
+        + "  -nosecurity           "+R("BONosecurity")+"\n"
+        + "  -noupdate             "+R("BONoupdate")+"\n"
+        + "  -headless             "+R("BOHeadless")+"\n"
+        + "  -strict               "+R("BOStrict")+"\n"
+        + "  -umask=value          "+R("BOUmask")+"\n"
+        + "  -help                 "+R("BOHelp")+"\n";
+
+    private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update";
+
+    private static String args[]; // avoid the hot potato
+
+
+    /**
+     * Launch the JNLP file specified by the command-line arguments.
+     */
+    public static void main(String[] argsIn) {
+        args = argsIn;
+        
+        if (null != getOption("-viewer")) {
+
+            try {
+                CertificateViewer.main(null);
+                System.exit(0);
+            } catch (Exception e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        }
+
+        if (null != getOption("-license")) {
+            System.out.println(miniLicense);
+            System.exit(0);
+        }
+
+        if (null != getOption("-help")) {
+            System.out.println(helpMessage);
+            System.exit(0);
+        }
+
+        if (null != getOption("-about"))
+            System.out.println(aboutMessage);
+
+        if (null != getOption("-verbose"))
+            JNLPRuntime.setDebug(true);
+
+        if (null != getOption("-update")) {
+            int value = Integer.parseInt(getOption("-update"));
+            JNLPRuntime.setDefaultUpdatePolicy(new UpdatePolicy(value*1000l));
+        }
+
+        if (null != getOption("-headless"))
+            JNLPRuntime.setHeadless(true);
+
+
+        if (null != getOption("-noupdate"))
+            JNLPRuntime.setDefaultUpdatePolicy(UpdatePolicy.NEVER);
+        
+        // wire in custom authenticator
+        try {
+            SSLSocketFactory sslSocketFactory;
+            SSLContext context = SSLContext.getInstance("SSL");
+            TrustManager[] trust = new TrustManager[] { VariableX509TrustManager.getInstance() };
+            context.init(null, trust, null);
+            sslSocketFactory = context.getSocketFactory();
+            
+            HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
+        } catch (Exception e) {
+            System.err.println("Unable to set SSLSocketfactory (may _prevent_ access to sites that should be trusted)! Continuing anyway...");
+            e.printStackTrace();
+        }
+
+        // do in a privileged action to clear the security context of
+        // the Boot13 class, which doesn't have any privileges in
+        // JRE1.3; JRE1.4 works without Boot13 or this PrivilegedAction.
+        AccessController.doPrivileged(new Boot());
+
+        args = null; // might save a couple bytes...
+    }
+
+    /**
+     * The privileged part (jdk1.3 compatibility).
+     */
+    public Object run() {
+        JNLPRuntime.setBaseDir(getBaseDir());
+        JNLPRuntime.setSecurityEnabled(null == getOption("-nosecurity"));
+        JNLPRuntime.initialize(true);
+
+        try {
+            new Launcher().launch(getFile());
+        }
+        catch (LaunchException ex) {
+            // default handler prints this
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+
+            fatalError(ex.getMessage());
+        }
+
+        return null;
+    }
+
+    private static void fatalError(String message) {
+        System.err.println("netx: "+message);
+        System.exit(1);
+    }
+
+    /**
+     * Returns the about.jnlp file in {java.home}/lib or null if this file
+     * does not exist.
+     */
+    private static String getAboutFile() {
+
+        if (new File(aboutFile).exists())
+            return aboutFile;
+        else
+            return null;
+    }
+
+    /**
+     * Returns the file to open; does not return if no file was
+     * specified.
+     */
+    private static JNLPFile getFile() throws ParseException, MalformedURLException, IOException {
+    
+        String location = getJNLPFile();
+        
+        // override -jnlp with aboutFile
+        if (getOption("-about") != null) {
+            location = getAboutFile();
+            if (location == null)
+                fatalError("Unable to find about.jnlp in {java.home}/lib/");
+        } else {
+            location = getJNLPFile();
+        }
+
+        if (location == null) {
+            System.out.println(helpMessage);
+            System.exit(1);
+        }
+        
+        if (JNLPRuntime.isDebug())
+            System.out.println(R("BFileLoc")+": "+location);
+
+        URL url = null;
+
+        try {
+            if (new File(location).exists())
+                url = new File(location).toURL(); // Why use file.getCanonicalFile?
+            else 
+                url = new URL(ServiceUtil.getBasicService().getCodeBase(), location);
+        } catch (Exception e) {
+            fatalError("Invalid jnlp file " + location);
+            if (JNLPRuntime.isDebug())
+                e.printStackTrace();
+        }
+        
+        boolean strict = (null != getOption("-strict"));
+
+        JNLPFile file = new JNLPFile(url, null, strict);
+
+        // add in extra params from command line
+        addProperties(file);
+
+        if (file.isApplet())
+            addParameters(file);
+
+        if (file.isApplication())
+            addArguments(file);
+
+        if (JNLPRuntime.isDebug()) {
+            if (getOption("-arg") != null)
+                if (file.isInstaller() || file.isApplet())
+                    System.out.println(R("BArgsNA"));
+
+            if (getOption("-param") != null)
+                if (file.isApplication())
+                    System.out.println(R("BParamNA"));
+        }
+
+        return file;
+    }
+
+    /**
+     * Add the properties to the JNLP file.
+     */
+    private static void addProperties(JNLPFile file) {
+        String props[] = getOptions("-property");
+        ResourcesDesc resources = file.getResources();
+
+        for (int i=0; i < props.length; i++) {
+            // allows empty property, not sure about validity of that.
+            int equals = props[i].indexOf("=");
+            if (equals == -1)
+                fatalError(R("BBadProp", props[i]));
+
+            String key = props[i].substring(0, equals);
+            String value = props[i].substring(equals+1, props[i].length());
+
+            resources.addResource(new PropertyDesc(key, value));
+        }
+    }
+
+    /**
+     * Add the params to the JNLP file; only call if file is
+     * actually an applet file.
+     */
+    private static void addParameters(JNLPFile file) {
+        String params[] = getOptions("-param");
+        AppletDesc applet = file.getApplet();
+
+        for (int i=0; i < params.length; i++) {
+            // allows empty param, not sure about validity of that.
+            int equals = params[i].indexOf("=");
+            if (equals == -1)
+                fatalError(R("BBadParam", params[i]));
+
+            String name = params[i].substring(0, equals);
+            String value = params[i].substring(equals+1, params[i].length());
+
+            applet.addParameter(name, value);
+        }
+    }
+
+    /**
+     * Add the arguments to the JNLP file; only call if file is
+     * actually an application (not installer).
+     */
+    private static void addArguments(JNLPFile file) {
+        String args[] = getOptions("-arg");  // FYI args also global variable
+        ApplicationDesc app = file.getApplication();
+
+        for (int i=0; i < args.length; i++) {
+            app.addArgument(args[i]);
+        }
+    }
+
+    /**
+     * Gets the JNLP file from the command line arguments, or exits upon error.
+     */
+    private static String getJNLPFile() {
+
+        if (args.length == 0) {
+            System.out.println(helpMessage);
+            System.exit(0);
+        } else if (args.length == 1) {
+            return args[args.length - 1];
+        } else {
+            String lastArg = args[args.length - 1];
+            String secondLastArg = args[args.length - 2];
+
+            if (doubleArgs.indexOf(secondLastArg) == -1) {
+                return lastArg;
+            } else {
+                System.out.println(helpMessage);
+                System.exit(0);
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Return value of the first occurence of the specified
+     * option, or null if the option is not present.  If the
+     * option is a flag (0-parameter) and is present then the
+     * option name is returned.
+     */
+    private static String getOption(String option) {
+        String result[] = getOptions(option);
+
+        if (result.length == 0)
+            return null;
+        else
+            return result[0];
+    }
+
+    /**
+     * Return all the values of the specified option, or an empty
+     * array if the option is not present.  If the option is a
+     * flag (0-parameter) and is present then the option name is
+     * returned once for each occurrence.
+     */
+    private static String[] getOptions(String option) {
+        List result = new ArrayList();
+
+        for (int i=0; i < args.length; i++) {
+            if (option.equals(args[i])) {
+                if (-1 == doubleArgs.indexOf(option))
+                    result.add(option);
+                else
+                    if (i+1 < args.length)
+                        result.add(args[i+1]);
+            }
+
+            if (args[i].startsWith("-") && -1 != doubleArgs.indexOf(args[i]))
+                i++;
+        }
+
+        return (String[]) result.toArray( new String[result.size()] );
+    }
+
+    /**
+     * Return the base dir.  If the base dir parameter is not set
+     * the value is read from the "${user.home}/.netxrc" file (as
+     * defined by JNLPRuntime).  If that file does not exist, an
+     * install dialog is displayed to select the base directory.
+     */
+    private static File getBaseDir() {
+        if (getOption("-basedir") != null) {
+            File basedir = new File(getOption("-basedir"));
+
+            if (!basedir.exists() || !basedir.isDirectory())
+                fatalError(R("BNoDir", basedir));
+
+            return basedir;
+        }
+
+        // check .netxrc, display dialog
+        File basedir = JNLPRuntime.getDefaultBaseDir();
+        if (basedir == null)
+            fatalError(R("BNoBase"));
+
+        return basedir;
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/Boot13.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,103 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.lang.reflect.*;
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import javax.swing.*;
+
+/**
+ * Allows a Policy and SecurityManager to be set in JRE1.3 without
+ * running the code with only applet permissions; this class is
+ * for backward compatibility only and is totally unnecessary if
+ * running in jdk 1.4 or later (can call Boot directly).
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.5 $
+ */
+public class Boot13 extends URLClassLoader {
+
+    // The problem with setting a Policy in jdk1.3 is that the
+    // system and application classes seem to be loaded in such a
+    // way that only their protection domain determines the
+    // permissions; the policy object is never asked for permissions
+    // after the class is loaded.  This hack creates a classloader
+    // that loads duplicate versions of the classes in such a
+    // manner where they ask with the policy object.  The jdk1.4
+    // correctly honors the Policy object making this unneccessary
+    // post-1.3.
+
+    private Boot13(URL source[]) {
+        super(source);
+    }
+
+    protected PermissionCollection getPermissions(CodeSource source) {
+        Permissions result = new Permissions();
+        result.add( new AllPermission() );
+
+        return result;
+    }
+
+    public Class loadClass(String name) throws ClassNotFoundException {
+        Class c = findLoadedClass(name);
+        if (c != null)
+            return c;
+
+        // reverse the search order so that classes from this
+        // classloader, which sets the right permissions, are found
+        // before the parent classloader which has the same classes
+        // but the wrong permissions.
+        try {
+            return findClass(name);
+        }
+        catch (ClassNotFoundException ex) {
+        }
+
+        return getParent().loadClass(name);
+    }
+
+    public static void main(final String args[]) throws Exception {
+        URL cs = Boot13.class.getProtectionDomain().getCodeSource().getLocation();
+        //  instead of using a custom loadClass search order, we could
+        //  put the classes in a boot/ subdir of the JAR and load
+        //  them from there.  This would be an improvement by not
+        //  allowing applications to get a duplicate jnlp engine (one
+        //  with applet access permissions) by using the system
+        //  classloader but a drawback by not allowing Boot to be
+        //  called directly.
+        //cs = new URL("jar:"+cs+"!/boot/");
+
+        if (cs == null) {
+            System.err.println("fatal: cannot determine code source.");
+            System.exit(1);
+        }
+
+        Boot13 b = new Boot13(new URL[] {cs});
+
+        Thread.currentThread().setContextClassLoader(b); // try to prevent getting the non-policy version of classes
+
+        Class c = b.loadClass("net.sourceforge.jnlp.runtime.Boot");
+        Method main = c.getDeclaredMethod("main", new Class[] {String[].class} );
+
+        main.invoke(null, new Object[] { args } );
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,986 @@
+
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.TreeSet;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import net.sourceforge.jnlp.ExtensionDesc;
+import net.sourceforge.jnlp.JARDesc;
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.LaunchException;
+import net.sourceforge.jnlp.ParseException;
+import net.sourceforge.jnlp.PluginBridge;
+import net.sourceforge.jnlp.ResourcesDesc;
+import net.sourceforge.jnlp.SecurityDesc;
+import net.sourceforge.jnlp.cache.CacheUtil;
+import net.sourceforge.jnlp.cache.ResourceTracker;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+import net.sourceforge.jnlp.tools.JarSigner;
+import sun.misc.JarIndex;
+
+/**
+ * Classloader that takes it's resources from a JNLP file.  If the
+ * JNLP file defines extensions, separate classloaders for these
+ * will be created automatically.  Classes are loaded with the
+ * security context when the classloader was created.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.20 $ 
+ */
+public class JNLPClassLoader extends URLClassLoader {
+
+    // todo: initializePermissions should get the permissions from
+    // extension classes too so that main file classes can load
+    // resources in an extension.
+
+    /** shortcut for resources */
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+
+    /** map from JNLPFile url to shared classloader */
+    private static Map urlToLoader = new HashMap(); // never garbage collected!
+
+    /** number of times a classloader with native code is created */
+    private static int nativeCounter = 0;
+
+    /** the directory for native code */
+    private File nativeDir = null; // if set, some native code exists
+
+    /** security context */
+    private AccessControlContext acc = AccessController.getContext();
+
+    /** the permissions for the cached jar files */
+    private List resourcePermissions;
+
+    /** the app */
+    private ApplicationInstance app = null; // here for faster lookup in security manager
+
+    /** list of this, local and global loaders this loader uses */
+    private JNLPClassLoader loaders[] = null; // ..[0]==this
+
+    /** whether to strictly adhere to the spec or not */
+    private boolean strict = true;
+
+    /** loads the resources */
+    private ResourceTracker tracker = new ResourceTracker(true); // prefetch
+
+    /** the update policy for resources */
+    private UpdatePolicy updatePolicy;
+
+    /** the JNLP file */
+    private JNLPFile file;
+
+    /** the resources section */
+    private ResourcesDesc resources;
+
+    /** the security section */
+    private SecurityDesc security;
+    
+    /** Permissions granted by the user during runtime. */
+    private ArrayList<Permission> runtimePermissions = new ArrayList<Permission>();
+
+    /** all jars not yet part of classloader or active */
+    private List available = new ArrayList();
+
+	/** all of the jar files that were verified */
+	private ArrayList<String> verifiedJars = null;
+
+	/** all of the jar files that were not verified */
+	private ArrayList<String> unverifiedJars = null;
+
+	/** the jarsigner tool to verify our jars */
+	private JarSigner js = null;
+
+	private boolean signing = false;
+	
+	/** ArrayList containing jar indexes for various jars available to this classloader */
+	private ArrayList<JarIndex> jarIndexes = new ArrayList<JarIndex>();
+	
+	/** File entries in the jar files available to this classloader */
+	private TreeSet jarEntries = new TreeSet();
+
+    /**
+     * Create a new JNLPClassLoader from the specified file.
+     *
+     * @param file the JNLP file
+     */
+    protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy) throws LaunchException {
+        super(new URL[0], JNLPClassLoader.class.getClassLoader());
+
+        if (JNLPRuntime.isDebug())
+            System.out.println("New classloader: "+file.getFileLocation());
+
+        this.file = file;
+        this.updatePolicy = policy;
+        this.resources = file.getResources();
+
+        // initialize extensions
+        initializeExtensions();
+
+        // initialize permissions
+        initializePermissions();
+
+        initializeResources();
+
+        setSecurity();
+
+    }
+
+    private void setSecurity() {
+		/**
+		 * When we're trying to load an applet, file.getSecurity() will return
+		 * null since there is no jnlp file to specify permissions. We
+		 * determine security settings here, after trying to verify jars.
+		 */
+		if (file instanceof PluginBridge) {
+			if (signing == true) {
+				this.security = new SecurityDesc(file, 
+					SecurityDesc.ALL_PERMISSIONS,
+					file.getCodeBase().getHost());
+			} else {
+				this.security = new SecurityDesc(file, 
+					SecurityDesc.SANDBOX_PERMISSIONS, 
+					file.getCodeBase().getHost());
+			}
+		} else { //regular jnlp file
+			
+			/**
+			 * If the application is signed, then we set the SecurityDesc to the
+			 * <security> tag in the jnlp file. Note that if an application is
+			 * signed, but there is no <security> tag in the jnlp file, the
+			 * application will get sandbox permissions.
+			 * If the application is unsigned, we ignore the <security> tag and 
+			 * use a sandbox instead. 
+			 */
+			if (signing == true) {
+				this.security = file.getSecurity();
+			} else {
+				this.security = new SecurityDesc(file, 
+						SecurityDesc.SANDBOX_PERMISSIONS, 
+						file.getCodeBase().getHost());
+			}
+		}
+    }
+    
+    /**
+     * Returns a JNLP classloader for the specified JNLP file.
+     *
+     * @param file the file to load classes for
+     * @param policy the update policy to use when downloading resources
+     */
+    public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy) throws LaunchException {
+        JNLPClassLoader loader = null;
+        URL location = file.getFileLocation();
+
+        if (location != null)
+            loader = (JNLPClassLoader) urlToLoader.get(location);
+
+		try {
+        	if (loader == null)
+            	loader = new JNLPClassLoader(file, policy);
+		} catch (LaunchException e) {
+			throw e;
+		}
+
+        if (file.getInformation().isSharingAllowed())
+            urlToLoader.put(location, loader);
+
+        return loader;
+    }
+
+    /**
+     * Returns a JNLP classloader for the JNLP file at the specified
+     * location. 
+     *
+     * @param location the file's location
+     * @param policy the update policy to use when downloading resources
+     */
+    public static JNLPClassLoader getInstance(URL location, String cookieStr, UpdatePolicy policy) throws IOException, ParseException, LaunchException {
+        JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location);
+
+        if (loader == null)
+            loader = getInstance(new JNLPFile(location, cookieStr, false, policy), policy);
+
+        return loader;
+    }
+
+    /**
+     * Load the extensions specified in the JNLP file.
+     */
+    void initializeExtensions() {
+        ExtensionDesc[] ext = resources.getExtensions();
+
+        List loaderList = new ArrayList();
+
+        loaderList.add(this);
+
+		//if (ext != null) {
+        	for (int i=0; i < ext.length; i++) {
+            	try {
+               		JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getCookieStr(), updatePolicy);
+                	loaderList.add(loader);
+            	}
+            	catch (Exception ex) {
+                	ex.printStackTrace();
+            	}
+        	}
+		//}
+
+        loaders = (JNLPClassLoader[]) loaderList.toArray(new JNLPClassLoader[ loaderList.size()]);
+    }
+
+    /**
+     * Make permission objects for the classpath.
+     */
+    void initializePermissions() {
+        resourcePermissions = new ArrayList();
+
+        JARDesc jars[] = resources.getJARs();
+        for (int i=0; i < jars.length; i++) {
+            Permission p = CacheUtil.getReadPermission(jars[i].getLocation(),
+                                                       jars[i].getVersion());
+
+            if (JNLPRuntime.isDebug()) {
+            	if (p == null)
+            		System.out.println("Unable to add permission for " + jars[i].getLocation());
+            	else
+            		System.out.println("Permission added: " + p.toString());
+            }
+            if (p != null)
+                resourcePermissions.add(p);
+        }
+    }
+
+    /**
+     * Load all of the JARs used in this JNLP file into the
+     * ResourceTracker for downloading.
+     */
+    void initializeResources() throws LaunchException {
+        JARDesc jars[] = resources.getJARs();
+		if (jars == null || jars.length == 0)
+			return;
+		/*
+		if (jars == null || jars.length == 0) {
+			throw new LaunchException(null, null, R("LSFatal"),
+			                    R("LCInit"), R("LFatalVerification"), "No jars!");
+		}
+		*/
+        List initialJars = new ArrayList();
+
+        for (int i=0; i < jars.length; i++) {
+
+            available.add(jars[i]);
+
+            if (jars[i].isEager())
+                initialJars.add(jars[i]); // regardless of part
+
+            tracker.addResource(jars[i].getLocation(),
+                                file.getCookieStr(),
+                                jars[i].getVersion(), 
+                                jars[i].isCacheable() ? JNLPRuntime.getDefaultUpdatePolicy() : UpdatePolicy.FORCE
+                               );
+        }
+
+        if (strict)
+            fillInPartJars(initialJars); // add in each initial part's lazy jars
+
+		if (JNLPRuntime.isVerifying()) {
+
+			JarSigner js;
+			waitForJars(initialJars); //download the jars first.
+
+			try {
+				js = verifyJars(initialJars);
+			} catch (Exception e) {
+				//we caught an Exception from the JarSigner class.
+				//Note: one of these exceptions could be from not being able
+				//to read the cacerts or trusted.certs files.
+				e.printStackTrace();
+				throw new LaunchException(null, null, R("LSFatal"),
+					R("LCInit"), R("LFatalVerification"), R("LFatalVerificationInfo"));
+			}
+
+			//Case when at least one jar has some signing
+			if (js.anyJarsSigned()){
+				signing = true;
+
+				//user does not trust this publisher
+				if (!js.getAlreadyTrustPublisher()) {
+				    checkTrustWithUser(js);
+				} else {
+					/**
+					 * If the user trusts this publisher (i.e. the publisher's certificate
+					 * is in the user's trusted.certs file), we do not show any dialogs.
+					 */
+				}
+			} else {
+
+				signing = false;
+				//otherwise this jar is simply unsigned -- make sure to ask
+				//for permission on certain actions
+			}
+		}
+
+        activateJars(initialJars);
+    }
+
+    private void checkTrustWithUser(JarSigner js) throws LaunchException {
+        if (!js.getRootInCacerts()) { //root cert is not in cacerts
+            boolean b = SecurityWarningDialog.showCertWarningDialog(
+                SecurityWarningDialog.AccessType.UNVERIFIED, file, js);
+            if (!b)
+                throw new LaunchException(null, null, R("LSFatal"), 
+                    R("LCLaunching"), R("LNotVerified"), "");
+        } else if (js.getRootInCacerts()) { //root cert is in cacerts
+            boolean b = false;
+            if (js.noSigningIssues())
+                b = SecurityWarningDialog.showCertWarningDialog(
+                        SecurityWarningDialog.AccessType.VERIFIED, file, js);
+            else if (!js.noSigningIssues())
+                b = SecurityWarningDialog.showCertWarningDialog(
+                        SecurityWarningDialog.AccessType.SIGNING_ERROR, file, js);
+            if (!b)
+                throw new LaunchException(null, null, R("LSFatal"),
+                    R("LCLaunching"), R("LCancelOnUserRequest"), "");
+        }
+    }
+
+    /**
+     * Add applet's codebase URL.  This allows compatibility with
+     * applets that load resources from their codebase instead of
+     * through JARs, but can slow down resource loading.  Resources
+     * loaded from the codebase are not cached.
+     */
+    public void enableCodeBase() {
+        addURL( file.getCodeBase() ); // nothing happens if called more that once?
+    }
+
+    /**
+     * Sets the JNLP app this group is for; can only be called once.
+     */
+    public void setApplication(ApplicationInstance app) {
+        if (this.app != null) {
+            if (JNLPRuntime.isDebug()) {
+                Exception ex = new IllegalStateException("Application can only be set once");
+                ex.printStackTrace();
+            }
+            return;
+        }
+
+        this.app = app;
+    }
+
+    /**
+     * Returns the JNLP app for this classloader
+     */
+    public ApplicationInstance getApplication() {
+        return app;
+    }
+
+    /**
+     * Returns the JNLP file the classloader was created from.
+     */
+    public JNLPFile getJNLPFile() {
+        return file;
+    }
+
+    /**
+     * Returns the permissions for the CodeSource.
+     */
+    protected PermissionCollection getPermissions(CodeSource cs) {
+        Permissions result = new Permissions();
+
+        // should check for extensions or boot, automatically give all
+        // access w/o security dialog once we actually check certificates.
+
+        // copy security permissions from SecurityDesc element
+		if (security != null) {
+        	Enumeration e = security.getPermissions().elements();
+        	while (e.hasMoreElements())
+            	result.add((Permission) e.nextElement());
+		}
+
+        // add in permission to read the cached JAR files
+        for (int i=0; i < resourcePermissions.size(); i++)
+            result.add((Permission) resourcePermissions.get(i));
+
+        // add in the permissions that the user granted.
+        for (int i=0; i < runtimePermissions.size(); i++)
+        	result.add(runtimePermissions.get(i));
+
+        return result;
+    }
+
+    protected void addPermission(Permission p) {
+    	runtimePermissions.add(p);
+    }
+    
+    /**
+     * Adds to the specified list of JARS any other JARs that need
+     * to be loaded at the same time as the JARs specified (ie, are
+     * in the same part).
+     */
+    protected void fillInPartJars(List jars) {
+        for (int i=0; i < jars.size(); i++) {
+            String part = ((JARDesc) jars.get(i)).getPart();
+
+            for (int a=0; a < available.size(); a++) {
+                JARDesc jar = (JARDesc) available.get(a);
+
+                if (part != null && part.equals(jar.getPart()))
+                    if (!jars.contains(jar))
+                        jars.add(jar);
+            }
+        }
+    }
+
+    /**
+     * Ensures that the list of jars have all been transferred, and
+     * makes them available to the classloader.  If a jar contains
+     * native code, the libraries will be extracted and placed in
+     * the path.
+     *
+     * @param jars the list of jars to load
+     */
+    protected void activateJars(final List jars) {
+        PrivilegedAction activate = new PrivilegedAction() {
+
+            public Object run() {
+                // transfer the Jars
+                waitForJars(jars);
+
+                for (int i=0; i < jars.size(); i++) {
+                    JARDesc jar = (JARDesc) jars.get(i);
+
+                    available.remove(jar);
+
+                    // add jar
+                    File localFile = tracker.getCacheFile(jar.getLocation());
+                    try {
+                        URL location = jar.getLocation(); // non-cacheable, use source location
+                        if (localFile != null) {
+                            location = localFile.toURL(); // cached file
+                            
+                            // This is really not the best way.. but we need some way for 
+                            // PluginAppletViewer::getCachedImageRef() to check if the image 
+                            // is available locally, and it cannot use getResources() because 
+                            // that prefetches the resource, which confuses MediaTracker.waitForAll() 
+                            // which does a wait(), waiting for notification (presumably 
+                            // thrown after a resource is fetched). This bug manifests itself
+                            // particularly when using The FileManager applet from Webmin.
+                            
+                            JarFile jarFile = new JarFile(localFile);
+                            Enumeration e = jarFile.entries();
+                            while (e.hasMoreElements()) {
+                                
+                                JarEntry je = (JarEntry) e.nextElement();
+                                
+                                // another jar in my jar? it is more likely than you think  
+                                if (je.getName().endsWith(".jar")) {
+                                    // We need to extract that jar so that it can be loaded 
+                                    // (inline loading with "jar:..!/..." path will not work 
+                                    // with standard classloader methods)
+
+                                    String extractedJarLocation = localFile.getParent() + "/" + je.getName();
+                                    FileOutputStream extractedJar = new FileOutputStream(extractedJarLocation);
+                                    InputStream is = jarFile.getInputStream(je);
+
+                                    byte[] bytes = new byte[1024];
+                                    int read = is.read(bytes);
+                                    while (read > 0) {
+                                        extractedJar.write(bytes, 0, read);
+                                        read = is.read(bytes);
+                                    }
+
+                                    is.close();
+                                    extractedJar.close();
+
+                                    JarSigner signer = new JarSigner();
+                                    signer.verifyJar(extractedJarLocation);
+
+                                    if (signer.anyJarsSigned() && !signer.getAlreadyTrustPublisher()) {
+                                        checkTrustWithUser(signer);
+                                    }
+
+                                    try {
+                                        addURL(new URL("file://" + extractedJarLocation));
+                                    } catch (MalformedURLException mfue) {
+                                        if (JNLPRuntime.isDebug())
+                                            System.err.println("Unable to add extracted nested jar to classpath");
+
+                                        mfue.printStackTrace();
+                                    }
+                                }
+
+                                jarEntries.add(je.getName());
+                            }
+
+                        }
+
+                        addURL(location);
+
+                        // there is currently no mechanism to cache files per 
+                        // instance.. so only index cached files
+                        if (localFile != null) {
+                            JarIndex index = JarIndex.getJarIndex(new JarFile(localFile.getAbsolutePath()), null);
+
+                            if (index != null)
+                                jarIndexes.add(index);
+                        }
+
+                        if (JNLPRuntime.isDebug())
+                            System.err.println("Activate jar: "+location);
+                    }
+                    catch (Exception ex) {
+                        if (JNLPRuntime.isDebug())
+                            ex.printStackTrace();
+                    }
+
+                    if (jar.isNative())
+                        activateNative(jar);
+                }
+
+                return null;
+            }
+        };
+
+        AccessController.doPrivileged(activate, acc);
+    }
+
+    /**
+     * Enable the native code contained in a JAR by copying the
+     * native files into the filesystem.  Called in the security
+     * context of the classloader.
+     */
+    protected void activateNative(JARDesc jar) {
+        if (JNLPRuntime.isDebug())
+            System.out.println("Activate native: "+jar.getLocation());
+
+        File localFile = tracker.getCacheFile(jar.getLocation());
+        if (localFile == null)
+            return;
+
+        if (nativeDir == null)
+            nativeDir = getNativeDir();
+
+        try {
+            JarFile jarFile = new JarFile(localFile, false);
+            Enumeration entries = jarFile.entries();
+
+            while (entries.hasMoreElements()) {
+                JarEntry e = (JarEntry) entries.nextElement();
+
+                if (e.isDirectory() || e.getName().indexOf('/') != -1)
+                    continue;
+
+                File outFile = new File(nativeDir, e.getName());
+
+                CacheUtil.streamCopy(jarFile.getInputStream(e),
+                                     new FileOutputStream(outFile));
+            }
+        }
+        catch (IOException ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+        }
+    }
+
+    /**
+     * Return the base directory to store native code files in.
+     * This method does not need to return the same directory across
+     * calls.
+     */
+    protected File getNativeDir() {
+        nativeDir = new File(System.getProperty("java.io.tmpdir") 
+                             + File.separator + "netx-native-" 
+                             + (new Random().nextInt() & 0xFFFF));
+
+        if (!nativeDir.mkdirs()) 
+            return null;
+        else
+            return nativeDir;
+    }
+
+    /**
+     * Return the absolute path to the native library.
+     */
+    protected String findLibrary(String lib) {
+        if (nativeDir == null)
+            return null;
+
+        String syslib = System.mapLibraryName(lib);
+
+        File target = new File(nativeDir, syslib);
+        if (target.exists())
+            return target.toString();
+        else {
+            String result = super.findLibrary(lib);
+            if (result != null)
+                return result;
+
+            return findLibraryExt(lib);
+        }
+    }
+
+    /**
+     * Try to find the library path from another peer classloader.
+     */
+    protected String findLibraryExt(String lib) {
+        for (int i=0; i < loaders.length; i++) {
+            String result = null;
+
+            if (loaders[i] != this)
+                result = loaders[i].findLibrary(lib);
+
+            if (result != null)
+                return result;
+        }
+
+        return null;
+    }
+
+    /**
+     * Wait for a group of JARs, and send download events if there
+     * is a download listener or display a progress window otherwise.
+     *
+     * @param jars the jars
+     */
+    private void waitForJars(List jars) {
+        URL urls[] = new URL[jars.size()];
+
+        for (int i=0; i < jars.size(); i++) {
+            JARDesc jar = (JARDesc) jars.get(i);
+
+            urls[i] = jar.getLocation();
+        }
+
+        CacheUtil.waitForResources(app, tracker, urls, file.getTitle());
+    }
+
+    /**
+	 * Verifies code signing of jars to be used.
+	 *
+	 * @param jars the jars to be verified.
+	 */
+	private JarSigner verifyJars(List<JARDesc> jars) throws Exception {
+	
+		js = new JarSigner();
+		js.verifyJars(jars, tracker);
+		return js;
+	}
+
+    /**
+     * Find the loaded class in this loader or any of its extension loaders.
+     */
+    protected Class findLoadedClassAll(String name) {
+        for (int i=0; i < loaders.length; i++) {
+            Class result = null;
+
+            if (loaders[i] == this)
+                result = super.findLoadedClass(name);
+            else
+                result = loaders[i].findLoadedClassAll(name);
+
+            if (result != null)
+                return result;
+        }
+
+        return null;
+    }
+
+    /**
+     * Find a JAR in the shared 'extension' classloaders, this
+     * classloader, or one of the classloaders for the JNLP file's
+     * extensions.
+     */
+    public Class loadClass(String name) throws ClassNotFoundException {
+
+        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(), 
+                                    file.getCookieStr(),
+                                    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;
+    }
+
+    /**
+     * Find the class in this loader or any of its extension loaders.
+     */
+    protected Class findClass(String name) throws ClassNotFoundException {
+        for (int i=0; i < loaders.length; i++) {
+            try {
+                if (loaders[i] == this)
+                    return super.findClass(name);
+                else
+                    return loaders[i].findClass(name);
+            }
+            catch(ClassNotFoundException ex) { }
+            catch(ClassFormatError cfe) {}
+        }
+
+        throw new ClassNotFoundException(name);
+    }
+
+    /**
+     * Search for the class by incrementally adding resources to the
+     * classloader and its extension classloaders until the resource
+     * is found.
+     */
+    private Class loadClassExt(String name) throws ClassNotFoundException {
+        // make recursive
+        addAvailable();
+
+        // find it
+        try {
+            return findClass(name);
+        }
+        catch(ClassNotFoundException ex) {
+        }
+
+        // add resources until found
+        while (true) {
+            JNLPClassLoader addedTo = addNextResource();
+
+            if (addedTo == null)
+                throw new ClassNotFoundException(name);
+
+            try {
+                return addedTo.findClass(name);
+            }
+            catch(ClassNotFoundException ex) {
+            }
+        }
+    }
+
+    /**
+     * Finds the resource in this, the parent, or the extension
+     * class loaders.
+     */
+    public URL getResource(String name) {
+        URL result = super.getResource(name);
+
+        for (int i=1; i < loaders.length; i++)
+            if (result == null)
+                result = loaders[i].getResource(name);
+
+        return result;
+    }
+
+    /**
+     * Finds the resource in this, the parent, or the extension
+     * class loaders.
+     */
+    public Enumeration findResources(String name) throws IOException {
+        Vector resources = new Vector();
+
+        for (int i=0; i < loaders.length; i++) {
+            Enumeration e;
+
+            if (loaders[i] == this)
+                e = super.findResources(name);
+            else 
+                e = loaders[i].findResources(name);
+
+            while (e.hasMoreElements())
+                resources.add(e.nextElement());
+        }
+
+        return resources.elements();
+    }
+    
+    /**
+     * Returns if the specified resource is available locally from a cached jar
+     * 
+     * @param s The name of the resource
+     * @return Whether or not the resource is available locally
+     */
+    public boolean resourceAvailableLocally(String s) {
+        return jarEntries.contains(s);
+    }
+
+    /**
+     * Adds whatever resources have already been downloaded in the
+     * background.
+     */
+    protected void addAvailable() {
+        // go through available, check tracker for it and all of its
+        // part brothers being available immediately, add them.
+
+        for (int i=1; i < loaders.length; i++) {
+            loaders[i].addAvailable();
+        }
+    }
+
+    /**
+     * Adds the next unused resource to the classloader.  That
+     * resource and all those in the same part will be downloaded
+     * and added to the classloader before returning.  If there are
+     * no more resources to add, the method returns immediately.
+     *
+     * @return the classloader that resources were added to, or null
+     */
+    protected JNLPClassLoader addNextResource() {
+        if (available.size() == 0) {
+            for (int i=1; i < loaders.length; i++) {
+                JNLPClassLoader result = loaders[i].addNextResource();
+
+                if (result != null)
+                    return result;
+            }
+            return null;
+        }
+
+        // add jar
+        List jars = new ArrayList();
+        jars.add(available.get(0));
+
+        fillInPartJars(jars);
+
+		
+		activateJars(jars);
+
+        return this;
+    }
+
+    // this part compatibility with previous classloader
+    /**
+     * @deprecated
+     */
+    public String getExtensionName() {
+        String result = file.getInformation().getTitle();
+
+        if (result == null)
+            result = file.getInformation().getDescription();
+        if (result == null && file.getFileLocation() != null)
+            result = file.getFileLocation().toString();
+        if (result == null && file.getCodeBase() != null)
+            result = file.getCodeBase().toString();
+
+        return result;
+    }
+
+    /**
+     * @deprecated
+     */
+    public String getExtensionHREF() {
+        return file.getFileLocation().toString();
+    }
+
+	public boolean getSigning() {
+		return signing;
+	}
+
+	protected SecurityDesc getSecurity() {
+		return security;
+	}
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,105 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.security.*;
+import java.util.Enumeration;
+
+/**
+ * Policy for JNLP environment.  This class delegates to the
+ * system policy but always grants permissions to the JNLP code
+ * and system CodeSources (no separate policy file needed).  This
+ * class may also grant permissions to applications at runtime if
+ * approved by the user.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $ 
+ */
+public class JNLPPolicy extends Policy {
+
+    /** classes from this source have all permissions */
+    private static CodeSource shellSource;
+
+    /** classes from this source have all permissions */
+    private static CodeSource systemSource;
+
+    /** the previous policy */
+    private static Policy systemPolicy;
+
+
+    protected JNLPPolicy() {
+        shellSource = JNLPPolicy.class.getProtectionDomain().getCodeSource();
+        systemSource = Policy.class.getProtectionDomain().getCodeSource();
+        systemPolicy = Policy.getPolicy();
+    }
+
+    /**
+     * Return a mutable, heterogeneous-capable permission collection
+     * for the source.
+     */
+    public PermissionCollection getPermissions(CodeSource source) {
+        if (source.equals(systemSource) || source.equals(shellSource))
+            return getAllPermissions();
+
+        // if we check the SecurityDesc here then keep in mind that
+        // code can add properties at runtime to the ResourcesDesc!
+        if (JNLPRuntime.getApplication() != null) {
+        	if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
+        		JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
+        		
+        		PermissionCollection clPermissions = cl.getPermissions(source);
+        		
+        		// systempolicy permissions need to be accounted for as well
+        		CodeSource appletCS = new CodeSource(JNLPRuntime.getApplication().getJNLPFile().getSourceLocation(), (java.security.cert.Certificate[]) null);
+        		Enumeration e = systemPolicy.getPermissions(appletCS).elements();
+                while (e.hasMoreElements())
+                    clPermissions.add((Permission) e.nextElement());
+
+        		return clPermissions;
+        	}
+        }
+
+        // delegate to original Policy object; required to run under WebStart
+        return systemPolicy.getPermissions(source);
+    }
+
+    /**
+     * Refresh.
+     */
+    public void refresh() {
+        // no op
+    }
+
+    /**
+     * Return an all-permissions collection.
+     */
+    private Permissions getAllPermissions() {
+        Permissions result = new Permissions();
+
+        result.add( new AllPermission() );
+        return result;
+    }
+
+	public boolean implies(ProtectionDomain domain, Permission permission) {
+		//Include the permissions that may be added during runtime.
+		PermissionCollection pc = getPermissions(domain.getCodeSource());
+		return super.implies(domain, permission) || pc.implies(permission);
+	}
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,496 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.io.*;
+import java.awt.*;
+import java.text.*;
+import java.util.*;
+import java.security.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.services.*;
+import net.sourceforge.jnlp.util.*;
+
+
+/**
+ * Configure and access the runtime environment.  This class
+ * stores global jnlp properties such as default download
+ * indicators, the install/base directory, the default resource
+ * update policy, etc.  Some settings, such as the base directory,
+ * cannot be changed once the runtime has been initialized.<p>
+ *
+ * The JNLP runtime can be locked to prevent further changes to
+ * the runtime environment except by a specified class.  If set,
+ * only instances of the <i>exit class</i> can exit the JVM or
+ * change the JNLP runtime settings once the runtime has been
+ * initialized.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.19 $
+ */
+public class JNLPRuntime {
+
+    static {
+        loadResources();
+    }
+
+    /** the localized resource strings */
+    private static ResourceBundle resources;
+
+    /** the security manager */
+    private static JNLPSecurityManager security;
+
+    /** the security policy */
+    private static JNLPPolicy policy;
+
+    /** the base dir for cache, etc */
+    private static File baseDir;
+
+    /** a default launch handler */
+    private static LaunchHandler handler = null;
+
+    /** default download indicator */
+    private static DownloadIndicator indicator = null;
+
+    /** update policy that controls when to check for updates */
+    private static UpdatePolicy updatePolicy = UpdatePolicy.ALWAYS;
+
+    /** netx window icon */
+    private static Image windowIcon = null;
+
+    /** whether initialized */
+    private static boolean initialized = false;
+
+    /** whether netx is in command-line mode (headless) */
+    private static boolean headless = false;
+
+	/** whether we'll be checking for jar signing */
+	private static boolean verify = true;
+
+    /** whether the runtime uses security */
+    private static boolean securityEnabled = true;
+
+    /** whether debug mode is on */
+    private static boolean debug = false; // package access by Boot
+    
+    /** mutex to wait on, for initialization */
+    public static Object initMutex = new Object();
+
+    /** set to true if this is a webstart application. */
+    private static boolean isWebstartApplication; 
+
+    /**
+     * Returns whether the JNLP runtime environment has been
+     * initialized.  Once initialized, some properties such as the
+     * base directory cannot be changed.  Before 
+     */
+    public static boolean isInitialized() {
+        return initialized;
+    }
+
+    /**
+     * Initialize the JNLP runtime environment by installing the
+     * security manager and security policy, initializing the JNLP
+     * standard services, etc.<p>
+     *
+     * This method cannot be called more than once.  Once
+     * initialized, methods that alter the runtime can only be
+     * called by the exit class.<p>
+     *
+     * @param isApplication is true if a webstart application is being initialized
+     *
+     * @throws IllegalStateException if the runtime was previously initialized
+     */
+    public static void initialize(boolean isApplication) throws IllegalStateException {
+        checkInitialized();
+     
+        isWebstartApplication = isApplication;
+
+        if (headless == false)
+            checkHeadless();
+
+        if (!headless && windowIcon == null)
+            loadWindowIcon();
+
+        if (!headless && indicator == null)
+            indicator = new DefaultDownloadIndicator();
+
+        if (handler == null)
+            handler = new DefaultLaunchHandler();
+
+        if (baseDir == null)
+            baseDir = getDefaultBaseDir();
+
+        if (baseDir == null)
+            throw new IllegalStateException(JNLPRuntime.getMessage("BNoBase"));
+
+        ServiceManager.setServiceManagerStub(new XServiceManagerStub()); // ignored if we're running under Web Start
+	
+        policy = new JNLPPolicy();
+        security = new JNLPSecurityManager(); // side effect: create JWindow
+
+        if (securityEnabled) {
+            Policy.setPolicy(policy); // do first b/c our SM blocks setPolicy
+            System.setSecurityManager(security);
+        }
+
+        initialized = true;
+    }
+
+    /**
+     * Returns true if a webstart application has been initialized, and false
+     * for a plugin applet.
+     */
+    public static boolean isWebstartApplication() {
+        return isWebstartApplication;
+    }
+
+    /**
+     * Returns the window icon.
+     */
+    public static Image getWindowIcon() {
+        return windowIcon;
+    }
+
+    /**
+     * Sets the window icon that is displayed in Java applications
+     * and applets instead of the default Java icon.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setWindowIcon(Image image) {
+        checkExitClass();
+        windowIcon = image;
+    }
+
+    /**
+     * Returns whether the JNLP client will use any AWT/Swing
+     * components.
+     */
+    public static boolean isHeadless() {
+        return headless;
+    }
+
+	/**
+	 * Returns whether we are verifying code signing.
+	 */
+	public static boolean isVerifying() {
+		return verify;
+	}
+    /**
+     * Sets whether the JNLP client will use any AWT/Swing
+     * components.  In headless mode, client features that use the
+     * AWT are disabled such that the client can be used in
+     * headless mode (<code>java.awt.headless=true</code>).
+     *
+     * @throws IllegalStateException if the runtime was previously initialized
+     */
+    public static void setHeadless(boolean enabled) {
+        checkInitialized();
+        headless = enabled;
+    }
+
+   /**
+	* Sets whether we will verify code signing.
+	* @throws IllegalStateException if the runtime was previously initialized
+	*/
+    public static void setVerify(boolean enabled) {
+		checkInitialized();
+		verify = enabled;
+    }
+
+    /**
+     * Return the base directory containing the cache, persistence
+     * store, etc.
+     */
+    public static File getBaseDir() {
+        return baseDir;
+    }
+
+    /**
+     * Sets the base directory containing the cache, persistence
+     * store, etc.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setBaseDir(File baseDirectory) {
+        checkInitialized();
+        baseDir = baseDirectory;
+    }
+
+    /**
+     * Returns whether the secure runtime environment is enabled.
+     */
+    public static boolean isSecurityEnabled() {
+        return securityEnabled;
+    }
+
+    /**
+     * Sets whether to enable the secure runtime environment.
+     * Disabling security can increase performance for some
+     * applications, and can be used to use netx with other code
+     * that uses its own security manager or policy.
+     *
+     * Disabling security is not recommended and should only be
+     * used if the JNLP files opened are trusted.  This method can
+     * only be called before initalizing the runtime.<p>
+     *
+     * @param enabled whether security should be enabled
+     * @throws IllegalStateException if the runtime is already initialized
+     */
+    public static void setSecurityEnabled(boolean enabled) {
+        checkInitialized();
+        securityEnabled = enabled;
+    }
+
+    /**
+     * Returns the system default base dir for or if not set,
+     * prompts the user for the location.
+     *
+     * @return the base dir, or null if the user canceled the dialog
+     * @throws IOException if there was an io exception
+     */
+    public static File getDefaultBaseDir() {
+        PropertiesFile props = JNLPRuntime.getProperties();
+
+        loadWindowIcon();
+
+        String baseStr = props.getProperty("basedir");
+        if (baseStr != null)
+            return new File(baseStr);
+
+        if (isHeadless())
+            return null;
+
+        String homeDir = System.getProperty("user.home");
+	File baseDir = new File(homeDir + "/.netx/");
+	if (homeDir == null || !baseDir.mkdir())
+            return null;
+
+        props.setProperty("basedir", baseDir.toString());
+        props.store();
+
+        return baseDir;
+    }
+
+    /**
+     * Set a class that can exit the JVM; if not set then any class
+     * can exit the JVM.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setExitClass(Class exitClass) {
+        checkExitClass();
+        security.setExitClass(exitClass);
+    }
+    
+    /**
+     * Disables applets from calling exit.
+     * 
+     * Once disabled, exit cannot be re-enabled for the duration of the JVM instance
+     */
+    public static void disableExit() {
+    	security.disableExit();
+    }
+
+    /**
+     * Return the current Application, or null if none can be
+     * determined.
+     */
+    public static ApplicationInstance getApplication() {
+        return security.getApplication();
+    }
+
+    /**
+     * Return a PropertiesFile object backed by the runtime's
+     * properties file.
+     */
+    public static PropertiesFile getProperties() {
+        File netxrc = new File(System.getProperty("user.home"), ".netxrc");
+
+        return new PropertiesFile(netxrc);
+    }
+
+    /**
+     * Return whether debug statements for the JNLP client code
+     * should be printed.
+     */
+    public static boolean isDebug() {
+        return debug;
+    }
+
+    /**
+     * Sets whether debug statements for the JNLP client code
+     * should be printed to the standard output.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setDebug(boolean enabled) {
+        checkExitClass();
+        debug = enabled;
+    }
+
+    /**
+     * Sets the default update policy.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setDefaultUpdatePolicy(UpdatePolicy policy) {
+        checkExitClass();
+        updatePolicy = policy;
+    }
+
+    /**
+     * Returns the default update policy.
+     */
+    public static UpdatePolicy getDefaultUpdatePolicy() {
+        return updatePolicy;
+    }
+
+    /**
+     * Sets the default launch handler.
+     */
+    public static void setDefaultLaunchHandler(LaunchHandler handler) {
+        checkExitClass();
+        JNLPRuntime.handler = handler;
+    }
+
+    /**
+     * Returns the default launch handler.
+     */
+    public static LaunchHandler getDefaultLaunchHandler() {
+        return handler;
+    }
+
+    /**
+     * Sets the default download indicator.
+     *
+     * @throws IllegalStateException if caller is not the exit class
+     */
+    public static void setDefaultDownloadIndicator(DownloadIndicator indicator) {
+        checkExitClass();
+        JNLPRuntime.indicator = indicator;
+    }
+
+    /**
+     * Returns the default download indicator.
+     */
+    public static DownloadIndicator getDefaultDownloadIndicator() {
+        return indicator;
+    }
+
+    /**
+     * Returns the localized resource string identified by the
+     * specified key.  If the message is empty, a null is
+     * returned.
+     */
+    public static String getMessage(String key) {
+        try {
+            String result = resources.getString(key);
+            if (result.length() == 0)
+                return null;
+            else
+                return result;
+        }
+        catch (Exception ex) {
+            if (!key.equals("RNoResource"))
+                return getMessage("RNoResource", new Object[] {key});
+            else
+                return "Missing resource: "+key;
+        }
+    }
+
+    /**
+     * Returns the localized resource string using the specified
+     * arguments.
+     *
+     * @param args the formatting arguments to the resource string
+     */
+    public static String getMessage(String key, Object args[]) {
+        return MessageFormat.format(getMessage(key), args);
+    }
+
+    /**
+     * Throws an exception if called when the runtime is
+     * already initialized.
+     */
+    private static void checkInitialized() {
+        if (initialized)
+            throw new IllegalStateException("JNLPRuntime already initialized.");
+    }
+
+    /**
+     * Throws an exception if called with security enabled but
+     * a caller is not the exit class and the runtime has been
+     * initialized.
+     */
+    private static void checkExitClass() {
+        if (securityEnabled && initialized)
+            if (!security.isExitClass())
+                throw new IllegalStateException("Caller is not the exit class");
+    }
+
+    /**
+     * Check whether the VM is in headless mode.
+     */
+    private static void checkHeadless() {
+        //if (GraphicsEnvironment.isHeadless()) // jdk1.4+ only
+        //    headless = true;
+        try {
+            if ("true".equalsIgnoreCase(System.getProperty("java.awt.headless")))
+                headless = true;
+        }
+        catch (SecurityException ex) {
+        }
+    }
+
+    /**
+     * Load the resources.
+     */
+    private static void loadResources() {
+        try {
+            resources = ResourceBundle.getBundle("net.sourceforge.jnlp.resources.Messages");
+        }
+        catch (Exception ex) {
+            throw new IllegalStateException("Missing resource bundle in netx.jar:net/sourceforge/jnlp/resource/Messages.properties");
+        }
+    }
+
+    /**
+     * Load the window icon.
+     */
+    private static void loadWindowIcon() {
+        if (windowIcon != null)
+            return;
+
+        try {
+            windowIcon = new javax.swing.ImageIcon((new sun.misc.Launcher())
+            		.getClassLoader().getResource("net/sourceforge/jnlp/resources/netx-icon.png")).getImage();
+        }
+        catch (Exception ex) {
+            if (JNLPRuntime.isDebug())
+                ex.printStackTrace();
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,490 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.runtime;
+
+import java.awt.Frame;
+import java.awt.Window;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.lang.ref.WeakReference;
+import java.net.SocketPermission;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+
+import javax.swing.JWindow;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+import net.sourceforge.jnlp.services.ServiceUtil;
+import net.sourceforge.jnlp.util.WeakList;
+import sun.security.util.SecurityConstants;
+
+/**
+ * Security manager for JNLP environment.  This security manager
+ * cannot be replaced as it always denies attempts to replace the
+ * security manager or policy.<p>
+ *
+ * The JNLP security manager tracks windows created by an
+ * application, allowing those windows to be disposed when the
+ * application exits but the JVM does not.  If security is not
+ * enabled then the first application to call System.exit will
+ * halt the JVM.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.17 $
+ */
+class JNLPSecurityManager extends SecurityManager {
+
+    // todo: some apps like JDiskReport can close the VM even when
+    // an exit class is set - fix!
+
+    // todo: create an event dispatch thread for each application,
+    // so that the context classloader doesn't have to be switched
+    // to the foreground application (the currently the approach
+    // since some apps need their classloader as event dispatch
+    // thread's context classloader).
+
+    // todo: use a custom Permission object to identify the current
+    // application in an AccessControlContext by setting a side
+    // effect in its implies method.  Use a custom
+    // AllPermissions-like permission to do this for apps granted
+    // all permissions (but investigate whether this will nuke
+    // the all-permission optimizations in the JRE).
+
+    // todo: does not exit app if close button pressed on JFrame
+    // with CLOSE_ON_EXIT (or whatever) set; if doesn't exit, use an
+    // WindowListener to catch WindowClosing event, then if exit is
+    // called immediately afterwards from AWT thread.
+
+    // todo: deny all permissions to applications that should have
+    // already been 'shut down' by closing their resources and
+    // interrupt the threads if operating in a shared-VM (exit class
+    // set).  Deny will probably will slow checks down a lot though.
+
+    // todo: weak remember last getProperty application and
+    // re-install properties if another application calls, or find
+    // another way for different apps to have different properties
+    // in java.lang.Sytem with the same names.
+
+    private static String R(String key) { return JNLPRuntime.getMessage(key); }
+
+    /** only class that can exit the JVM, if set */
+    private Object exitClass = null;
+
+    /** this exception prevents exiting the JVM */
+    private SecurityException closeAppEx = // making here prevents huge stack traces
+        new SecurityException(JNLPRuntime.getMessage("RShutdown"));
+
+    /** weak list of windows created */
+    private WeakList weakWindows = new WeakList();
+
+    /** weak list of applications corresponding to window list */
+    private WeakList weakApplications = new WeakList();
+
+    /** weak reference to most app who's windows was most recently activated */
+    private WeakReference activeApplication = null;
+
+    /** listener installs the app's classloader on the event dispatch thread */
+    private ContextUpdater contextListener = new ContextUpdater();
+    
+    /** Sets whether or not exit is allowed (in the context of the plugin, this is always false) */
+    private boolean exitAllowed = true;
+
+    private class ContextUpdater extends WindowAdapter implements PrivilegedAction {
+        private ApplicationInstance app = null;
+
+        public void windowActivated(WindowEvent e) {
+            app = getApplication(e.getWindow());
+            AccessController.doPrivileged(this);
+            app = null;
+        }
+
+        public Object run() {
+            if (app != null) {
+                Thread.currentThread().setContextClassLoader(app.getClassLoader());
+                activeApplication = new WeakReference(app);
+            }
+            else
+                Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+
+            return null;
+        }
+
+        public void windowDeactivated(WindowEvent e) {
+            activeApplication = null;
+        }
+        
+        public void windowClosing(WindowEvent e) {
+        	System.err.println("Disposing window");
+        	e.getWindow().dispose();
+        }
+    };
+
+
+    /**
+     * Creates a JNLP SecurityManager.
+     */
+    JNLPSecurityManager() {
+        // this has the side-effect of creating the Swing shared Frame
+        // owner.  Since no application is running at this time, it is
+        // not added to any window list when checkTopLevelWindow is
+        // called for it (and not disposed).
+
+        if (!JNLPRuntime.isHeadless())
+            new JWindow().getOwner();
+    }
+
+    /**
+     * Returns whether the exit class is present on the stack, or
+     * true if no exit class is set.
+     */
+    public boolean isExitClass() {
+        return isExitClass(getClassContext());
+    }
+
+    /**
+     * Returns whether the exit class is present on the stack, or
+     * true if no exit class is set.
+     */
+    private boolean isExitClass(Class stack[]) {
+        if (exitClass == null)
+            return true;
+
+        for (int i=0; i < stack.length; i++)
+            if (stack[i] == exitClass)
+                return true;
+
+        return false;
+    }
+
+    /**
+     * Set the exit class, which is the only class that can exit the
+     * JVM; if not set then any class can exit the JVM.
+     *
+     * @param exitClass the exit class
+     * @throws IllegalStateException if the exit class is already set
+     */
+    public void setExitClass(Class exitClass) throws IllegalStateException {
+        if (this.exitClass != null)
+            throw new IllegalStateException(R("RExitTaken"));
+
+        this.exitClass = exitClass;
+    }
+
+    /**
+     * Return the current Application, or null if none can be
+     * determined.
+     */
+    protected ApplicationInstance getApplication() {
+        return getApplication(getClassContext(), 0);
+    }
+
+    /**
+     * Return the application the opened the specified window (only
+     * call from event dispatch thread).
+     */
+    protected ApplicationInstance getApplication(Window window) {
+        for (int i = weakWindows.size(); i-->0;) {
+            Window w = (Window) weakWindows.get(i);
+            if (w == null) {
+                weakWindows.remove(i);
+                weakApplications.remove(i);
+            }
+
+            if (w == window)
+                return (ApplicationInstance) weakApplications.get(i);
+        }
+
+        return null;
+    }
+
+    /**
+     * Return the current Application, or null.
+     */
+    protected ApplicationInstance getApplication(Class stack[], int maxDepth) {
+    	if (maxDepth <= 0)
+    		maxDepth = stack.length;
+
+    	// this needs to be tightened up
+    	for (int i=0; i < stack.length && i < maxDepth; i++) {
+    		if (stack[i].getClassLoader() instanceof JNLPClassLoader) {
+    			JNLPClassLoader loader = (JNLPClassLoader) stack[i].getClassLoader();
+
+    			if (loader != null && loader.getApplication() != null) {
+    				return loader.getApplication();
+    			}
+    		} 
+    	}
+
+    	return null;
+    }
+
+    /**
+     * Returns the application's thread group if the application can
+     * be determined; otherwise returns super.getThreadGroup()
+     */
+    public ThreadGroup getThreadGroup() {
+        ApplicationInstance app = getApplication();
+        if (app == null)
+            return super.getThreadGroup();
+
+        return app.getThreadGroup();
+    }
+
+    /**
+     * Throws a SecurityException if the permission is denied,
+     * otherwise return normally.  This method always denies
+     * permission to change the security manager or policy.
+     */
+    public void checkPermission(Permission perm) {
+        String name = perm.getName();
+
+        // Enable this manually -- it'll produce too much output for -verbose
+        // otherwise.
+	//	if (true)
+	//  	  System.out.println("Checking permission: " + perm.toString());
+
+        if (!JNLPRuntime.isWebstartApplication() && 
+	      ("setPolicy".equals(name) || "setSecurityManager".equals(name)))
+            throw new SecurityException(R("RCantReplaceSM"));
+
+        try {
+            // deny all permissions to stopped applications
+        	// The call to getApplication() below might not work if an 
+        	// application hasn't been fully initialized yet.
+//            if (JNLPRuntime.isDebug()) {
+//                if (!"getClassLoader".equals(name)) {
+//                    ApplicationInstance app = getApplication();
+//                    if (app != null && !app.isRunning())
+//                        throw new SecurityException(R("RDenyStopped"));
+//                }
+//            }
+        	
+			try {
+				super.checkPermission(perm);
+			} catch (SecurityException se) {
+
+				//This section is a special case for dealing with SocketPermissions.
+				if (JNLPRuntime.isDebug())
+					System.err.println("Requesting permission: " + perm.toString());
+
+				//Change this SocketPermission's action to connect and accept
+				//(and resolve). This is to avoid asking for connect permission 
+				//on every address resolve.
+				Permission tmpPerm;
+				if (perm instanceof SocketPermission) {
+					tmpPerm = new SocketPermission(perm.getName(), 
+							SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION);
+					
+					// before proceeding, check if we are trying to connect to same origin
+					ApplicationInstance app = getApplication();
+					JNLPFile file = app.getJNLPFile();
+
+					String srcHost =  file.getSourceLocation().getAuthority();
+					String destHost = name;
+					
+					// host = abc.xyz.com or abc.xyz.com:<port> 
+					if (destHost.indexOf(':') >= 0)
+						destHost = destHost.substring(0, destHost.indexOf(':'));
+					
+					// host = abc.xyz.com
+					String[] hostComponents = destHost.split("\\.");
+					
+					int length = hostComponents.length;
+					if (length >= 2) {
+						
+						// address is in xxx.xxx.xxx format
+						destHost = hostComponents[length -2] + "." + hostComponents[length -1];
+					
+						// host = xyz.com i.e. origin
+						boolean isDestHostName = false;
+
+						// make sure that it is not an ip address
+						try {
+							Integer.parseInt(hostComponents[length -1]);
+						} catch (NumberFormatException e) {
+							isDestHostName = true;
+						}
+
+						if (isDestHostName) {
+							// okay, destination is hostname. Now figure out if it is a subset of origin
+							if (srcHost.endsWith(destHost)) {
+								addPermission(tmpPerm);
+								return;
+							}
+						}
+					}
+
+				} else
+					tmpPerm = perm;
+				
+				//askPermission will only prompt the user on SocketPermission 
+				//meaning we're denying all other SecurityExceptions that may arise.
+				if (askPermission(tmpPerm)) {
+					addPermission(tmpPerm);
+					//return quietly.
+				} else {
+					throw se;
+				}
+			}
+        }
+        catch (SecurityException ex) {
+            if (JNLPRuntime.isDebug()) {
+                System.out.println("Denying permission: "+perm);
+            }
+            throw ex;
+        }
+    }
+    
+    /**
+     * Asks the user whether or not to grant permission.
+     * @param perm the permission to be granted
+     * @return true if the permission was granted, false otherwise.
+     */
+    private boolean askPermission(Permission perm)	{
+    	
+    	ApplicationInstance app = getApplication();
+    	if (app != null && !app.isSigned()) {
+        	if (perm instanceof SocketPermission 
+        			&& ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.NETWORK, perm.getName())) {
+        		return true;
+        	}
+    	}
+
+    	return false;
+    }
+
+    /**
+     * Adds a permission to the JNLPClassLoader.
+     * @param perm the permission to add to the JNLPClassLoader
+     */
+    private void addPermission(Permission perm)	{
+    	if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
+
+    		JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
+    		cl.addPermission(perm);
+        	if (JNLPRuntime.isDebug()) {
+        		if (cl.getPermissions(null).implies(perm))
+        			System.err.println("Added permission: " + perm.toString());
+        		else
+        			System.err.println("Unable to add permission: " + perm.toString());
+        	}
+    	} else {
+        	if (JNLPRuntime.isDebug())
+        		System.err.println("Unable to add permission: " + perm + ", classloader not JNLP.");
+    	}
+    }
+    
+    /**
+     * Checks whether the window can be displayed without an applet
+     * warning banner, and adds the window to the list of windows to
+     * be disposed when the calling application exits.
+     */
+    public boolean checkTopLevelWindow(Object window) {
+        ApplicationInstance app = getApplication();
+
+        // remember window -> application mapping for focus, close on exit 
+        if (app != null && window instanceof Window) {
+            Window w = (Window) window;
+
+            if (JNLPRuntime.isDebug())
+                System.err.println("SM: app: "+app.getTitle()+" is adding a window: "+window);
+
+            weakWindows.add(window); // for mapping window -> app
+            weakApplications.add(app);
+
+            w.addWindowListener(contextListener); // for dynamic context classloader
+
+            app.addWindow(w);
+        }
+
+        // change coffee cup to netx for default icon
+        if (window instanceof Window)
+            for (Window w = (Window)window; w != null; w = w.getOwner())
+                if (window instanceof Frame)
+                    ((Frame)window).setIconImage(JNLPRuntime.getWindowIcon());
+
+        // todo: set awt.appletWarning to custom message
+        // todo: logo on with glass pane on JFrame/JWindow?
+        
+        return super.checkTopLevelWindow(window);
+    }
+
+    /**
+     * Checks whether the caller can exit the system.  This method
+     * identifies whether the caller is a real call to Runtime.exec
+     * and has special behavior when returning from this method
+     * would exit the JVM and an exit class is set: if the caller is
+     * not the exit class then the calling application will be
+     * stopped and its resources destroyed (when possible), and an
+     * exception will be thrown to prevent the JVM from shutting
+     * down.<p>
+     *
+     * Calls not from Runtime.exit or with no exit class set will
+     * behave normally, and the exit class can always exit the JVM.
+     */
+    public void checkExit(int status) {
+
+    	// applets are not allowed to exit, but the plugin main class (primordial loader) is
+        Class stack[] = getClassContext();
+        if (!exitAllowed) {
+        	for (int i=0; i < stack.length; i++)
+        		if (stack[i].getClassLoader() != null)
+        			throw new AccessControlException("Applets may not call System.exit()");
+        }
+
+    	super.checkExit(status);
+        
+        boolean realCall = (stack[1] == Runtime.class);
+
+        if (isExitClass(stack)) // either exitClass called or no exitClass set
+            return; // to Runtime.exit or fake call to see if app has permission
+
+        // not called from Runtime.exit()
+        if (!realCall) {
+            // apps that can't exit should think they can exit normally
+            super.checkExit(status);
+            return;
+        }
+
+        // but when they really call, stop only the app instead of the JVM
+        ApplicationInstance app = getApplication(stack, 0);
+        if (app == null) {
+            // should check caller to make sure it is JFrame.close or
+            // other known System.exit call
+            if (activeApplication != null)
+                app = (ApplicationInstance) activeApplication.get();
+
+            if (app == null)
+                throw new SecurityException(R("RExitNoApp"));
+        }
+
+        app.destroy();
+
+        throw closeAppEx;
+    }
+
+    protected void disableExit() {
+    	exitAllowed = false;
+    }
+    
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/package.html	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+This package contains the classes that manage the secure runtime
+environment for JNLP apps.
+
+<h2>Package Specification</h2>
+
+<ul>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/AccessWarningPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,212 @@
+/* AccessWarningPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * Provides the look and feel for a SecurityWarningDialog. These dialogs are
+ * used to warn the user when either signed code (with or without signing 
+ * issues) is going to be run, or when service permission (file, clipboard,
+ * printer, etc) is needed with unsigned code.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public class AccessWarningPane extends SecurityDialogUI {
+
+	JCheckBox alwaysAllow;
+	Object[] extras;
+	
+	public AccessWarningPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+	}
+
+	public AccessWarningPane(JComponent x, Object[] extras, CertVerifier certVerifier) {
+		super(x, certVerifier);
+		this.extras = extras;
+	}
+
+	/**
+	 * Creates the actual GUI components, and adds it to <code>optionPane</code>
+	 */
+	protected void installComponents() {
+		SecurityWarningDialog.AccessType type =
+		    ((SecurityWarningDialog)optionPane).getType();
+		JNLPFile file =
+		    ((SecurityWarningDialog)optionPane).getFile();
+
+		String name = "";
+		String publisher = "";
+		String from = "";
+
+		//We don't worry about exceptions when trying to fill in
+		//these strings -- we just want to fill in as many as possible.
+		try {
+			name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : "<no associated certificate>";
+		} catch (Exception e) {
+		}
+
+		try {
+			publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : "<no associated certificate>";
+		} catch (Exception e) {
+		}
+
+		try {
+			from = !file.getInformation().getHomepage().toString().equals("") ? file.getInformation().getHomepage().toString() : file.getSourceLocation().getAuthority();
+		} catch (Exception e) {
+			from = file.getSourceLocation().getAuthority();
+		}
+
+		//Top label
+		String topLabelText = "";
+		switch (type) {
+			case READ_FILE:
+				topLabelText = R("SFileReadAccess");
+				break;
+			case WRITE_FILE:
+				topLabelText = R("SFileWriteAccess");
+				break;
+			case CLIPBOARD_READ:
+				topLabelText = R("SClipboardReadAccess");
+				break;
+			case CLIPBOARD_WRITE:
+				topLabelText = R("SClipboardWriteAccess");
+				break;
+			case PRINTER:
+				topLabelText = R("SPrinterAccess");
+				break;
+			case NETWORK:
+				if (extras != null && extras.length >= 0)
+					topLabelText = R("SNetworkAccess", extras[0]);
+				else
+					topLabelText = R("SNetworkAccess", "(address here)");
+		}
+		
+		ImageIcon icon = new ImageIcon((new sun.misc.Launcher()).getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
+		JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
+		topLabel.setFont(new Font(topLabel.getFont().toString(), 
+			Font.BOLD, 12));
+		JPanel topPanel = new JPanel(new BorderLayout());
+		topPanel.setBackground(Color.WHITE);
+		topPanel.add(topLabel, BorderLayout.CENTER);
+		topPanel.setPreferredSize(new Dimension(400,60));
+		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		//application info
+		JLabel nameLabel = new JLabel("Name:   " + name);
+		nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+		JLabel publisherLabel = new JLabel("Publisher: " + publisher);
+		publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+		JLabel fromLabel = new JLabel("From:   " + from);
+		fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+
+		alwaysAllow = new JCheckBox("Always allow this action");
+		alwaysAllow.setEnabled(false);
+
+		JPanel infoPanel = new JPanel(new GridLayout(4,1));
+		infoPanel.add(nameLabel);
+		infoPanel.add(publisherLabel);
+		infoPanel.add(fromLabel);
+		infoPanel.add(alwaysAllow);
+		infoPanel.setBorder(BorderFactory.createEmptyBorder(25,25,25,25));
+
+		//run and cancel buttons
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		
+		JButton run = new JButton("Allow");
+		JButton cancel = new JButton("Cancel");
+		run.addActionListener(createButtonActionListener(0));
+		run.addActionListener(new CheckBoxListener());
+		cancel.addActionListener(createButtonActionListener(1));
+		initialFocusComponent = cancel;
+		buttonPanel.add(run);
+		buttonPanel.add(cancel);
+		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		//all of the above
+		JPanel main = new JPanel();
+		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
+		main.add(topPanel);
+		main.add(infoPanel);
+		main.add(buttonPanel);
+
+		optionPane.add(main, BorderLayout.CENTER);
+	}
+
+	private static String R(String key) {
+        return JNLPRuntime.getMessage(key);
+    }
+
+    private static String R(String key, Object param) {
+        return JNLPRuntime.getMessage(key, new Object[] {param});
+    }
+
+	protected String htmlWrap (String s) {
+        return "<html>"+s+"</html>";
+    }
+
+	private class CheckBoxListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			if (alwaysAllow != null && alwaysAllow.isSelected()) {
+				// TODO: somehow tell the ApplicationInstance
+				// to stop asking for permission
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/AppletWarningPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,121 @@
+/* AppletWarningPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+
+public class AppletWarningPane extends SecurityDialogUI {
+
+	public AppletWarningPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+	}
+
+	protected void installComponents() {
+
+		//Top label
+		String topLabelText = "While support for verifying signed code" +
+				" has not been implemented yet, some applets will not run " +
+				"properly under the default restricted security level.";
+		String bottomLabelText = "Do you want to run this applet under the " +
+				"restricted security level? (clicking No will run this applet " +
+				"without any security checking, and should only be done if you " +
+				"trust the applet!)";
+		
+		JLabel topLabel = new JLabel(htmlWrap(topLabelText));
+		topLabel.setFont(new Font(topLabel.getFont().toString(), 
+			Font.BOLD, 12));
+		JPanel topPanel = new JPanel(new BorderLayout());
+		topPanel.setBackground(Color.WHITE);
+		topPanel.add(topLabel, BorderLayout.CENTER);
+		topPanel.setPreferredSize(new Dimension(400,80));
+		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		JLabel bottomLabel = new JLabel(htmlWrap(bottomLabelText));
+		JPanel infoPanel = new JPanel(new BorderLayout());
+		infoPanel.add(bottomLabel, BorderLayout.CENTER);
+		infoPanel.setPreferredSize(new Dimension(400,80));
+		infoPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+		
+		//run and cancel buttons
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		
+		JButton yes = new JButton("Yes");
+		JButton no = new JButton("No");
+		JButton cancel = new JButton("Cancel");
+		int buttonWidth = cancel.getMinimumSize().width;
+		int buttonHeight = cancel.getMinimumSize().height;
+		Dimension d = new Dimension(buttonWidth, buttonHeight);
+		yes.setPreferredSize(d);
+		no.setPreferredSize(d);
+		cancel.setPreferredSize(d);
+		yes.addActionListener(createButtonActionListener(0));
+		no.addActionListener(createButtonActionListener(1));
+		cancel.addActionListener(createButtonActionListener(2));
+		initialFocusComponent = cancel;
+		buttonPanel.add(yes);
+		buttonPanel.add(no);
+		buttonPanel.add(cancel);
+		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		//all of the above
+		JPanel main = new JPanel();
+		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
+		main.add(topPanel);
+		main.add(infoPanel);
+		main.add(buttonPanel);
+
+		optionPane.add(main, BorderLayout.CENTER);
+	}
+
+	protected String htmlWrap (String s) {
+	        return "<html>"+s+"</html>";
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/CertVerifier.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,92 @@
+/* CertVerifier.java
+   Copyright (C) 2009 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+
+/**
+ * An interface that provides various details about a certificate 
+ */
+
+public interface CertVerifier {
+
+    /**
+     * Return if the publisher is already trusted
+     */
+    public boolean getAlreadyTrustPublisher();
+
+    /**
+     * Return if the root is in CA certs
+     */
+    public boolean getRootInCacerts();
+
+    /**
+     * Return if there are signing issues with the certificate(s) being veried
+     */
+    public boolean hasSigningIssues();
+
+    /**
+     * Return if there are no signing issues with this cert (!hasSigningIssues())
+     */
+    public boolean noSigningIssues();
+
+    /**
+     * Get the details regarding issue(s) with this certificate
+     */
+    public ArrayList<String> getDetails();
+
+    /**
+     * Return a valid certificate path to this certificate(s) being verified
+     * @return The CertPath
+     */
+    public ArrayList<CertPath> getCerts();
+
+    /** 
+     * Returns the application's publisher's certificate.
+     */
+    public abstract Certificate getPublisher();
+
+    /**
+     * Returns the application's root's certificate. This
+     * may return the same certificate as getPublisher() in
+     * the event that the application is self signed.
+     */
+    public abstract Certificate getRoot();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/CertWarningPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,287 @@
+/* CertWarningPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.PluginBridge;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.tools.KeyTool;
+
+/**
+ * Provides the look and feel for a SecurityWarningDialog. These dialogs are
+ * used to warn the user when either signed code (with or without signing 
+ * issues) is going to be run, or when service permission (file, clipboard,
+ * printer, etc) is needed with unsigned code.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public class CertWarningPane extends SecurityDialogUI {
+
+	JCheckBox alwaysTrust;
+	CertVerifier certVerifier;
+
+	public CertWarningPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+		this.certVerifier = certVerifier;
+	}
+
+	/**
+	 * Creates the actual GUI components, and adds it to <code>optionPane</code>
+	 */
+	protected void installComponents() {
+		SecurityWarningDialog.AccessType type =
+			((SecurityWarningDialog)optionPane).getType();
+		JNLPFile file =
+			((SecurityWarningDialog)optionPane).getFile();
+		Certificate c = ((SecurityWarningDialog)optionPane)
+                                .getJarSigner().getPublisher();
+		
+		String name = "";
+		String publisher = "";
+		String from = "";
+
+		//We don't worry about exceptions when trying to fill in
+		//these strings -- we just want to fill in as many as possible.
+		try {
+			if ((certVerifier instanceof HttpsCertVerifier) && 
+			     (c instanceof X509Certificate))
+			   name = getCN(((X509Certificate)c)
+                                        .getSubjectX500Principal().getName());
+			else if (file instanceof PluginBridge)
+				name = file.getTitle();
+			else
+				name = file.getInformation().getTitle();
+		} catch (Exception e) {
+		}
+
+		try {
+			if (c instanceof X509Certificate) {
+				publisher = getCN(((X509Certificate)c)
+					.getSubjectX500Principal().getName());
+			}
+		} catch (Exception e) {
+		}
+
+		try {
+			if (file instanceof PluginBridge)
+				from = file.getCodeBase().getHost();
+			else
+				from = file.getInformation().getHomepage().toString();
+		} catch (Exception e) {
+		}
+
+		//Top label
+		String topLabelText = "";
+		String propertyName = "";
+		if (certVerifier instanceof HttpsCertVerifier)
+		{
+		  topLabelText = "The website's certificate cannot be verified. " +
+				 "Do you want to continue?";
+		  propertyName = "OptionPane.warningIcon";
+		}
+		else
+		  switch (type) {
+		  case VERIFIED:
+		 	topLabelText = R("SSigVerified");
+			propertyName = "OptionPane.informationIcon";
+			break;
+		  case UNVERIFIED:
+			topLabelText = R("SSigUnverified");
+			propertyName = "OptionPane.warningIcon";
+			break;
+	  	  case SIGNING_ERROR:
+			topLabelText = R("SSignatureError");
+			propertyName = "OptionPane.warningIcon";
+			break;
+		  }
+		ImageIcon icon = new ImageIcon((new sun.misc.Launcher())
+				.getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
+		JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
+		topLabel.setFont(new Font(topLabel.getFont().toString(), 
+				Font.BOLD, 12));
+		JPanel topPanel = new JPanel(new BorderLayout());
+		topPanel.setBackground(Color.WHITE);
+		topPanel.add(topLabel, BorderLayout.CENTER);
+		topPanel.setPreferredSize(new Dimension(400,60));
+		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		//application info
+		JLabel nameLabel = new JLabel("Name:   " + name);
+		nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+		JLabel publisherLabel = new JLabel("Publisher: " + publisher);
+		publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+		JLabel fromLabel = new JLabel("From:   " + from);
+		fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+
+		alwaysTrust = new JCheckBox(
+		"Always trust content from this publisher");
+		alwaysTrust.setEnabled(true);
+
+		JPanel infoPanel = new JPanel(new GridLayout(4,1));
+		infoPanel.add(nameLabel);
+		infoPanel.add(publisherLabel);
+
+		if (!(certVerifier instanceof HttpsCertVerifier))
+		  infoPanel.add(fromLabel);
+
+		infoPanel.add(alwaysTrust);
+		infoPanel.setBorder(BorderFactory.createEmptyBorder(25,25,25,25));
+
+		//run and cancel buttons
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		JButton run = new JButton("Run");
+		JButton cancel = new JButton("Cancel");
+		int buttonWidth = Math.max(run.getMinimumSize().width, 
+			cancel.getMinimumSize().width);
+		int buttonHeight = run.getMinimumSize().height;
+		Dimension d = new Dimension(buttonWidth, buttonHeight);
+		run.setPreferredSize(d);
+		cancel.setPreferredSize(d);
+		run.addActionListener(createButtonActionListener(0));
+		run.addActionListener(new CheckBoxListener());
+		cancel.addActionListener(createButtonActionListener(1));
+		initialFocusComponent = cancel;
+		buttonPanel.add(run);
+		buttonPanel.add(cancel);
+		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+
+		//all of the above
+		JPanel main = new JPanel();
+		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
+		main.add(topPanel);
+		main.add(infoPanel);
+		main.add(buttonPanel);
+
+		JLabel bottomLabel;
+		JButton moreInfo = new JButton("More information...");
+		moreInfo.addActionListener(new MoreInfoButtonListener());
+		
+		if (((SecurityWarningDialog)optionPane).getJarSigner().getRootInCacerts())
+			bottomLabel = new JLabel(htmlWrap(R("STrustedSource")));
+		else
+			bottomLabel = new JLabel(htmlWrap(R("SUntrustedSource")));
+
+		JPanel bottomPanel = new JPanel();
+		bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
+		bottomPanel.add(bottomLabel);
+		bottomPanel.add(moreInfo);
+		bottomPanel.setPreferredSize(new Dimension(500,100));
+		bottomPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+		main.add(bottomPanel);
+
+		optionPane.add(main, BorderLayout.CENTER);
+	}
+
+	private static String R(String key) {
+        return JNLPRuntime.getMessage(key);
+    }
+
+	protected String htmlWrap (String s) {
+        return "<html>"+s+"</html>";
+    }
+
+
+    /**
+     * Extracts the CN field from a Certificate principal string.
+     */
+    private String getCN(String principal) {
+        int start = principal.indexOf("CN=");
+        int end = principal.indexOf(",", start);
+
+        if (end == -1) {
+            end = principal.length();
+        }
+
+        if (start >= 0)
+            return principal.substring(start+3, end);
+        else
+            return principal;
+    }
+
+	private class MoreInfoButtonListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			
+			// TODO: Can we change this to just
+			// optionPane.showMoreInfo(); ?
+			SecurityWarningDialog.showMoreInfoDialog(
+				((SecurityWarningDialog)optionPane).getJarSigner(), 
+				optionPane);
+		}
+	}
+
+	/**
+	 * Updates the user's KeyStore of trusted Certificates.
+	 */
+	private class CheckBoxListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			if (alwaysTrust != null && alwaysTrust.isSelected()) {
+				try {
+					KeyTool kt = new KeyTool();
+					Certificate c =
+						((SecurityWarningDialog)optionPane).getJarSigner().getPublisher();
+					kt.importCert(c);
+				} catch (Exception ex) {
+					//TODO: Let NetX show a dialog here notifying user 
+					//about being unable to add cert to keystore
+				}
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/CertsInfoPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,357 @@
+/* CertsInfoPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.security.cert.CertPath;
+import java.security.cert.X509Certificate;
+import java.security.MessageDigest;
+import java.math.BigInteger;
+import javax.security.auth.x500.X500Principal;
+import sun.security.x509.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeSelectionModel;
+
+import net.sourceforge.jnlp.tools.*;
+
+/**
+ * Provides the UI for the Certificate Info dialog. This dialog displays data from
+ * X509Certificate(s) used in jar signing.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public class CertsInfoPane extends SecurityDialogUI {
+	
+	private ArrayList<CertPath> certs;
+    private JList list;
+	protected JTree tree;
+    private JTable table;
+    private JTextArea output;
+    private ListSelectionModel listSelectionModel;
+    private ListSelectionModel tableSelectionModel;
+    protected String[] certNames;
+    private String[] columnNames = { "Field", "Value" };
+	protected ArrayList<String[][]> certsData;
+
+	public CertsInfoPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+	}
+
+	/**
+	 * Builds the JTree out of CertPaths.
+	 */
+	void buildTree() {
+		certs = ((SecurityWarningDialog)optionPane).getJarSigner().getCerts();
+		//for now, we're only going to display the first signer, even though
+		//jars can be signed by multiple people.
+		CertPath firstPath = certs.get(0);
+		X509Certificate firstCert = 
+			((X509Certificate)firstPath.getCertificates().get(0));
+		String subjectString = 
+			getCN(firstCert.getSubjectX500Principal().getName());
+		String issuerString = 
+			getCN(firstCert.getIssuerX500Principal().getName());
+
+		DefaultMutableTreeNode top =
+			new DefaultMutableTreeNode(subjectString 
+				+ " (" + issuerString + ")");
+
+		//not self signed
+		if (!firstCert.getSubjectDN().equals(firstCert.getIssuerDN()) 
+			&& (firstPath.getCertificates().size() > 1)) {
+			X509Certificate secondCert = 
+				((X509Certificate)firstPath.getCertificates().get(1));
+			subjectString = 
+				getCN(secondCert.getSubjectX500Principal().getName());
+			issuerString = 
+				getCN(secondCert.getIssuerX500Principal().getName());
+			top.add(new DefaultMutableTreeNode(subjectString 
+				+ " (" + issuerString + ")"));
+		}
+
+		tree = new JTree(top);
+		tree.getSelectionModel().setSelectionMode
+		                (TreeSelectionModel.SINGLE_TREE_SELECTION);
+		tree.addTreeSelectionListener(new TreeSelectionHandler());
+	}
+
+	/**
+	 * Fills in certsNames, certsData with data from the certificates.
+	 */
+	protected void populateTable() {
+		certNames = new String[certs.get(0).getCertificates().size()];
+		certsData = new ArrayList<String[][]>();
+
+        for (int i = 0; i < certs.get(0).getCertificates().size(); i++) {
+
+            X509Certificate c = (X509Certificate) certs.get(0).getCertificates().get(i);
+            certsData.add(parseCert(c));
+            certNames[i] = getCN(c.getSubjectX500Principal().getName())
+				+ " (" + getCN(c.getIssuerX500Principal().getName()) + ")";
+        }
+	}
+	
+	protected String[][] parseCert(X509Certificate c) {
+		
+        String version = ""+c.getVersion();
+        String serialNumber = c.getSerialNumber().toString();
+        String signatureAlg = c.getSigAlgName();
+        String issuer = c.getIssuerX500Principal().toString();
+        String validity = new CertificateValidity(c.getNotBefore(),
+                            c.getNotAfter()).toString();
+        String subject = c.getSubjectX500Principal().toString();
+
+        //convert our signature into a nice human-readable form.
+        HexDumpEncoder encoder = new HexDumpEncoder();
+        String signature = encoder.encodeBuffer(c.getSignature());
+
+		String md5Hash = "";
+		String sha1Hash = "";
+		try {
+			MessageDigest digest = MessageDigest.getInstance("MD5");
+			digest.update(c.getEncoded());
+			md5Hash = makeFingerprint(digest.digest());
+
+			digest = MessageDigest.getInstance("SHA-1");
+			digest.update(c.getEncoded());
+			sha1Hash = makeFingerprint(digest.digest());
+		} catch (Exception e) {
+			//fail quietly
+		}
+
+        String[][] cert = { {"Version", version},
+                            {"Serial", serialNumber},
+                            {"Signature Algorithm", signatureAlg},
+                            {"Issuer", issuer},
+                            {"Validity", validity},
+                            {"Subject", subject},
+                            {"Signature", signature},
+							{"MD5 Fingerprint", md5Hash},
+							{"SHA1 Fingerprint", sha1Hash}
+							};
+        return cert;
+	}
+	
+	/**
+	 * Constructs the GUI components of this UI
+	 */
+	protected void installComponents() {
+		buildTree();
+		populateTable();
+		/**
+		//List of Certs
+        list = new JList(certNames);
+		list.setSelectedIndex(0); //assuming there's at least 1 cert
+        listSelectionModel = list.getSelectionModel();
+        listSelectionModel.addListSelectionListener(new ListSelectionHandler());
+        JScrollPane listPane = new JScrollPane(list);
+		*/
+		JScrollPane listPane = new JScrollPane(tree);
+
+        //Table of field-value pairs
+        DefaultTableModel tableModel = new DefaultTableModel(certsData.get(0),
+                                                            columnNames);
+        table = new JTable(tableModel);
+		table.getTableHeader().setReorderingAllowed(false);
+        tableSelectionModel = table.getSelectionModel();
+        tableSelectionModel.addListSelectionListener(new TableSelectionHandler());
+        table.setFillsViewportHeight(true);
+        JScrollPane tablePane = new JScrollPane(table);
+		tablePane.setPreferredSize(new Dimension(500,200));
+
+        //Text area to display the larger values
+        output = new JTextArea();
+        output.setEditable(false);
+        JScrollPane outputPane = new JScrollPane(output,
+            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		outputPane.setPreferredSize(new Dimension(500,200));
+
+		//split pane of the field-value pairs and textbox
+		JSplitPane rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+			tablePane, outputPane);
+		rightSplitPane.setDividerLocation(0.50);
+		rightSplitPane.setResizeWeight(0.50);
+
+		JSplitPane mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+			listPane, rightSplitPane);
+		mainPane.setDividerLocation(0.30);
+		mainPane.setResizeWeight(0.30);
+
+		JPanel buttonPane = new JPanel(new BorderLayout());
+		JButton close = new JButton("Close");
+		JButton copyToClipboard = new JButton("Copy to Clipboard");
+		close.addActionListener(createButtonActionListener(0));
+		copyToClipboard.addActionListener(new CopyToClipboardHandler());
+		buttonPane.add(close, BorderLayout.EAST);
+		buttonPane.add(copyToClipboard, BorderLayout.WEST);
+		buttonPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+
+		optionPane.add(mainPane, BorderLayout.CENTER);
+		optionPane.add(buttonPane, BorderLayout.SOUTH);
+	}
+
+	/**
+	 * Extracts the CN field from a Certificate principal string.
+	 */
+	protected String getCN(String principal) {
+        int start = principal.indexOf("CN=");
+        int end = principal.indexOf(",", start);
+
+		if (end == -1) {
+			end = principal.length();
+		}
+
+        if (start >= 0)
+            return principal.substring(start+3, end);
+        else
+            return principal;
+    }
+
+	/**
+	 * Copies the currently selected certificate to the system Clipboard.
+	 */
+	private class CopyToClipboardHandler implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+			int certIndex = 0;
+			DefaultMutableTreeNode node = (DefaultMutableTreeNode)
+                tree.getLastSelectedPathComponent();
+            if (node == null) return;
+            if (node.isRoot())
+				certIndex = 0;
+            else if (node.isLeaf())
+				certIndex = 1;
+
+			String[][] cert = certsData.get(certIndex);
+			int rows = cert.length;
+			int cols = cert[0].length;
+	
+			String certString = "";
+			for (int i = 0; i < rows; i++) {
+				for (int j = 0; j < cols; j++) {
+					certString += cert[i][j];
+					certString += " ";
+				}
+				certString += "\n";
+			}
+
+			clipboard.setContents(new StringSelection(certString), null);
+		}
+	}
+
+	/**
+	 * Updates the JTable when the JTree selection has changed.
+	 */
+	protected class TreeSelectionHandler implements TreeSelectionListener {
+		public void valueChanged(TreeSelectionEvent e) {
+			DefaultMutableTreeNode node = (DefaultMutableTreeNode)
+				tree.getLastSelectedPathComponent();
+
+			if (node == null) return;
+			if (node.isRoot()) {
+				table.setModel(new DefaultTableModel(certsData.get(0),
+					columnNames));
+			} else if (node.isLeaf()) {
+				table.setModel(new DefaultTableModel(certsData.get(1),
+					columnNames));
+			}
+		}
+	}
+
+	/**
+     * Updates the JTable when the selection on the list has changed.
+     */
+    private class ListSelectionHandler implements ListSelectionListener {
+        public void valueChanged(ListSelectionEvent e) {
+            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+
+            int minIndex = lsm.getMinSelectionIndex();
+            int maxIndex = lsm.getMaxSelectionIndex();
+
+            for (int i = minIndex; i <= maxIndex; i++) {
+                if (lsm.isSelectedIndex(i)) {
+                    table.setModel(new DefaultTableModel(certsData.get(i),
+                                                            columnNames));
+                }
+            }
+        }
+    }
+
+    /**
+     * Updates the JTextArea output when the selection on the JTable
+     * has changed.
+     */
+    private class TableSelectionHandler implements ListSelectionListener {
+        public void valueChanged(ListSelectionEvent e) {
+            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+
+            int minIndex = lsm.getMinSelectionIndex();
+            int maxIndex = lsm.getMaxSelectionIndex();
+
+            for (int i = minIndex; i <= maxIndex; i++) {
+                if (lsm.isSelectedIndex(i)) {
+                    output.setText((String) table.getValueAt(i,1));
+                }
+            }
+        }
+    }
+
+	/**
+	 * Makes a human readable hash fingerprint.
+	 * For example: 11:22:33:44:AA:BB:CC:DD:EE:FF.
+	 */
+	private String makeFingerprint(byte[] hash) {
+		String fingerprint = "";
+		for (int i = 0; i < hash.length; i++) {
+			if (!fingerprint.equals(""))
+				fingerprint += ":";
+			fingerprint += Integer.toHexString(
+				((hash[i] & 0xFF)|0x100)).substring(1,3);
+		}
+		return fingerprint.toUpperCase();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/HttpsCertVerifier.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,175 @@
+/* HttpsCertVerifier.java
+   Copyright (C) 2009 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.tools.KeyTool;
+ 
+public class HttpsCertVerifier implements CertVerifier {
+
+    private VariableX509TrustManager tm;
+    private X509Certificate[] chain;
+    private String authType;
+    private ArrayList<String> details = new ArrayList<String>();
+    
+    public HttpsCertVerifier(VariableX509TrustManager tm, X509Certificate[] chain, String authType) {
+        this.tm = tm;
+        this.chain = chain;
+        this.authType = authType;
+    }
+
+    public boolean getAlreadyTrustPublisher() {
+        try {
+            tm.checkServerTrusted(chain, authType, true);
+            return true;
+        } catch (CertificateException ce) {
+            return false;
+        }
+    }
+
+    public ArrayList<CertPath> getCerts() {
+        
+        ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
+        for (int i=0; i < chain.length; i++)
+            list.add(chain[i]);
+
+        ArrayList<CertPath> certPaths = new ArrayList<CertPath>();
+        
+        try {
+            certPaths.add(CertificateFactory.getInstance("X.509").generateCertPath(list));
+        } catch (CertificateException ce) {
+            ce.printStackTrace();
+            
+            // carry on
+        }
+
+        return certPaths; 
+    }
+
+    public ArrayList<String> getDetails() {
+	boolean hasExpiredCert=false; 
+	boolean hasExpiringCert=false;
+	boolean notYetValidCert=false;
+	boolean isUntrusted=false; 
+
+	if (! getAlreadyTrustPublisher())
+              isUntrusted = true;
+
+	for (int i=0; i < chain.length; i++)
+	{
+	   X509Certificate cert = chain[i];	
+
+           long now = System.currentTimeMillis();
+           long SIX_MONTHS = 180*24*60*60*1000L;
+	   long notAfter = cert.getNotAfter().getTime();
+           if (notAfter < now) {
+             hasExpiredCert = true;
+           } else if (notAfter < now + SIX_MONTHS) {
+             hasExpiringCert = true;
+           }
+	
+	   try {
+	     cert.checkValidity();
+	   } catch (CertificateNotYetValidException cnyve) {
+             notYetValidCert = true;
+	   } catch (CertificateExpiredException cee) {
+	     hasExpiredCert = true;
+	   }
+	}
+
+	if (isUntrusted || hasExpiredCert || hasExpiringCert || notYetValidCert) {
+	      if (isUntrusted)
+	        addToDetails(R("SUntrustedCertificate"));
+              if (hasExpiredCert)
+                addToDetails(R("SHasExpiredCert"));
+              if (hasExpiringCert)
+                addToDetails(R("SHasExpiringCert"));
+              if (notYetValidCert)
+                addToDetails(R("SNotYetValidCert"));
+        }
+	return details;
+    }
+
+    private void addToDetails(String detail) {
+      if (!details.contains(detail))
+        details.add(detail);
+    }
+
+    private static String R(String key) {
+      return JNLPRuntime.getMessage(key);
+    }
+
+    public Certificate getPublisher() {
+      if (chain.length > 0)
+        return (Certificate)chain[0];
+      return null;
+    }
+
+    public Certificate getRoot() {
+      if (chain.length > 0) 
+        return (Certificate)chain[chain.length - 1];
+      return null;
+    }
+
+    public boolean getRootInCacerts() {
+	try {
+	  KeyTool kt = new KeyTool();
+          return kt.checkCacertsForCertificate(getRoot());
+        } catch (Exception e) {
+	}
+	return false;
+    }
+
+    public boolean hasSigningIssues() {
+        return false;
+    }
+
+    public boolean noSigningIssues() {
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,127 @@
+/* MoreInfoPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * Provides the UI for the More Info dialog. This dialog shows details about an
+ * application's signing status.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public class MoreInfoPane extends SecurityDialogUI {
+
+	public MoreInfoPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+	}
+
+	/**
+	 * Constructs the GUI components of this UI
+	 */
+	protected void installComponents() {
+		ArrayList<String> details = certVerifier.getDetails();
+
+		int numLabels = details.size();
+		JPanel errorPanel = new JPanel(new GridLayout(numLabels,1));
+		errorPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+		errorPanel.setPreferredSize(new Dimension(400, 70*(numLabels)));
+
+		for (int i = 0; i < numLabels; i++) {
+			ImageIcon icon = null;
+			if (details.get(i).equals(R("STrustedCertificate")))
+				icon = new ImageIcon((new sun.misc.Launcher())
+						.getClassLoader().getResource("net/sourceforge/jnlp/resources/info-small.png"));
+			else
+				icon = new ImageIcon((new sun.misc.Launcher())
+						.getClassLoader().getResource("net/sourceforge/jnlp/resources/warning-small.png"));
+
+			errorPanel.add(new JLabel(htmlWrap(details.get(i)), icon, SwingConstants.LEFT));
+		}
+
+		JPanel buttonsPanel = new JPanel(new BorderLayout());
+		JButton certDetails = new JButton("Certificate Details");
+		certDetails.addActionListener(new CertInfoButtonListener());
+		JButton close = new JButton("Close");
+		close.addActionListener(createButtonActionListener(0));
+        buttonsPanel.add(certDetails, BorderLayout.WEST);
+        buttonsPanel.add(close, BorderLayout.EAST);
+		buttonsPanel.setBorder(BorderFactory.createEmptyBorder(15,15,15,15));
+
+        JPanel main = new JPanel(new BorderLayout());
+        main.add(errorPanel, BorderLayout.NORTH);
+        main.add(buttonsPanel, BorderLayout.SOUTH);
+
+        optionPane.add(main);
+	}
+
+    private static String R(String key) {
+        return JNLPRuntime.getMessage(key);
+    }
+    
+	/**
+	 * Needed to get word-wrap working in JLabels.
+	 */
+	private String htmlWrap (String s) {
+        return "<html>"+s+"</html>";
+    }
+
+	private class CertInfoButtonListener implements ActionListener {
+        public void actionPerformed(ActionEvent e) {
+        	//TODO: Change to ((SecurityWarningDialog) optionPane).showCertInfoDialog()
+            SecurityWarningDialog.showCertInfoDialog(
+				((SecurityWarningDialog)optionPane).getJarSigner(),
+				optionPane);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialogUI.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,204 @@
+/* SecurityDialogUI.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.OptionPaneUI;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * Provides a base for JNLP warning dialogs.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public abstract class SecurityDialogUI extends OptionPaneUI {
+
+	/** The JOptionPane that we're providing the L&F for */
+	protected JOptionPane optionPane;
+
+	/** Component to receive focus when messaged with selectInitialValue. */
+	Component initialFocusComponent;
+	
+	CertVerifier certVerifier;
+
+	/** PropertyChangeListener for <code>optionPane</code> */
+	private PropertyChangeListener propertyChangeListener;
+	private Handler handler;
+
+	public SecurityDialogUI(JComponent x, CertVerifier certVerifier){
+		optionPane = (JOptionPane)x;
+		this.certVerifier = certVerifier;
+	}
+
+	/**
+	 * Installs the user interface for the SecurityWarningDialog.
+	 */
+	public void installUI(JComponent c) {
+
+		//Only install the UI when type and file in SecurityWarningDialog
+		//have been set.
+		if (((SecurityWarningDialog)c).isInitialized()) {
+			setSystemLookAndFeel();
+			optionPane = (JOptionPane)c;
+			optionPane.setLayout(new BorderLayout());
+			installComponents();
+			installListeners();
+		}
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	protected void installListeners() {
+		if ((propertyChangeListener = getHandler()) != null)
+			optionPane.addPropertyChangeListener(propertyChangeListener);
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	protected void uninstallComponents() {
+		initialFocusComponent = null;
+		optionPane.removeAll();
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	private Handler getHandler() {
+		if (handler == null)
+			handler = new Handler();
+		return handler;
+	}
+
+	//Inherited from OptionPaneUI
+	//Modified from javax.swing.plaf.basic.BasicOptionPaneUI
+	public void selectInitialValue(JOptionPane op) {
+		if (initialFocusComponent != null)
+			initialFocusComponent.requestFocus();
+
+		if (initialFocusComponent instanceof JButton) {
+			JRootPane root = SwingUtilities.getRootPane(initialFocusComponent);
+			if (root != null)
+				root.setDefaultButton((JButton) initialFocusComponent);
+		}
+	}
+
+	//Inherited from OptionPaneUI
+	public boolean containsCustomComponents(JOptionPane op) {
+		return false;
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	protected ActionListener createButtonActionListener(int buttonIndex) {
+		return new ButtonActionListener(buttonIndex);
+	}
+
+	private static String R(String key) {
+		return JNLPRuntime.getMessage(key);
+	}
+
+	/**
+	 * Needed to get word wrap working in JLabels.
+	 */
+	private String htmlWrap (String s) {
+		return "<html>"+s+"</html>";
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	private class Handler implements PropertyChangeListener {
+		public void propertyChange(PropertyChangeEvent e) {
+			if (e.getSource() == optionPane) {
+				String changeName = e.getPropertyName();
+				if (changeName == JOptionPane.OPTIONS_PROPERTY ||
+				        changeName == JOptionPane.INITIAL_VALUE_PROPERTY ||
+				        changeName == JOptionPane.ICON_PROPERTY ||
+				        changeName == JOptionPane.MESSAGE_TYPE_PROPERTY ||
+				        changeName == JOptionPane.OPTION_TYPE_PROPERTY ||
+				        changeName == JOptionPane.MESSAGE_PROPERTY ||
+				        changeName == JOptionPane.SELECTION_VALUES_PROPERTY ||
+				        changeName == JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY ||
+				        changeName == JOptionPane.WANTS_INPUT_PROPERTY) {
+					uninstallComponents();
+					installComponents();
+					optionPane.validate();
+				} else if (changeName == "componentOrientation") {
+					ComponentOrientation o = (ComponentOrientation)e.getNewValue();
+					JOptionPane op = (JOptionPane)e.getSource();
+					if (o != (ComponentOrientation)e.getOldValue()) {
+						op.applyComponentOrientation(o);
+					}
+				}
+			}
+		}
+	}
+
+	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
+	public class ButtonActionListener implements ActionListener {
+		protected int buttonIndex;
+
+		public ButtonActionListener(int buttonIndex) {
+			this.buttonIndex = buttonIndex;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			if (optionPane != null) {
+				optionPane.setValue(new Integer(buttonIndex));
+			}
+		}
+	}
+
+	private void setSystemLookAndFeel() {
+		try {
+			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+		} catch (Exception e) {
+			//don't worry if we can't.
+		}
+	}
+
+	//this is for the different dialogs to fill in.
+	protected abstract void installComponents();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/SecurityUtil.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,200 @@
+/* SecurityUtil.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.security.KeyStore;
+
+public class SecurityUtil {
+
+	private static String homeDir = null;
+	private static final String certDir = "/.netx/security/";
+	private static final String certFile = "trusted.certs";
+	private static final char[] password = "changeit".toCharArray();
+	
+	public static String getTrustedCertsFilename() throws Exception{
+		
+		homeDir = System.getProperty("user.home");
+		
+		if (homeDir == null) {
+			throw new Exception("Could not access home directory");
+		} else {
+			return homeDir + certDir + certFile;
+		}
+	}
+	
+	public static char[] getTrustedCertsPassword() {
+		return password;
+	}
+	
+	public static String getCN(String principal) {
+        int start = principal.indexOf("CN=");
+        int end = principal.indexOf(",", start);
+
+		if (end == -1) {
+			end = principal.length();
+		}
+
+        if (start >= 0)
+            return principal.substring(start+3, end);
+        else
+            return principal;
+    }
+	
+	/**
+	 * Checks the user's home directory to see if the trusted.certs file exists.
+	 * If it does not exist, it tries to create an empty keystore.
+	 * @return true if the trusted.certs file exists or a new trusted.certs
+	 * was created successfully, otherwise false.
+	 */
+	public static boolean checkTrustedCertsFile() throws Exception {
+		
+		File certFile = new File(getTrustedCertsFilename());
+		
+		//file does not exist
+		if (!certFile.isFile()) {
+			File dir = new File(homeDir+certDir);
+			boolean madeDir = false;
+			if (!dir.isDirectory()) {
+				madeDir = dir.mkdirs();
+			}
+			
+			//made directory, or directory exists
+			if (madeDir || dir.isDirectory()) {
+				KeyStore ks = KeyStore.getInstance("JKS");
+				ks.load(null, password);
+				FileOutputStream fos = new FileOutputStream(certFile);
+				ks.store(fos, password);
+				fos.close();
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			return true;
+		}
+	}
+	
+	/**
+	 * Returns the keystore associated with the user's trusted.certs file,
+	 * or null otherwise.
+	 */
+	public static KeyStore getUserKeyStore() throws Exception {
+		
+		KeyStore ks = null;
+		FileInputStream fis = null;
+		
+		if (checkTrustedCertsFile()) {
+
+			try {
+				File file = new File(getTrustedCertsFilename());
+				if (file.exists()) {
+					fis = new FileInputStream(file);
+					ks = KeyStore.getInstance("JKS");
+					ks.load(fis, password);
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw e;
+			} finally {
+				if (fis != null)
+					fis.close();
+			}
+		}
+		return ks;
+	}
+	
+    /**
+     * Returns the keystore associated with the JDK cacerts file, 
+	 * or null otherwise.
+     */
+    public static KeyStore getCacertsKeyStore() throws Exception {
+
+		KeyStore caks = null;
+		FileInputStream fis = null;
+
+		try {
+        	File file = new File(System.getProperty("java.home") 
+        			+ "/lib/security/cacerts");
+        	if (file.exists()) {
+        		fis = new FileInputStream(file);
+        		caks = KeyStore.getInstance("JKS"); 
+        		caks.load(fis, null);
+        	}
+		} catch (Exception e) {
+			caks = null;
+		} finally {
+			if (fis != null)
+				fis.close();
+		}
+
+		return caks;
+    }
+    
+	/**
+	 * Returns the keystore associated with the system certs file,
+	 * or null otherwise.
+	 */
+	public static KeyStore getSystemCertStore() throws Exception {
+
+		KeyStore caks = null;
+		FileInputStream fis = null;
+
+		try {
+			File file = new File(System.getProperty("javax.net.ssl.trustStore"));
+			String type = System.getProperty("javax.net.ssl.trustStoreType");
+			//String provider = "SUN";
+			char[] password = System.getProperty(
+				"javax.net.ssl.trustStorePassword").toCharArray();
+			if (file.exists()) {
+				fis = new FileInputStream(file);
+				caks = KeyStore.getInstance(type);
+				caks.load(fis, password);
+			}
+		} catch (Exception e) {
+			caks = null;
+		} finally {
+			if (fis != null)
+				fis.close();
+		}
+		
+		return caks;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/SecurityWarningDialog.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,429 @@
+/* SecurityWarningDialog.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import net.sourceforge.jnlp.JNLPFile;
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+import javax.swing.plaf.OptionPaneUI;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
+import java.security.cert.X509Certificate;
+
+/**
+ * Provides methods for showing security warning dialogs
+ * for a wide range of JNLP security issues.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+public class SecurityWarningDialog extends JOptionPane {
+
+	/** Types of dialogs we can create */
+	public static enum DialogType {
+		CERT_WARNING,
+		MORE_INFO,
+		CERT_INFO,
+		SINGLE_CERT_INFO,
+		ACCESS_WARNING,
+		APPLET_WARNING
+	}
+	
+	/** The types of access which may need user permission. */
+	public static enum AccessType {
+        READ_FILE,
+        WRITE_FILE,
+        CLIPBOARD_READ,
+        CLIPBOARD_WRITE,
+        PRINTER,
+        NETWORK,
+        VERIFIED,
+        UNVERIFIED,
+        SIGNING_ERROR
+    }
+
+	/** The type of dialog we want to show */
+	private DialogType dialogType;
+
+	/** The type of access that this dialog is for */
+	private AccessType accessType;
+
+	/** The application file associated with this security warning */
+	private JNLPFile file;
+
+	private CertVerifier certVerifier;
+	
+	private X509Certificate cert;
+	
+	/** An optional String array that's only necessary when a dialog
+	 * label requires some parameters (e.g. showing which address an application
+	 * is trying to connect to).
+	 */ 
+	private Object[] extras;
+	
+	/** Whether or not this object has been fully initialized */
+	private boolean initialized = false;
+
+	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
+			JNLPFile file) {
+		this.dialogType = dialogType;
+		this.accessType = accessType;
+		this.file = file;
+		this.certVerifier = null;
+		initialized = true;
+		updateUI();
+	}
+	
+	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
+			JNLPFile file, CertVerifier jarSigner) {
+		this.dialogType = dialogType;
+		this.accessType = accessType;
+		this.file = file;
+		this.certVerifier = jarSigner;
+		initialized = true;
+		updateUI();
+	}
+	
+	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
+	        CertVerifier certVerifier) {
+	    this.dialogType = dialogType;
+	    this.accessType = accessType;
+	    this.file = null;
+	    this.certVerifier = certVerifier;
+	    initialized = true;
+	    updateUI();
+	}
+
+	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
+			JNLPFile file, Object[] extras) {
+		this.dialogType = dialogType;
+		this.accessType = accessType;
+		this.file = file;
+		this.certVerifier = null;
+		initialized = true;
+		this.extras = extras;
+		updateUI();
+	}
+	
+	//for displaying a single certificate
+	public SecurityWarningDialog(DialogType dialogType, X509Certificate c) {
+		this.dialogType = dialogType;
+		this.accessType = null;
+		this.file = null;
+		this.certVerifier = null;
+		this.cert = c;
+		initialized = true;
+		updateUI();
+	}
+	
+	/**
+	 * Returns if this dialog has been fully initialized yet.
+	 * @return true if this dialog has been initialized, and false otherwise.
+	 */
+	public boolean isInitialized(){
+		return initialized;
+	}
+	
+	/**
+	 * Shows a warning dialog for different types of system access (i.e. file
+	 * open/save, clipboard read/write, printing, etc).
+	 * 
+	 * @param accessType the type of system access requested.
+	 * @param file the jnlp file associated with the requesting application.
+	 * @return true if permission was granted by the user, false otherwise.
+	 */
+	public static boolean showAccessWarningDialog(AccessType accessType, 
+		JNLPFile file) {
+		return showAccessWarningDialog(accessType, file, null);
+	}
+	
+	/**
+	 * Shows a warning dialog for different types of system access (i.e. file
+	 * open/save, clipboard read/write, printing, etc).
+	 * 
+	 * @param accessType the type of system access requested.
+	 * @param file the jnlp file associated with the requesting application.
+	 * @param extras an optional array of Strings (typically) that gets 
+	 * passed to the dialog labels.
+	 * @return true if permission was granted by the user, false otherwise.
+	 */
+	public static boolean showAccessWarningDialog(AccessType accessType, 
+			JNLPFile file, Object[] extras) {
+			SecurityWarningDialog swd = new SecurityWarningDialog(
+					DialogType.ACCESS_WARNING, accessType, file, extras);
+			JDialog dialog = swd.createDialog();
+			swd.selectInitialValue();
+			dialog.setResizable(true);
+			centerDialog(dialog);
+			dialog.setVisible(true);
+			dialog.dispose();
+
+			Object selectedValue = swd.getValue();
+			if (selectedValue == null) {
+				return false;
+			} else if (selectedValue instanceof Integer) {
+				if (((Integer)selectedValue).intValue() == 0)
+					return true;
+				else
+					return false;
+			} else {
+				return false;
+			}
+		}
+	
+	/**
+	 * Shows a security warning dialog according to the specified type of
+	 * access. If <code>type</code> is one of AccessType.VERIFIED or
+	 * AccessType.UNVERIFIED, extra details will be available with regards
+	 * to code signing and signing certificates.
+	 *
+	 * @param accessType the type of warning dialog to show
+	 * @param file the JNLPFile associated with this warning
+	 * @param jarSigner the JarSigner used to verify this application
+	 */
+	public static boolean showCertWarningDialog(AccessType accessType, 
+			JNLPFile file, CertVerifier jarSigner) {
+		SecurityWarningDialog swd = 
+			new SecurityWarningDialog(DialogType.CERT_WARNING, accessType, file,
+			jarSigner);
+		JDialog dialog = swd.createDialog();
+		swd.selectInitialValue();
+		dialog.setResizable(true);
+		centerDialog(dialog);
+		dialog.setVisible(true);
+		dialog.dispose();
+
+		Object selectedValue = swd.getValue();
+		if (selectedValue == null) {
+			return false;
+		} else if (selectedValue instanceof Integer) {
+			if (((Integer)selectedValue).intValue() == 0)
+				return true;
+			else
+				return false;
+		} else {
+			return false;
+		}
+	}
+	
+	/**
+	 * Shows more information regarding jar code signing
+	 *
+	 * @param jarSigner the JarSigner used to verify this application
+	 * @param parent the parent option pane
+	 */
+	public static void showMoreInfoDialog(
+		CertVerifier jarSigner, JOptionPane parent) {
+
+		SecurityWarningDialog swd =
+			new SecurityWarningDialog(DialogType.MORE_INFO, null, null,
+			jarSigner);
+		JDialog dialog = swd.createDialog();
+		dialog.setLocationRelativeTo(parent);
+		swd.selectInitialValue();
+		dialog.setResizable(true);
+		dialog.setVisible(true);
+		dialog.dispose();
+	}
+
+	/**
+	 * Displays CertPath information in a readable table format.
+	 *
+	 * @param certs the certificates used in signing.
+	 */
+	public static void showCertInfoDialog(CertVerifier jarSigner,
+		JOptionPane parent) {
+		SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.CERT_INFO,
+			null, null, jarSigner);
+		JDialog dialog = swd.createDialog();
+		dialog.setLocationRelativeTo(parent);
+		swd.selectInitialValue();
+		dialog.setResizable(true);
+		dialog.setVisible(true);
+		dialog.dispose();
+	}
+
+	/**
+	 * Displays a single certificate's information.
+	 * 
+	 * @param c
+	 * @param optionPane
+	 */
+	public static void showSingleCertInfoDialog(X509Certificate c, 
+			JOptionPane parent) {
+
+		SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.SINGLE_CERT_INFO, c);
+			JDialog dialog = swd.createDialog();
+			dialog.setLocationRelativeTo(parent);
+			swd.selectInitialValue();
+			dialog.setResizable(true);
+			dialog.setVisible(true);
+			dialog.dispose();
+	}
+	
+	public static int showAppletWarning() {
+        	SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.APPLET_WARNING,
+            		null, null, (CertVerifier) null);
+        	JDialog dialog = swd.createDialog();
+		centerDialog(dialog);
+        	swd.selectInitialValue();
+        	dialog.setResizable(true);
+        	dialog.setVisible(true);
+        	dialog.dispose();
+
+		Object selectedValue = swd.getValue();
+
+		//result 0 = Yes, 1 = No, 2 = Cancel
+		if (selectedValue == null) {
+			return 2;
+		} else if (selectedValue instanceof Integer) {
+			return ((Integer)selectedValue).intValue();
+		} else {
+			return 2;
+		}
+	}
+
+	//Modified from javax.swing.JOptionPane
+	private JDialog createDialog() {
+		String dialogTitle = "";
+		if (dialogType == DialogType.CERT_WARNING)
+			dialogTitle = "Warning - Security";
+		else if (dialogType == DialogType.MORE_INFO)
+			dialogTitle = "More Information";
+		else if (dialogType == DialogType.CERT_INFO)
+			dialogTitle = "Details - Certificate";
+		else if (dialogType == DialogType.ACCESS_WARNING)
+			dialogTitle = "Security Warning";
+		else if (dialogType == DialogType.APPLET_WARNING)
+			dialogTitle = "Applet Warning";
+
+		final JDialog dialog = new JDialog((Frame)null, dialogTitle, true);
+		
+		Container contentPane = dialog.getContentPane();
+		contentPane.setLayout(new BorderLayout());
+		contentPane.add(this, BorderLayout.CENTER);
+		dialog.pack();
+
+		WindowAdapter adapter = new WindowAdapter() {
+            private boolean gotFocus = false;
+            public void windowClosing(WindowEvent we) {
+                setValue(null);
+            }
+            public void windowGainedFocus(WindowEvent we) {
+                // Once window gets focus, set initial focus
+                if (!gotFocus) {
+                    selectInitialValue();
+                    gotFocus = true;
+                }
+            }
+        };
+		dialog.addWindowListener(adapter);
+		dialog.addWindowFocusListener(adapter);
+
+		dialog.addComponentListener(new ComponentAdapter() {
+            public void componentShown(ComponentEvent ce) {
+                // reset value to ensure closing works properly
+                setValue(JOptionPane.UNINITIALIZED_VALUE);
+            }
+        });
+
+		addPropertyChangeListener( new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent event) {
+                // Let the defaultCloseOperation handle the closing
+                // if the user closed the window without selecting a button
+                // (newValue = null in that case).  Otherwise, close the dialog.
+                if (dialog.isVisible() && 
+                	event.getSource() == SecurityWarningDialog.this &&
+                	(event.getPropertyName().equals(VALUE_PROPERTY) ||
+                	event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
+                	event.getNewValue() != null &&
+                	event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
+                    dialog.setVisible(false);
+                }
+            }
+        });
+
+		return dialog;
+	}
+
+	public AccessType getType() {
+		return accessType;
+	}
+
+	public JNLPFile getFile() {
+		return file;
+	}
+	
+	public CertVerifier getJarSigner() {
+		return certVerifier;
+	}
+	
+	public X509Certificate getCert() {
+		return cert;
+	}
+
+	/**
+	 * Updates the UI using SecurityWarningOptionPane, instead of the
+	 * basic dialog box.
+	 */
+	public void updateUI() {
+
+		if (dialogType == DialogType.CERT_WARNING)
+			setUI((OptionPaneUI) new CertWarningPane(this, this.certVerifier));
+		else if (dialogType == DialogType.MORE_INFO)
+			setUI((OptionPaneUI) new MoreInfoPane(this, this.certVerifier));
+		else if (dialogType == DialogType.CERT_INFO)
+			setUI((OptionPaneUI) new CertsInfoPane(this, this.certVerifier));
+		else if (dialogType == DialogType.SINGLE_CERT_INFO)
+			setUI((OptionPaneUI) new SingleCertInfoPane(this, this.certVerifier));
+		else if (dialogType == DialogType.ACCESS_WARNING)
+			setUI((OptionPaneUI) new AccessWarningPane(this, extras, this.certVerifier));
+		else if (dialogType == DialogType.APPLET_WARNING)
+			setUI((OptionPaneUI) new AppletWarningPane(this, this.certVerifier));
+	}
+
+	private static void centerDialog(JDialog dialog) {
+		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+		Dimension dialogSize = dialog.getSize();
+
+		dialog.setLocation((screen.width - dialogSize.width)/2,
+			(screen.height - dialogSize.height)/2);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/SingleCertInfoPane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,78 @@
+/* SingleCertInfoPane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import javax.swing.JComponent;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeSelectionModel;
+
+
+public class SingleCertInfoPane extends CertsInfoPane {
+
+	public SingleCertInfoPane(JComponent x, CertVerifier certVerifier) {
+		super(x, certVerifier);
+	}
+	
+	protected void buildTree() {
+		X509Certificate cert = ((SecurityWarningDialog)optionPane).getCert();
+		String subjectString = 
+			getCN(cert.getSubjectX500Principal().getName());
+		String issuerString = 
+			getCN(cert.getIssuerX500Principal().getName());
+
+		DefaultMutableTreeNode top = new DefaultMutableTreeNode(subjectString 
+				+ " (" + issuerString + ")");
+		
+		tree = new JTree(top);
+		tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+		tree.addTreeSelectionListener(new TreeSelectionHandler());
+	}
+	
+	protected void populateTable() {
+		X509Certificate c = ((SecurityWarningDialog)optionPane).getCert();
+		certNames = new String[1];
+		certsData = new ArrayList<String[][]>();
+		certsData.add(parseCert(c));
+		certNames[0] = getCN(c.getSubjectX500Principal().getName())
+		+ " (" + getCN(c.getIssuerX500Principal().getName()) + ")";
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,219 @@
+/* VariableX509TrustManager.java
+   Copyright (C) 2009 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security;
+
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import sun.security.validator.ValidatorException;
+
+/**
+ * This class implements an X509 Trust Manager. The certificates it trusts are 
+ * "variable", in the sense that it can dynamically, and temporarily support 
+ * different certificates that are not in the keystore.  
+ */
+
+public class VariableX509TrustManager implements X509TrustManager {
+
+    KeyStore userKeyStore = null;
+    KeyStore caKeyStore = null;
+    
+    X509TrustManager userTrustManager = null;
+    X509TrustManager caTrustManager = null;
+    
+    ArrayList<Certificate> temporarilyTrusted = new ArrayList();
+    
+    static VariableX509TrustManager instance = null;
+
+    /**
+     * Constructor initializes the system, user and custom stores
+     */
+    public VariableX509TrustManager() {
+
+        try {
+            userKeyStore = SecurityUtil.getUserKeyStore();
+            TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
+            tmFactory.init(userKeyStore);
+            
+            // tm factory initialized, now get the managers so we can assign the X509 one
+            TrustManager[] trustManagers = tmFactory.getTrustManagers();
+            
+            for (int i=0; i < trustManagers.length; i++) {
+                if (trustManagers[i] instanceof X509TrustManager) {
+                    userTrustManager = (X509TrustManager) trustManagers[i];
+                }
+            }
+
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+        try {
+            caKeyStore = SecurityUtil.getCacertsKeyStore();
+            TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
+            tmFactory.init(caKeyStore);
+
+            // tm factory initialized, now get the managers so we can extract the X509 one
+            TrustManager[] trustManagers = tmFactory.getTrustManagers();
+
+            for (int i=0; i < trustManagers.length; i++) {
+                if (trustManagers[i] instanceof X509TrustManager) {
+                    caTrustManager = (X509TrustManager) trustManagers[i];
+                }
+            }
+
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Check if client is trusted (not support for custom here, only system/user)
+     */
+    public void checkClientTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+
+        // First try catrustmanager, then try usertrustmanager
+        try {
+            caTrustManager.checkClientTrusted(chain, authType);
+        } catch (Exception caex) {
+            try {
+                userTrustManager.checkClientTrusted(chain, authType);
+            } catch (Exception userex) {
+                // Do nothing here. This trust manager is intended to be used 
+                // only in the plugin instance vm, which does not act as a 
+                // server
+            }
+        }
+    }
+
+    public void checkServerTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+        checkServerTrusted(chain, authType, false);
+    }
+
+    /**
+     * Check if the server is trusted
+     * 
+     * @param chain The cert chain
+     * @param authType The auth type algorithm
+     * @param checkOnly Whether to "check only" i.e. no user prompt, or to prompt for permission 
+     */
+    public void checkServerTrusted(X509Certificate[] chain, String authType, boolean checkOnly) throws CertificateException {
+        try {
+            checkAllManagers(chain, authType);
+        } catch (CertificateException ce) {
+            
+            if (checkOnly) {
+                throw ce;
+            } else {
+
+                boolean b = askUser(chain,authType);
+            
+                if (b) {
+                    temporarilyTrust(chain[0]);
+                }
+
+                checkAllManagers(chain, authType);
+            }
+        }
+    }
+
+    /**
+     * Check system, user and custom trust manager  
+     */
+    private void checkAllManagers(X509Certificate[] chain, String authType) throws CertificateException {
+        // First try catrustmanager, then try usertrustmanager, and finally, check temp trusted certs
+        try {
+            caTrustManager.checkServerTrusted(chain, authType);
+        } catch (ValidatorException caex) {
+            try {
+                userTrustManager.checkServerTrusted(chain, authType);
+            } catch (ValidatorException uex) {
+                if (!temporarilyTrusted.contains(chain[0]))
+                    throw (CertificateException) uex;
+            }
+        }        
+    }
+
+    public X509Certificate[] getAcceptedIssuers() {
+        // delegate to default
+        return caTrustManager.getAcceptedIssuers();
+    }
+
+    /**
+     * Temporarily trust the given cert (runtime)
+     * 
+     * @param c The certificate to trust
+     */
+    private void temporarilyTrust(Certificate c) {
+        temporarilyTrusted.add(c);
+    }
+    
+    /**
+     * Ask user if the certificate should be trusted 
+     * 
+     * @param chain The certificate chain
+     * @param authType The authentication algorithm
+     * @return user's response
+     */
+    private boolean askUser(X509Certificate[] chain, String authType) {
+    	return SecurityWarningDialog.showCertWarningDialog(SecurityWarningDialog.AccessType.UNVERIFIED, null, new HttpsCertVerifier(this, chain, authType)); 
+    }
+
+    /**
+     * Return an instance of this singleton
+     * 
+     * @return The instance
+     */
+    public static VariableX509TrustManager getInstance() {
+        if (instance == null)
+            instance = new VariableX509TrustManager();
+        
+        return instance;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificatePane.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,350 @@
+/* CertificatePane.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security.viewer;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.UIManager;
+import javax.swing.table.DefaultTableModel;
+
+import net.sourceforge.jnlp.security.CertVerifier;
+import net.sourceforge.jnlp.security.SecurityDialogUI;
+import net.sourceforge.jnlp.security.SecurityUtil;
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+import net.sourceforge.jnlp.tools.KeyTool;
+
+//import java.security.KeyStoreException;
+//import java.security.NoSuchAlgorithmException;
+//import java.security.cert.CertificateException;
+//import java.io.FileNotFoundException;
+//import java.io.IOException;
+
+
+// note: We might want to extend OptionPaneUI instead
+public class CertificatePane extends SecurityDialogUI {
+	
+	/**
+	 * The certificates stored in the user's trusted.certs file.
+	 */
+	private ArrayList<X509Certificate> certs = null;
+	
+	/**
+	 * "Issued To" and "Issued By" string pairs for certs.
+	 */
+	private String[][] issuedToAndBy = null;
+	private final String[] columnNames = { "Issued To", "Issued By" };
+	
+	private JTable table;
+	
+	/**
+	 * The KeyStore associated with the user's trusted.certs file.
+	 */
+	private KeyStore keyStore = null;
+	
+	public CertificatePane(JComponent x) {
+		super(x, null);
+		initializeKeyStore();
+	}
+	
+	/**
+	 * Reads the user's trusted.cacerts keystore.
+	 */
+	private void initializeKeyStore() {
+		try {
+			keyStore = SecurityUtil.getUserKeyStore();
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * Installs the user interface for the SecurityWarningDialog.
+	 */
+	public void installUI(JComponent c) {
+
+		//Only install the UI when type and file in SecurityWarningDialog
+		//have been set.
+		if (((CertificateViewer)c).isInitialized()) {
+			setSystemLookAndFeel();
+			optionPane = (JOptionPane)c;
+			optionPane.setLayout(new BorderLayout());
+			installComponents();
+			installListeners();
+		}
+	}
+
+	private void setSystemLookAndFeel() {
+		try {
+			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+		} catch (Exception e) {
+			//don't worry if we can't.
+		}
+	}
+	
+	//create the GUI here.
+	protected void installComponents() {
+		readKeyStore();
+		
+		JPanel main = new JPanel(new BorderLayout());
+		
+		JPanel tablePanel = new JPanel(new BorderLayout());
+		
+		//Table
+		DefaultTableModel tableModel 
+			= new DefaultTableModel(issuedToAndBy, columnNames);
+		table = new JTable(tableModel);
+		table.getTableHeader().setReorderingAllowed(false);
+		table.setFillsViewportHeight(true);
+		JScrollPane tablePane = new JScrollPane(table);
+		tablePane.setPreferredSize(new Dimension(500,200));
+		tablePane.setSize(new Dimension(500,200));
+		tablePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+		
+		JTabbedPane tabbedPane = new JTabbedPane();
+		tabbedPane.addTab("User", tablePane);
+		JPanel buttonPanel = new JPanel(new FlowLayout());
+
+		String[] buttonNames = {"Import", "Export", "Remove", "Details"};
+		char[] buttonMnemonics = {	KeyEvent.VK_I, 
+									KeyEvent.VK_E, 
+									KeyEvent.VK_M,
+									KeyEvent.VK_D};
+		ActionListener[] listeners = {	new ImportButtonListener(),
+										new ExportButtonListener(),
+										new RemoveButtonListener(),
+										new DetailsButtonListener() };
+		JButton button;
+		
+		//get the max width
+		int maxWidth = 0;
+		for (int i = 0; i < buttonNames.length; i++) {
+			button = new JButton(buttonNames[i]);
+			maxWidth = Math.max(maxWidth, button.getMinimumSize().width);
+		}
+		
+		for (int i = 0; i < buttonNames.length; i++) {
+			button = new JButton(buttonNames[i]);
+			button.setMnemonic(buttonMnemonics[i]);
+			button.addActionListener(listeners[i]);
+			button.setSize(maxWidth, button.getSize().height);
+			buttonPanel.add(button);
+		}
+		
+		tablePanel.add(tabbedPane, BorderLayout.CENTER);
+		tablePanel.add(buttonPanel, BorderLayout.SOUTH);
+		
+		JPanel closePanel = new JPanel(new BorderLayout());
+		closePanel.setBorder(BorderFactory.createEmptyBorder(7,7,7,7));
+		JButton closeButton = new JButton("Close");
+		closeButton.addActionListener(createButtonActionListener(0));
+		closePanel.add(closeButton, BorderLayout.EAST);
+		
+		main.add(tablePanel, BorderLayout.CENTER);
+		main.add(closePanel, BorderLayout.SOUTH);
+		
+		optionPane.add(main);
+
+	}	
+	
+	/**
+	 * Read in the optionPane's keystore to issuedToAndBy.
+	 */
+	private void readKeyStore() {
+		
+		Enumeration<String> aliases = null;
+		certs = new ArrayList<X509Certificate>();
+		try {
+			
+			//Get all of the X509Certificates and put them into an ArrayList
+			aliases = keyStore.aliases();
+			while (aliases.hasMoreElements()) {
+				Certificate c = keyStore.getCertificate(aliases.nextElement());
+				if (c instanceof X509Certificate)
+					certs.add((X509Certificate)c);
+			}
+
+			//get the publisher and root information
+			issuedToAndBy = new String[certs.size()][2];
+			for (int i = 0; i < certs.size(); i++) {
+	            X509Certificate c = certs.get(i);
+				issuedToAndBy[i][0] = 
+					SecurityUtil.getCN(c.getSubjectX500Principal().getName());
+				issuedToAndBy[i][1] = 
+					SecurityUtil.getCN(c.getIssuerX500Principal().getName());
+	        }
+		} catch (Exception e) {
+			//TODO
+		}
+	}
+	
+	/**
+	 * Re-reads the certs file and repopulates the JTable. This is typically
+	 * called after a certificate was deleted from the keystore.
+	 */
+	private void repopulateTable() {
+		initializeKeyStore();
+		readKeyStore();
+		DefaultTableModel tableModel 
+			= new DefaultTableModel(issuedToAndBy, columnNames);
+		
+		table.setModel(tableModel);
+		optionPane.repaint();
+	}
+	
+	private class ImportButtonListener implements ActionListener {
+        public void actionPerformed(ActionEvent e) {
+
+        	JFileChooser chooser = new JFileChooser();
+        	int returnVal = chooser.showOpenDialog(optionPane);
+        	if(returnVal == JFileChooser.APPROVE_OPTION) {
+        		try {
+        			KeyTool kt = new KeyTool();
+        			kt.importCert(chooser.getSelectedFile());
+        			repopulateTable();
+        		} catch (Exception ex) {
+        			// TODO: handle exception
+        			ex.printStackTrace();
+        		}
+        	}
+        }
+    }
+	
+	private class ExportButtonListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			//For now, let's just export in -rfc mode as keytool does.
+			//we'll write to a file the exported certificate.
+
+
+			try {
+				int selectedRow = table.getSelectedRow();
+				if (selectedRow != -1) {
+		        	JFileChooser chooser = new JFileChooser();
+		        	int returnVal = chooser.showOpenDialog(optionPane);
+		        	if(returnVal == JFileChooser.APPROVE_OPTION) {
+		        		String alias = keyStore.getCertificateAlias(certs
+		        				.get(selectedRow));
+		        		if (alias != null) {
+		        			Certificate c = keyStore.getCertificate(alias);
+		        			PrintStream ps = new PrintStream(chooser.getSelectedFile().getAbsolutePath());
+		        			KeyTool.dumpCert(c, ps);
+		        			repopulateTable();
+		        		}
+		        	}
+				}
+			} catch (Exception ex) {
+				// TODO
+				ex.printStackTrace();
+			}
+		}
+	}
+	
+	private class RemoveButtonListener implements ActionListener {
+		
+		/**
+		 * Removes a certificate from the keyStore and writes changes to disk.
+		 */
+        public void actionPerformed(ActionEvent e) {
+        	
+        	try {
+        		int selectedRow = table.getSelectedRow();
+        		
+        		if (selectedRow != -1){
+        			String alias = keyStore.getCertificateAlias(certs.get(selectedRow));
+        			if (alias != null) {
+        				
+        				int i = JOptionPane.showConfirmDialog(optionPane, 
+        						"Are you sure you want to remove the selected certificate?", 
+        						"Confirmation - Remove Certificate?", 
+        						JOptionPane.YES_NO_OPTION);
+        				if (i == 0) {
+        					keyStore.deleteEntry(alias);
+        					FileOutputStream fos = new FileOutputStream(
+        						SecurityUtil.getTrustedCertsFilename());
+        					keyStore.store(fos, SecurityUtil.getTrustedCertsPassword());
+        					fos.close();
+        				}
+        			}
+        			repopulateTable();
+        		}
+        	} catch (Exception ex) {
+        		// TODO
+				ex.printStackTrace();
+        	}
+
+        }
+    }
+	
+	private class DetailsButtonListener implements ActionListener {
+		
+		/**
+		 * Shows the details of a trusted certificate.
+		 */
+        public void actionPerformed(ActionEvent e) {
+        	
+        	int selectedRow = table.getSelectedRow();
+        	if (selectedRow != -1 && selectedRow >= 0) {
+        		X509Certificate c = certs.get(selectedRow);
+        		SecurityWarningDialog.showSingleCertInfoDialog(c, optionPane);
+        	}
+        }
+    }
+	
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,148 @@
+/* CertificateViewer.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.security.viewer;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Toolkit;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.plaf.OptionPaneUI;
+
+public class CertificateViewer extends JOptionPane {
+
+	private boolean initialized = false;
+	
+	public CertificateViewer() throws Exception {
+
+		initialized = true;
+		updateUI();
+	}
+		
+	public boolean isInitialized(){
+		return initialized;
+	}
+	
+	public void updateUI() {
+		setUI((OptionPaneUI) new CertificatePane(this));
+	}
+	
+	private static void centerDialog(JDialog dialog) {
+		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+		Dimension dialogSize = dialog.getSize();
+
+		dialog.setLocation((screen.width - dialogSize.width)/2,
+			(screen.height - dialogSize.height)/2);
+	}
+	
+	//Modified from javax.swing.JOptionPane
+	private JDialog createDialog() {
+		String dialogTitle = "Certificates";
+		final JDialog dialog = new JDialog((Frame)null, dialogTitle, true);
+		
+		Container contentPane = dialog.getContentPane();
+		contentPane.setLayout(new BorderLayout());
+		contentPane.add(this, BorderLayout.CENTER);
+		dialog.pack();
+
+		WindowAdapter adapter = new WindowAdapter() {
+            private boolean gotFocus = false;
+            public void windowClosing(WindowEvent we) {
+                setValue(null);
+            }
+            public void windowGainedFocus(WindowEvent we) {
+                // Once window gets focus, set initial focus
+                if (!gotFocus) {
+                    selectInitialValue();
+                    gotFocus = true;
+                }
+            }
+        };
+		dialog.addWindowListener(adapter);
+		dialog.addWindowFocusListener(adapter);
+
+		dialog.addComponentListener(new ComponentAdapter() {
+            public void componentShown(ComponentEvent ce) {
+                // reset value to ensure closing works properly
+                setValue(JOptionPane.UNINITIALIZED_VALUE);
+            }
+        });
+
+		addPropertyChangeListener( new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent event) {
+                // Let the defaultCloseOperation handle the closing
+                // if the user closed the window without selecting a button
+                // (newValue = null in that case).  Otherwise, close the dialog.
+                if (dialog.isVisible() && 
+                	event.getSource() == CertificateViewer.this &&
+                	(event.getPropertyName().equals(VALUE_PROPERTY) ||
+                	event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
+                	event.getNewValue() != null &&
+                	event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
+                    dialog.setVisible(false);
+                }
+            }
+        });
+
+		return dialog;
+	}
+	
+	public static void showCertificateViewer() throws Exception {
+		CertificateViewer cv = new CertificateViewer();
+		JDialog dialog = cv.createDialog();
+		cv.selectInitialValue();
+		dialog.setResizable(true);
+		centerDialog(dialog);
+		dialog.setVisible(true);
+		dialog.dispose();	
+	}
+	
+	public static void main(String[] args) throws Exception {
+		CertificateViewer.showCertificateViewer();
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,214 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.lang.reflect.*;
+import java.security.*;
+
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+
+/**
+ * Provides static methods to interact useful for using the JNLP
+ * services.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ * @version $Revision: 1.8 $
+ */
+public class ServiceUtil {
+
+    private static String R(String key) {
+        return JNLPRuntime.getMessage(key);
+    }
+
+    /**
+     * Types of system access that may need permissions.
+     */
+    public static enum AccessType {
+        READ_FILE, WRITE_FILE, CLIPBOARD_READ, CLIPBOARD_WRITE, PRINTER
+    }
+
+    /**
+     * Returns the BasicService reference, or null if the service is
+     * unavailable.
+     */
+    public static BasicService getBasicService() {
+        return (BasicService) getService("javax.jnlp.BasicService");
+    }
+
+    /**
+     * Returns the ClipboardService reference, or null if the service is
+     * unavailable.
+     */
+    public static ClipboardService getClipboardService() {
+        return (ClipboardService) getService("javax.jnlp.ClipboardService");
+    }
+
+    /**
+     * Returns the DownloadService reference, or null if the service is
+     * unavailable.
+     */
+    public static DownloadService getDownloadService() {
+        return (DownloadService) getService("javax.jnlp.DownloadService");
+    }
+
+    /**
+     * Returns the ExtensionInstallerService reference, or null if the service is
+     * unavailable.
+     */
+    public static ExtensionInstallerService getExtensionInstallerService() {
+        return (ExtensionInstallerService) getService("javax.jnlp.ExtensionInstallerService");
+    }
+
+    /**
+     * Returns the FileOpenService reference, or null if the service is
+     * unavailable.
+     */
+    public static FileOpenService getFileOpenService() {
+        return (FileOpenService) getService("javax.jnlp.FileOpenService");
+    }
+
+    /**
+     * Returns the FileSaveService reference, or null if the service is
+     * unavailable.
+     */
+    public static FileSaveService getFileSaveService() {
+        return (FileSaveService) getService("javax.jnlp.FileSaveService");
+    }
+
+    /**
+     * Returns the PersistenceService reference, or null if the service is
+     * unavailable.
+     */
+    public static PersistenceService getPersistenceService() {
+        return (PersistenceService) getService("javax.jnlp.PersistenceService");
+    }
+
+    /**
+     * Returns the PrintService reference, or null if the service is
+     * unavailable.
+     */
+    public static PrintService getPrintService() {
+        return (PrintService) getService("javax.jnlp.PrintService");
+    }
+
+    /**
+     * Returns the service, or null instead of an UnavailableServiceException
+     */
+    private static Object getService(String name) {
+        try {
+            return ServiceManager.lookup(name);
+        }
+        catch (UnavailableServiceException ex) {
+            return null;
+        }
+    }
+
+    /**
+     * Creates a Proxy object implementing the specified interface
+     * when makes all calls in the security context of the system
+     * classes (ie, AllPermissions).  This means that the services
+     * must be more than extremely careful in the operations they
+     * perform.
+     */
+    static Object createPrivilegedProxy(Class iface, final Object receiver) {
+        return java.lang.reflect.Proxy.newProxyInstance(XServiceManagerStub.class.getClassLoader(),
+                new Class[] { iface },
+                new PrivilegedHandler(receiver));
+    }
+
+    /**
+     * calls the object's method using privileged access
+     */
+    private static class PrivilegedHandler implements InvocationHandler {
+        private final Object receiver;
+
+        PrivilegedHandler(Object receiver) {
+            this.receiver = receiver;
+        }
+
+        public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("call privileged method: "+method.getName());
+                if (args != null)
+                    for (int i=0; i < args.length; i++)
+                        System.err.println("           arg: "+args[i]);
+            }
+
+            PrivilegedExceptionAction invoker = new PrivilegedExceptionAction() {
+                public Object run() throws Exception {
+                    return method.invoke(receiver, args);
+                }
+            };
+
+            Object result = AccessController.doPrivileged(invoker);
+
+            if (JNLPRuntime.isDebug())
+                System.err.println("        result: "+result);
+
+            return result;
+        }
+    };
+
+    /**
+     * Returns whether the app requesting a service is signed. If the app is
+     * unsigned, the user is prompted with a dialog asking if the action
+     * should be allowed.
+     * @param type the type of access being requested
+     * @param extras extra Strings (usually) that are passed to the dialog for
+     * message formatting.
+     * @return true if the access was granted, false otherwise.
+     */
+    public static boolean checkAccess(SecurityWarningDialog.AccessType type,
+    		Object... extras) {
+
+        ApplicationInstance app = JNLPRuntime.getApplication();
+        if (app != null) {
+            if (!app.isSigned()) {
+            	final SecurityWarningDialog.AccessType tmpType = type;
+            	final Object[] tmpExtras = extras;
+            	final ApplicationInstance tmpApp = app;
+            	
+            	//We need to do this to allow proper icon loading for unsigned
+            	//applets, otherwise permissions won't be granted to load icons
+            	//from resources.jar.
+            	Object o = AccessController.doPrivileged(new PrivilegedAction() {
+                    public Object run() {
+                    	boolean b = SecurityWarningDialog.showAccessWarningDialog(tmpType,
+                                tmpApp.getJNLPFile(), tmpExtras);
+                    	return (Object) new Boolean(b);
+                    }
+                });
+            	
+            	return ((Boolean)o).booleanValue();
+                 
+            } else if (app.isSigned()) {
+
+                //just return true here regardless if the app
+                //has signing issues -- at this point the user would've
+                //already decided to run the app anyways.
+                return true;
+            }
+        }
+        return false; //deny
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XBasicService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,174 @@
+// Copyright (C) 2001 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import javax.jnlp.*;
+import javax.swing.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.util.*;
+
+/**
+ * The BasicService JNLP service.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.10 $ 
+ */
+class XBasicService implements BasicService {
+
+    /** command used to exec the native browser */
+    private String command = null;
+
+    /** whether the command was loaded / prompted for */
+    private boolean initialized = false;
+
+
+    protected XBasicService() {
+    }
+
+    /**
+     * Returns the codebase of the application, applet, or
+     * installer.  If the codebase was not specified in the JNLP
+     * element then the main JAR's location is returned.  If no main
+     * JAR was specified then the location of the JAR containing the
+     * main class is returned.
+     */
+    public URL getCodeBase() {
+        ApplicationInstance app = JNLPRuntime.getApplication();
+
+        if (app != null) {
+            JNLPFile file = app.getJNLPFile();
+
+            // return the codebase.
+            if (file.getCodeBase() != null)
+                return file.getCodeBase();
+
+            // else return the main JAR's URL.
+            JARDesc mainJar = file.getResources().getMainJAR();
+            if (mainJar != null)
+                return mainJar.getLocation();
+
+            // else find JAR where main class was defined.
+            //
+            // JNLPFile file = app.getJNLPFile();
+            // String mainClass = file.getLaunchInfo().getMainClass()+".class";
+            // URL jarUrl = app.getClassLoader().getResource(mainClass);
+            // go through list of JARDesc to find one matching jarUrl
+        }
+
+        return null;
+    }
+
+    /**
+     * Return true if the Environment is Offline
+     */
+    public boolean isOffline() {
+        return false;
+    }
+
+    /**
+     * Return true if a Web Browser is Supported
+     */
+    public boolean isWebBrowserSupported() {
+        initialize();
+
+        return command != null;
+    }
+
+    /**
+     * Show a document.
+     *
+     * @return whether the document was opened 
+     */
+    public boolean showDocument(URL url)  {
+        initialize();
+
+        if (url.toString().endsWith(".jnlp")) {
+            try {
+                new Launcher().launchExternal(url);
+                return true;
+            }
+            catch (Exception ex) {
+                return false;
+            }
+        }
+
+        if (command != null) {
+            try {
+                // this is bogus because the command may require options;
+                // should use a StreamTokenizer or similar to get tokens
+                // outside of quotes.
+                Runtime.getRuntime().exec(command + url.toString());
+                //Runtime.getRuntime().exec(new String[]{command,url.toString()});
+
+                return true;
+            }
+            catch(IOException ex){
+                if (JNLPRuntime.isDebug())
+                    ex.printStackTrace();
+            }
+        }
+
+        return false;
+    }
+
+    private void initialize() {
+        if (initialized)
+            return;
+        initialized = true;
+
+        if(isWindows()) {
+            command = "rundll32 url.dll,FileProtocolHandler ";
+        }
+        else {
+            PropertiesFile props = JNLPRuntime.getProperties();
+            command = props.getProperty("browser.command");
+
+            if(command == null) { // prompt & store
+                command = promptForCommand(null);
+
+                if(command != null) {
+                    props.setProperty("browser.command", command);
+                    props.store();
+                }
+            }
+        }
+    }
+
+    private boolean isWindows() {
+        String os = System.getProperty("os.name");
+        if(os != null && os.startsWith("Windows"))
+            return true;
+        else
+            return false;
+    }
+
+    private String promptForCommand(String cmd) {
+        return JOptionPane.showInputDialog(new JPanel(),
+                                           "Browser Location:",
+                                           "Specify Browser Location",
+                                           JOptionPane.PLAIN_MESSAGE 
+                                          );
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XClipboardService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,81 @@
+/* XClipboardService.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.services;
+
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+
+import java.awt.datatransfer.Transferable;
+import java.awt.Toolkit;
+
+/**
+ * The ClipboardService JNLP service.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+class XClipboardService implements ClipboardService {
+
+	protected XClipboardService() {
+	}
+
+	/**
+	 * Returns the contents of the system clipboard.
+	 */
+	public java.awt.datatransfer.Transferable getContents(){
+
+		if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_READ)) {
+			Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
+			return (Transferable) ServiceUtil.createPrivilegedProxy(
+				Transferable.class, t);
+		} else {
+			return null;
+		}
+	}
+
+	/**
+	 * Sets the contents of the system clipboard.
+	 */
+	public void setContents(java.awt.datatransfer.Transferable contents) {
+		if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_WRITE)) {
+			Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
+				contents, null);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XDownloadService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,181 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+
+/**
+ * The DownloadService JNLP service.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $ 
+ */
+class XDownloadService implements DownloadService {
+
+    protected XDownloadService() {
+    }
+
+    // comments copied from DownloadService interface
+
+    /** 
+     * Returns a listener that will automatically display download
+     * progress to the user.
+     */
+    public DownloadServiceListener getDefaultProgressWindow() {
+        return null;
+    }
+
+    /** 
+     * Returns whether the part in an extension (specified by the
+     * url and version) is cached locally.
+     */
+    public boolean isExtensionPartCached(URL ref, String version, String part) {
+        return true;
+    }
+
+    /** 
+     * Returns whether the parts in an extension (specified by the
+     * url and version) are cached locally.
+     */
+    public boolean isExtensionPartCached(URL ref, String version, String[] parts) {
+        return true;
+    }
+
+    /** 
+     * Returns whether the part of the calling application is cached
+     * locally.  If called by code specified by an extension
+     * descriptor, the specified part refers to the extension not
+     * the application.
+     */
+    public boolean isPartCached(String part) {
+        return true;
+    }
+
+    /** 
+     * Returns whether all of the parts of the calling application
+     * are cached locally.  If called by code in an extension, the
+     * part refers the the part of the extension not the
+     * application.
+     */
+    public boolean isPartCached(String[] parts) {
+        return true;
+    }
+
+    /** 
+     * Returns whether the resource is cached locally.  This method
+     * only returns true if the resource is specified by the calling
+     * application or extension.
+     */ 
+    public boolean isResourceCached(URL ref, String version) {
+        return true;
+    }
+
+    /** 
+     * Downloads the parts of an extension.
+     *
+     * @throws IOException
+     */ 
+    public void loadExtensionPart(URL ref, String version, String[] parts, DownloadServiceListener progress) throws IOException {
+    }
+
+    /** 
+     * Downloads a part of an extension.
+     *
+     * @throws IOException
+     */ 
+    public void loadExtensionPart(URL ref, String version, String part, DownloadServiceListener progress) throws IOException {
+    }
+
+    /** 
+     * Downloads the parts.
+     *
+     * @throws IOException
+     */ 
+    public void loadPart(String[] parts, DownloadServiceListener progress) throws IOException {
+    }
+
+    /** 
+     * Downloads the part.
+     *
+     * @throws IOException
+     */ 
+    public void loadPart(String part, DownloadServiceListener progress) throws IOException {
+    }
+
+    /** 
+     * Downloads a resource.
+     *
+     * @throws IOException
+     */ 
+    public void loadResource(URL ref, String version, DownloadServiceListener progress) throws IOException {
+    }
+
+    /** 
+     * Notify the system that an extension's part is no longer
+     * important to cache.
+     *
+     * @throws IOException
+     */ 
+    public void removeExtensionPart(URL ref, String version, String part) throws IOException {
+    }
+
+    /** 
+     * Notify the system that an extension's parts are no longer
+     * important to cache.
+     *
+     * @throws IOException
+     */ 
+    public void removeExtensionPart(URL ref, String version, String[] parts) throws IOException {
+    }
+
+    /** 
+     * Notifies the system that a part  is no longer important to
+     * cache.
+     *
+     * @throws IOException
+     */ 
+    public void removePart(String part) throws IOException {
+    }
+
+    /** 
+     * Notifies the system that the parts  is no longer important to
+     * cache.
+     *
+     * @throws IOException
+     */ 
+    public void removePart(String[] parts) throws IOException {
+    }
+
+    /** 
+     * Notifies the system that the resource is no longer important
+     * to cache.
+     *
+     * @throws IOException
+     */
+    public void removeResource(URL ref, String version) throws IOException {
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XExtensionInstallerService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,123 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+
+/**
+ * The ExtensionInstallerService JNLP service.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $ 
+ */
+class XExtensionInstallerService implements ExtensionInstallerService {
+
+    protected XExtensionInstallerService() {
+    }
+
+    /**
+     *
+     */
+    public URL getExtensionLocation() {
+        return null;
+    }
+
+    /**
+     *
+     */
+    public String getExtensionVersion() {
+        return null;
+    }
+
+    /**
+     *
+     */
+    public String getInstalledJRE(java.net.URL url, java.lang.String version) {
+        return null;
+    }
+
+    /**
+     *
+     */
+    public String getInstallPath() {
+        return null;
+    }
+
+    /**
+     *
+     */
+    public void hideProgressBar() {
+    }
+
+    /**
+     *
+     */
+    public void hideStatusWindow() {
+    }
+
+    /**
+     *
+     */
+    public void installFailed() {
+    }
+
+    /**
+     *
+     */
+    public void installSucceeded(boolean needsReboot) {
+    }
+
+    /**
+     *
+     */
+    public void setHeading(java.lang.String heading) {
+    }
+
+    /**
+     *
+     */
+    public void setJREInfo(java.lang.String platformVersion, java.lang.String jrePath) {
+    }
+
+    /**
+     *
+     */
+    public void setNativeLibraryInfo(java.lang.String path) {
+    }
+
+    /**
+     *
+     */
+    public void setStatus(java.lang.String status) {
+    }
+
+    /**
+     *
+     */
+    public void updateProgress(int value) {
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XFileContents.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,123 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * File contents.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $ 
+ */
+class XFileContents implements FileContents {
+
+    /** the file */
+    private File file;
+
+    /**
+     * Create a file contents implementation for the file.
+     */
+    protected XFileContents(File file) {
+        this.file = file;
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public boolean canRead() throws IOException {
+        return file.canRead();
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public boolean canWrite() throws IOException {
+        return file.canWrite();
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public InputStream getInputStream() throws IOException {
+        return new FileInputStream(file);
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public long getLength() throws IOException {
+        return file.length();
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public long getMaxLength() throws IOException {
+        return Long.MAX_VALUE;
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public String getName() throws IOException {
+        return file.getName();
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public OutputStream getOutputStream(boolean overwrite) throws IOException {
+        // file.getPath compatible with pre-1.4 JREs
+        return new FileOutputStream(file.getPath(), !overwrite);
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public JNLPRandomAccessFile getRandomAccessFile(String mode) throws IOException {
+        return new XJNLPRandomAccessFile(file, mode);
+    }
+
+    /**
+     *
+     * @throws IOException if an I/O exception occurs.
+     */
+    public long setMaxLength(long maxlength) throws IOException {
+        return maxlength;
+    }
+
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XFileOpenService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,113 @@
+/* XFileOpenService.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import java.security.*;
+
+/**
+ * The FileOpenService JNLP service.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+class XFileOpenService implements FileOpenService {
+
+    protected XFileOpenService() {
+    }
+
+    /**
+     * Prompts the user to select a single file.
+     */
+    public FileContents openFileDialog (java.lang.String pathHint,
+        java.lang.String[] extensions) throws java.io.IOException {
+
+        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) {
+
+            //open a file dialog here, let the user choose the file.
+            JFileChooser chooser = new JFileChooser();
+            int chosen = chooser.showOpenDialog(null);
+            if (chosen == JFileChooser.APPROVE_OPTION) {
+                return (FileContents) ServiceUtil.createPrivilegedProxy(
+                           FileContents.class,
+                           new XFileContents(chooser.getSelectedFile()));
+            } else {
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Prompts the user to select one or more files.
+     */
+    public FileContents[] openMultiFileDialog (java.lang.String pathHint,
+            java.lang.String[] extensions) throws java.io.IOException {
+
+        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
+            JFileChooser chooser = new JFileChooser();
+            chooser.setMultiSelectionEnabled(true);
+            int chosen = chooser.showOpenDialog(null);
+
+            if (chosen == JFileChooser.APPROVE_OPTION) {
+                File[] files = chooser.getSelectedFiles();
+                int length = files.length;
+                XFileContents[] xfiles = new XFileContents[length];
+                for (int i = 0; i < length; i++)
+                    xfiles[i] = new XFileContents(files[i]);
+                return (FileContents[]) ServiceUtil.createPrivilegedProxy(
+                           FileContents.class, xfiles);
+            } else {
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XFileSaveService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,140 @@
+/* XFileSaveService.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.security.*;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import java.security.*;
+
+/**
+ * The FileSaveService JNLP service.
+ *
+ * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
+ */
+class XFileSaveService implements FileSaveService {
+
+    protected XFileSaveService() {
+    }
+
+    /**
+     * Prompts the user to save a file.
+     */
+    public FileContents saveFileDialog(java.lang.String pathHint,
+        java.lang.String[] extensions, java.io.InputStream stream,
+        java.lang.String name) throws java.io.IOException {
+
+        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
+            JFileChooser chooser = new JFileChooser();
+            int chosen = chooser.showSaveDialog(null);
+
+            if (chosen == JFileChooser.APPROVE_OPTION) {
+                writeToFile(stream, chooser.getSelectedFile());
+                return (FileContents) ServiceUtil.createPrivilegedProxy(
+                           FileContents.class,
+                           new XFileContents(chooser.getSelectedFile()));
+            } else {
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Prompts the user to save a file, with an optional pre-set filename.
+     */
+    public FileContents saveAsFileDialog(java.lang.String pathHint,
+        java.lang.String[] extensions, FileContents contents) throws java.io.IOException {
+
+        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
+            JFileChooser chooser = new JFileChooser();
+            chooser.setSelectedFile(new File(contents.getName()));
+            int chosen = chooser.showSaveDialog(null);
+
+            if (chosen == JFileChooser.APPROVE_OPTION) {
+                writeToFile(contents.getInputStream(),
+                            chooser.getSelectedFile());
+
+                return (FileContents) ServiceUtil.createPrivilegedProxy(
+                           FileContents.class,
+                           new XFileContents(chooser.getSelectedFile()));
+            } else {
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Writes actual file to disk.
+     */
+    private void writeToFile(InputStream stream, File file) throws IOException {
+        if (!file.createNewFile()) { //file exists
+            boolean replace = (JOptionPane.showConfirmDialog(null, 
+				file.getAbsolutePath() + " already exists.\n"
+                +"Do you want to replace it?", 
+				"Warning - File Exists", JOptionPane.YES_NO_OPTION) == 0);
+            if (!replace)
+                return;
+        } else {
+            file.createNewFile();
+        }
+
+        if (file.canWrite()) {
+            FileOutputStream out = new FileOutputStream(file);
+            byte[] b = new byte[256];
+            int read = 0;
+            while ((read = stream.read(b)) > 0)
+                out.write(b, 0, read);
+            out.flush();
+            out.close();
+        } else {
+            throw new IOException("Unable to open file for writing");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,208 @@
+/* XJNLPRandomAccessFile.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+package net.sourceforge.jnlp.services;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import javax.jnlp.JNLPRandomAccessFile;
+
+public class XJNLPRandomAccessFile implements JNLPRandomAccessFile {
+
+	private RandomAccessFile raf;
+	
+	public XJNLPRandomAccessFile(File file, String mode) {
+		try {
+			raf = new RandomAccessFile(file, mode);
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+	
+	public void close() throws IOException {
+		raf.close();
+	}
+
+	public long getFilePointer() throws IOException {
+		return raf.getFilePointer();
+	}
+
+	public long length() throws IOException {
+		return raf.length();
+	}
+
+	public int read() throws IOException {
+		return raf.read();
+	}
+
+	public int read(byte[] b, int off, int len) throws IOException {
+		return raf.read(b, off, len);
+	}
+
+	public int read(byte[] b) throws IOException {
+		return raf.read(b);
+	}
+
+	public boolean readBoolean() throws IOException {
+		return raf.readBoolean();
+	}
+
+	public byte readByte() throws IOException {
+		return raf.readByte();
+	}
+
+	public char readChar() throws IOException {
+		return raf.readChar();
+	}
+
+	public double readDouble() throws IOException {
+		return raf.readDouble();
+	}
+
+	public float readFloat() throws IOException {
+		return raf.readFloat();
+	}
+
+	public void readFully(byte[] b) throws IOException {
+		raf.readFully(b);
+	}
+
+	public void readFully(byte[] b, int off, int len) throws IOException {
+		raf.readFully(b, off, len);
+	}
+
+	public int readInt() throws IOException {
+		return raf.readInt();
+	}
+
+	public String readLine() throws IOException {
+		return raf.readLine();
+	}
+
+	public long readLong() throws IOException {
+		return raf.readLong();
+	}
+
+	public short readShort() throws IOException {
+		return raf.readShort();
+	}
+
+	public String readUTF() throws IOException {
+		return raf.readUTF();
+	}
+
+	public int readUnsignedByte() throws IOException {
+		return raf.readUnsignedByte();
+	}
+
+	public int readUnsignedShort() throws IOException {
+		return raf.readUnsignedShort();
+	}
+
+	public void seek(long pos) throws IOException {
+		raf.seek(pos);
+	}
+
+	public void setLength(long newLength) throws IOException {
+		raf.setLength(newLength);
+	}
+
+	public int skipBytes(int n) throws IOException {
+		return raf.skipBytes(n);
+	}
+
+	public void write(int b) throws IOException {
+		raf.write(b);
+
+	}
+
+	public void write(byte[] b) throws IOException {
+		raf.write(b);
+	}
+
+	public void write(byte[] b, int off, int len) throws IOException {
+		raf.write(b, off, len);
+	}
+
+	public void writeBoolean(boolean v) throws IOException {
+		raf.writeBoolean(v);
+	}
+
+	public void writeByte(int v) throws IOException {
+		raf.writeByte(v);
+	}
+
+	public void writeBytes(String s) throws IOException {
+		raf.writeBytes(s);
+	}
+
+	public void writeChar(int v) throws IOException {
+		raf.writeChar(v);
+	}
+
+	public void writeChars(String s) throws IOException {
+		raf.writeChars(s);
+	}
+
+	public void writeDouble(double v) throws IOException {
+		raf.writeDouble(v);
+	}
+
+	public void writeFloat(float v) throws IOException {
+		raf.writeFloat(v);
+	}
+
+	public void writeInt(int v) throws IOException {
+		raf.writeInt(v);
+	}
+
+	public void writeLong(long v) throws IOException {
+		raf.writeLong(v);
+	}
+
+	public void writeShort(int v) throws IOException {
+		raf.writeShort(v);
+	}
+
+	public void writeUTF(String str) throws IOException {
+		raf.writeUTF(str);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XPersistenceService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,179 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.runtime.*;
+
+/**
+ * The BasicService JNLP service.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.7 $ 
+ */
+class XPersistenceService implements PersistenceService {
+
+    // todo: recheck delete, etc to make sure security is tight
+
+    protected XPersistenceService() {
+    }
+
+    /**
+     * Checks whether the application has access to URL area
+     * requested.  If the method returns normally then the specified
+     * location can be accessed by the current application.
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    protected void checkLocation(URL location) throws MalformedURLException {
+        ApplicationInstance app = JNLPRuntime.getApplication();
+        if (app == null)
+            throw new MalformedURLException("Cannot determine the current application.");
+
+        URL source = app.getJNLPFile().getCodeBase();
+
+        if (!source.getHost().equalsIgnoreCase(location.getHost()))
+            throw new MalformedURLException("Cannot access data from a different host.");
+
+        // test for above codebase, not perfect but works for now
+
+        String requestPath = location.getFile();
+        if (-1 != requestPath.lastIndexOf("/"))
+            requestPath = requestPath.substring(0, requestPath.lastIndexOf("/"));
+        else
+            requestPath = "";
+
+        if (JNLPRuntime.isDebug()) {
+            System.out.println("codebase path: "+source.getFile());
+            System.out.println("request path: "+requestPath);
+        }
+
+        if (!source.getFile().startsWith(requestPath))
+            throw new MalformedURLException("Cannot access data below source URL path.");
+    }
+
+    /**
+     * Converts a URL into a file in the persistence store.
+     *
+     * @return the file
+     */
+    protected File toCacheFile(URL location) throws MalformedURLException {
+        return CacheUtil.urlToPath(location, "pcache");
+    }
+
+    /**
+     *
+     * @return the maximum size of storage that got granted, in bytes
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public long create(URL location, long maxsize) throws MalformedURLException, IOException {
+        checkLocation(location);
+
+        File file = toCacheFile(location);
+        file.getParentFile().mkdirs();
+
+        if (!file.createNewFile())
+            throw new IOException("File already exists.");
+
+        return maxsize;
+    }
+
+    /**
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public void delete(URL location) throws MalformedURLException, IOException {
+        checkLocation(location);
+
+        toCacheFile(location).delete();
+    }
+
+    /**
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public FileContents get(URL location) throws MalformedURLException, IOException, FileNotFoundException {
+        checkLocation(location);
+
+        File file = toCacheFile(location);
+        if (!file.exists())
+            throw new FileNotFoundException("Persistence store for "
+              + location.toString() + " is not found.");
+        file.getParentFile().mkdirs();
+
+        return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class, new XFileContents(file));
+    }
+
+    /**
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public String[] getNames(URL location) throws MalformedURLException, IOException {
+        checkLocation(location);
+
+
+        File file = toCacheFile(location);
+        if (!file.isDirectory())
+            return new String[0];
+
+        List result = new ArrayList();
+
+        // check whether this is right: only add files and not directories.
+        File entries[] = file.listFiles();
+        for (int i=0; i < entries.length; i++)
+            if (entries[i].isFile())
+                result.add(entries[i].getName());
+
+        return (String[]) result.toArray(new String[result.size()]);
+    }
+
+    /**
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public int getTag(URL location) throws MalformedURLException, IOException {
+        checkLocation(location);
+
+        // todo: actually implement tags
+
+        if (toCacheFile(location).exists())
+            return PersistenceService.CACHED;
+
+        return PersistenceService.CACHED;
+    }
+
+    /**
+     *
+     * @throws MalformedURLException if the application cannot access the location
+     */
+    public void setTag(URL location, int tag) throws MalformedURLException, IOException {
+        checkLocation(location);
+
+        // todo: actually implement tags
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XPrintService.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,123 @@
+/* XPrintService.java
+   Copyright (C) 2008 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+package net.sourceforge.jnlp.services;
+
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.jnlp.*;
+import javax.swing.JOptionPane;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+public class XPrintService implements PrintService {
+
+	// If pj is null, then we do not have a printer to use.
+	private PrinterJob pj;
+	
+	public XPrintService() {
+		pj = PrinterJob.getPrinterJob();
+	}
+	
+	public PageFormat getDefaultPage() {
+		if (pj != null)
+			return pj.defaultPage();
+		else {
+			showWarning();
+			return new PageFormat(); // might not have default settings.
+		}
+	}
+	
+	public PageFormat showPageFormatDialog(PageFormat page) {
+		if (pj != null)
+			return pj.pageDialog(page);
+		else {
+			showWarning();
+			return page;
+		}
+
+	}
+	
+	public boolean print(Pageable document) {
+		if (pj != null) {
+			pj.setPageable(document);
+			if (pj.printDialog()) {
+				try {
+					pj.print();
+					return true;
+				} catch(PrinterException pe) {
+					System.err.println("Could not print: " + pe);
+					return false;
+				}
+			}
+		} else 
+			showWarning();
+		
+		return false;
+	}
+	
+	public boolean print(Printable painter) {
+		if (pj != null) {
+			pj.setPrintable(painter);
+			if (pj.printDialog()) {
+				try {
+					pj.print();
+					return true;
+				} catch(PrinterException pe) {
+					System.err.println("Could not print: " + pe);
+					return false;
+				}
+				
+			}
+		} else
+			showWarning();
+		
+		return false;
+	}
+	
+	private void showWarning() {
+		JOptionPane.showMessageDialog(null, 
+				"Unable to find a default printer.", 
+				"Warning", 
+				JOptionPane.WARNING_MESSAGE);
+		System.err.println("Unable to print: Unable to find default printer.");
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,104 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.services;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.lang.ref.*;
+import java.lang.reflect.*;
+import java.security.*;
+import javax.jnlp.*;
+
+import net.sourceforge.jnlp.*;
+
+/**
+ * Lookup table for services.
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.6 $ 
+ */
+public class XServiceManagerStub implements ServiceManagerStub {
+
+    // todo: only include ExtensionInstallerService if an installer
+    // is getting the service, otherwise return null.
+
+    // todo: fix services to do their own privileged actions that
+    // run less code in the secure environment (or avoid privileged
+    // actions by giving permission to the code source).
+
+	private static String serviceNames[] = {
+        "javax.jnlp.BasicService", // required
+        "javax.jnlp.DownloadService", // required
+        "javax.jnlp.ExtensionInstallerService", // required
+        "javax.jnlp.PersistenceService",
+        "javax.jnlp.FileOpenService",
+        "javax.jnlp.FileSaveService",
+        "javax.jnlp.ClipboardService",
+        "javax.jnlp.PrintService"
+    };
+
+    private static Object services[] = {
+        ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()),
+        ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()),
+        ServiceUtil.createPrivilegedProxy(ExtensionInstallerService.class, new XExtensionInstallerService()),
+        ServiceUtil.createPrivilegedProxy(PersistenceService.class, new XPersistenceService()),
+        ServiceUtil.createPrivilegedProxy(FileOpenService.class, new XFileOpenService()),
+        ServiceUtil.createPrivilegedProxy(FileSaveService.class, new XFileSaveService()),
+        ServiceUtil.createPrivilegedProxy(ClipboardService.class, new XClipboardService()),
+        ServiceUtil.createPrivilegedProxy(PrintService.class, new XPrintService())
+    };
+
+
+    public XServiceManagerStub() {
+    }
+
+    /**
+     * Returns the service names.
+     */
+    public String[] getServiceNames() {
+        // make sure it is a copy because we might be returning to
+        // code we don't own.
+        String result[] = new String[serviceNames.length];
+        System.arraycopy(serviceNames, 0, result, 0, serviceNames.length);
+
+        return result;
+    }
+
+    /**
+     * Returns the service.
+     *
+     * @throws UnavailableServiceException if service is not available
+     */
+    public Object lookup(String name) throws UnavailableServiceException {
+        // exact match
+        for (int i=0; i < serviceNames.length; i++)
+            if (serviceNames[i].equals(name))
+                return services[i];
+
+        // substring match
+        for (int i=0; i < serviceNames.length; i++)
+            if (-1 != serviceNames[i].indexOf(name))
+                return services[i];
+
+        throw new UnavailableServiceException(""+name);
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/package.html	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body bgcolor="white">
+
+This package contains the classes that implement the standard
+services defined by the JNLP specification.
+
+<h2>Package Specification</h2>
+
+<ul>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
+<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
+</ul>
+
+<!-- Put @see and @since tags down here. -->
+
+</body>
+</html>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/CharacterEncoder.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,354 @@
+/*
+ * Copyright 1995-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.io.OutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+
+/**
+ * This class defines the encoding half of character encoders.
+ * A character encoder is an algorithim for transforming 8 bit binary
+ * data into text (generally 7 bit ASCII or 8 bit ISO-Latin-1 text)
+ * for transmition over text channels such as e-mail and network news.
+ *
+ * The character encoders have been structured around a central theme
+ * that, in general, the encoded text has the form:
+ *
+ * <pre>
+ *      [Buffer Prefix]
+ *      [Line Prefix][encoded data atoms][Line Suffix]
+ *      [Buffer Suffix]
+ * </pre>
+ *
+ * In the CharacterEncoder and CharacterDecoder classes, one complete
+ * chunk of data is referred to as a <i>buffer</i>. Encoded buffers
+ * are all text, and decoded buffers (sometimes just referred to as
+ * buffers) are binary octets.
+ *
+ * To create a custom encoder, you must, at a minimum,  overide three
+ * abstract methods in this class.
+ * <DL>
+ * <DD>bytesPerAtom which tells the encoder how many bytes to
+ * send to encodeAtom
+ * <DD>encodeAtom which encodes the bytes sent to it as text.
+ * <DD>bytesPerLine which tells the encoder the maximum number of
+ * bytes per line.
+ * </DL>
+ *
+ * Several useful encoders have already been written and are
+ * referenced in the See Also list below.
+ *
+ * @author      Chuck McManis
+ * @see         CharacterDecoder;
+ * @see         UCEncoder
+ * @see         UUEncoder
+ * @see         BASE64Encoder
+ */
+public abstract class CharacterEncoder {
+
+    /** Stream that understands "printing" */
+    protected PrintStream pStream;
+
+    /** Return the number of bytes per atom of encoding */
+    abstract protected int bytesPerAtom();
+
+    /** Return the number of bytes that can be encoded per line */
+    abstract protected int bytesPerLine();
+
+    /**
+     * Encode the prefix for the entire buffer. By default is simply
+     * opens the PrintStream for use by the other functions.
+     */
+    protected void encodeBufferPrefix(OutputStream aStream) throws IOException {
+        pStream = new PrintStream(aStream);
+    }
+
+    /**
+     * Encode the suffix for the entire buffer.
+     */
+    protected void encodeBufferSuffix(OutputStream aStream) throws IOException {
+    }
+
+    /**
+     * Encode the prefix that starts every output line.
+     */
+    protected void encodeLinePrefix(OutputStream aStream, int aLength)
+    throws IOException {
+    }
+
+    /**
+     * Encode the suffix that ends every output line. By default
+     * this method just prints a <newline> into the output stream.
+     */
+    protected void encodeLineSuffix(OutputStream aStream) throws IOException {
+        pStream.println();
+    }
+
+    /** Encode one "atom" of information into characters. */
+    abstract protected void encodeAtom(OutputStream aStream, byte someBytes[],
+                int anOffset, int aLength) throws IOException;
+
+    /**
+     * This method works around the bizarre semantics of BufferedInputStream's
+     * read method.
+     */
+    protected int readFully(InputStream in, byte buffer[])
+        throws java.io.IOException {
+        for (int i = 0; i < buffer.length; i++) {
+            int q = in.read();
+            if (q == -1)
+                return i;
+            buffer[i] = (byte)q;
+        }
+        return buffer.length;
+    }
+
+    /**
+     * Encode bytes from the input stream, and write them as text characters
+     * to the output stream. This method will run until it exhausts the
+     * input stream, but does not print the line suffix for a final
+     * line that is shorter than bytesPerLine().
+     */
+    public void encode(InputStream inStream, OutputStream outStream)
+        throws IOException {
+        int     j;
+        int     numBytes;
+        byte    tmpbuffer[] = new byte[bytesPerLine()];
+
+        encodeBufferPrefix(outStream);
+
+        while (true) {
+            numBytes = readFully(inStream, tmpbuffer);
+            if (numBytes == 0) {
+                break;
+            }
+            encodeLinePrefix(outStream, numBytes);
+            for (j = 0; j < numBytes; j += bytesPerAtom()) {
+
+                if ((j + bytesPerAtom()) <= numBytes) {
+                    encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
+                } else {
+                    encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
+                }
+            }
+            if (numBytes < bytesPerLine()) {
+                break;
+            } else {
+                encodeLineSuffix(outStream);
+            }
+        }
+        encodeBufferSuffix(outStream);
+    }
+
+    /**
+     * Encode the buffer in <i>aBuffer</i> and write the encoded
+     * result to the OutputStream <i>aStream</i>.
+     */
+    public void encode(byte aBuffer[], OutputStream aStream)
+    throws IOException {
+        ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
+        encode(inStream, aStream);
+    }
+
+    /**
+     * A 'streamless' version of encode that simply takes a buffer of
+     * bytes and returns a string containing the encoded buffer.
+     */
+    public String encode(byte aBuffer[]) {
+        ByteArrayOutputStream   outStream = new ByteArrayOutputStream();
+        ByteArrayInputStream    inStream = new ByteArrayInputStream(aBuffer);
+        String retVal = null;
+        try {
+            encode(inStream, outStream);
+            // explicit ascii->unicode conversion
+            retVal = outStream.toString("8859_1");
+        } catch (Exception IOException) {
+            // This should never happen.
+            throw new Error("CharacterEncoder.encode internal error");
+        }
+        return (retVal);
+    }
+
+    /**
+     * Return a byte array from the remaining bytes in this ByteBuffer.
+     * <P>
+     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
+     * <P>
+     * To avoid an extra copy, the implementation will attempt to return the
+     * byte array backing the ByteBuffer.  If this is not possible, a
+     * new byte array will be created.
+     */
+    private byte [] getBytes(ByteBuffer bb) {
+        /*
+         * This should never return a BufferOverflowException, as we're
+         * careful to allocate just the right amount.
+         */
+        byte [] buf = null;
+
+        /*
+         * If it has a usable backing byte buffer, use it.  Use only
+         * if the array exactly represents the current ByteBuffer.
+         */
+        if (bb.hasArray()) {
+            byte [] tmp = bb.array();
+            if ((tmp.length == bb.capacity()) &&
+                    (tmp.length == bb.remaining())) {
+                buf = tmp;
+                bb.position(bb.limit());
+            }
+        }
+
+        if (buf == null) {
+            /*
+             * This class doesn't have a concept of encode(buf, len, off),
+             * so if we have a partial buffer, we must reallocate
+             * space.
+             */
+            buf = new byte[bb.remaining()];
+
+            /*
+             * position() automatically updated
+             */
+            bb.get(buf);
+        }
+
+        return buf;
+    }
+
+    /**
+     * Encode the <i>aBuffer</i> ByteBuffer and write the encoded
+     * result to the OutputStream <i>aStream</i>.
+     * <P>
+     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
+     */
+    public void encode(ByteBuffer aBuffer, OutputStream aStream)
+        throws IOException {
+        byte [] buf = getBytes(aBuffer);
+        encode(buf, aStream);
+    }
+
+    /**
+     * A 'streamless' version of encode that simply takes a ByteBuffer
+     * and returns a string containing the encoded buffer.
+     * <P>
+     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
+     */
+    public String encode(ByteBuffer aBuffer) {
+        byte [] buf = getBytes(aBuffer);
+        return encode(buf);
+    }
+
+    /**
+     * Encode bytes from the input stream, and write them as text characters
+     * to the output stream. This method will run until it exhausts the
+     * input stream. It differs from encode in that it will add the
+     * line at the end of a final line that is shorter than bytesPerLine().
+     */
+    public void encodeBuffer(InputStream inStream, OutputStream outStream)
+        throws IOException {
+        int     j;
+        int     numBytes;
+        byte    tmpbuffer[] = new byte[bytesPerLine()];
+
+        encodeBufferPrefix(outStream);
+
+        while (true) {
+            numBytes = readFully(inStream, tmpbuffer);
+            if (numBytes == 0) {
+                break;
+            }
+            encodeLinePrefix(outStream, numBytes);
+            for (j = 0; j < numBytes; j += bytesPerAtom()) {
+                if ((j + bytesPerAtom()) <= numBytes) {
+                    encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
+                } else {
+                    encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
+                }
+            }
+            encodeLineSuffix(outStream);
+            if (numBytes < bytesPerLine()) {
+                break;
+            }
+        }
+        encodeBufferSuffix(outStream);
+    }
+
+    /**
+     * Encode the buffer in <i>aBuffer</i> and write the encoded
+     * result to the OutputStream <i>aStream</i>.
+     */
+    public void encodeBuffer(byte aBuffer[], OutputStream aStream)
+    throws IOException {
+        ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
+        encodeBuffer(inStream, aStream);
+    }
+
+    /**
+     * A 'streamless' version of encode that simply takes a buffer of
+     * bytes and returns a string containing the encoded buffer.
+     */
+    public String encodeBuffer(byte aBuffer[]) {
+        ByteArrayOutputStream   outStream = new ByteArrayOutputStream();
+        ByteArrayInputStream    inStream = new ByteArrayInputStream(aBuffer);
+        try {
+            encodeBuffer(inStream, outStream);
+        } catch (Exception IOException) {
+            // This should never happen.
+            throw new Error("CharacterEncoder.encodeBuffer internal error");
+        }
+        return (outStream.toString());
+    }
+
+    /**
+     * Encode the <i>aBuffer</i> ByteBuffer and write the encoded
+     * result to the OutputStream <i>aStream</i>.
+     * <P>
+     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
+     */
+    public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream)
+        throws IOException {
+        byte [] buf = getBytes(aBuffer);
+        encodeBuffer(buf, aStream);
+    }
+
+    /**
+     * A 'streamless' version of encode that simply takes a ByteBuffer
+     * and returns a string containing the encoded buffer.
+     * <P>
+     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
+     */
+    public String encodeBuffer(ByteBuffer aBuffer) {
+        byte [] buf = getBytes(aBuffer);
+        return encodeBuffer(buf);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/HexDumpEncoder.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,120 @@
+/*
+ * Copyright 1995-1997 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+import java.io.PrintStream;
+import java.io.OutputStream;
+import java.io.IOException;
+
+/**
+ * This class encodes a buffer into the classic: "Hexadecimal Dump" format of
+ * the past. It is useful for analyzing the contents of binary buffers.
+ * The format produced is as follows:
+ * <pre>
+ * xxxx: 00 11 22 33 44 55 66 77   88 99 aa bb cc dd ee ff ................
+ * </pre>
+ * Where xxxx is the offset into the buffer in 16 byte chunks, followed
+ * by ascii coded hexadecimal bytes followed by the ASCII representation of
+ * the bytes or '.' if they are not valid bytes.
+ *
+ * @author      Chuck McManis
+ */
+
+public class HexDumpEncoder extends CharacterEncoder {
+
+    private int offset;
+    private int thisLineLength;
+    private int currentByte;
+    private byte thisLine[] = new byte[16];
+
+    static void hexDigit(PrintStream p, byte x) {
+        char c;
+
+        c = (char) ((x >> 4) & 0xf);
+        if (c > 9)
+            c = (char) ((c-10) + 'A');
+        else
+            c = (char)(c + '0');
+        p.write(c);
+        c = (char) (x & 0xf);
+        if (c > 9)
+            c = (char)((c-10) + 'A');
+        else
+            c = (char)(c + '0');
+        p.write(c);
+    }
+
+    protected int bytesPerAtom() {
+        return (1);
+    }
+
+    protected int bytesPerLine() {
+        return (16);
+    }
+
+    protected void encodeBufferPrefix(OutputStream o) throws IOException {
+        offset = 0;
+        super.encodeBufferPrefix(o);
+    }
+
+    protected void encodeLinePrefix(OutputStream o, int len) throws IOException {
+        hexDigit(pStream, (byte)((offset >>> 8) & 0xff));
+        hexDigit(pStream, (byte)(offset & 0xff));
+        pStream.print(": ");
+        currentByte = 0;
+        thisLineLength = len;
+    }
+
+    protected void encodeAtom(OutputStream o, byte buf[], int off, int len) throws IOException {
+        thisLine[currentByte] = buf[off];
+        hexDigit(pStream, buf[off]);
+        pStream.print(" ");
+        currentByte++;
+        if (currentByte == 8)
+            pStream.print("  ");
+    }
+
+    protected void encodeLineSuffix(OutputStream o) throws IOException {
+        if (thisLineLength < 16) {
+            for (int i = thisLineLength; i < 16; i++) {
+                pStream.print("   ");
+                if (i == 7)
+                    pStream.print("  ");
+            }
+        }
+        pStream.print(" ");
+        for (int i = 0; i < thisLineLength; i++) {
+            if ((thisLine[i] < ' ') || (thisLine[i] > 'z')) {
+                pStream.print(".");
+            } else {
+                pStream.write(thisLine[i]);
+            }
+        }
+        pStream.println();
+        offset += thisLineLength;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/JarRunner.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,15 @@
+package net.sourceforge.jnlp.tools;
+
+import net.sourceforge.jnlp.tools.JarSigner;
+public class JarRunner {
+
+
+	public static void main(String[] args) throws Exception{
+		
+
+		//JarSigner.main(args);
+		JarSigner js = new JarSigner();
+		js.verifyJar(args[0]);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/JarSigner.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,544 @@
+/*
+ * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+import java.util.jar.*;
+import java.text.Collator;
+import java.text.MessageFormat;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.security.cert.CertPath;
+import java.security.*;
+import sun.security.x509.*;
+import sun.security.util.*;
+
+import net.sourceforge.jnlp.*;
+import net.sourceforge.jnlp.cache.*;
+import net.sourceforge.jnlp.runtime.*;
+import net.sourceforge.jnlp.security.*;
+
+/**
+ * <p>The jarsigner utility.
+ *
+ * @author Roland Schemers
+ * @author Jan Luehe
+ */
+
+public class JarSigner implements CertVerifier {
+
+    private static String R(String key) {
+        return JNLPRuntime.getMessage(key);
+    }
+
+    private static final Collator collator = Collator.getInstance();
+    static {
+        // this is for case insensitive string comparisions
+        collator.setStrength(Collator.PRIMARY);
+    }
+
+    private static final String META_INF = "META-INF/";
+
+    // prefix for new signature-related files in META-INF directory
+    private static final String SIG_PREFIX = META_INF + "SIG-";
+
+
+    private static final long SIX_MONTHS = 180*24*60*60*1000L; //milliseconds
+
+    static final String VERSION = "1.0";
+
+    static final int IN_KEYSTORE = 0x01;
+    static final int IN_SCOPE = 0x02;
+
+    // signer's certificate chain (when composing)
+    X509Certificate[] certChain;
+
+    /*
+     * private key
+     */
+    PrivateKey privateKey;
+    KeyStore store;
+
+    IdentityScope scope;
+
+    String keystore; // key store file
+    boolean nullStream = false; // null keystore input stream (NONE)
+    boolean token = false; // token-based keystore
+    String jarfile;  // jar file to sign
+    String alias;    // alias to sign jar with
+    char[] storepass; // keystore password
+    boolean protectedPath; // protected authentication path
+    String storetype; // keystore type
+    String providerName; // provider name
+    Vector<String> providers = null; // list of providers
+    HashMap<String,String> providerArgs = new HashMap<String, String>(); // arguments for provider constructors
+    char[] keypass; // private key password
+    String sigfile; // name of .SF file
+    String sigalg; // name of signature algorithm
+    String digestalg = "SHA1"; // name of digest algorithm
+    String signedjar; // output filename
+    String tsaUrl; // location of the Timestamping Authority
+    String tsaAlias; // alias for the Timestamping Authority's certificate
+    boolean verify = false; // verify the jar
+    boolean verbose = false; // verbose output when signing/verifying
+    boolean showcerts = false; // show certs when verifying
+    boolean debug = false; // debug
+    boolean signManifest = true; // "sign" the whole manifest
+    boolean externalSF = true; // leave the .SF out of the PKCS7 block
+
+    private boolean hasExpiredCert = false;
+    private boolean hasExpiringCert = false;
+    private boolean notYetValidCert = false;
+
+    private boolean badKeyUsage = false;
+    private boolean badExtendedKeyUsage = false;
+    private boolean badNetscapeCertType = false;
+
+    private boolean alreadyTrustPublisher = false;
+    private boolean rootInCacerts = false;
+    
+    /**
+     * The single certPath used in this JarSiging. We're only keeping
+     * track of one here, since in practice there's only one signer
+     * for a JNLP Application.
+     */
+    private CertPath certPath = null;
+    
+    private boolean noSigningIssues = true;
+
+    private boolean anyJarsSigned = false;
+
+    /** all of the jar files that were verified */
+    private ArrayList<String> verifiedJars = null;
+
+    /** all of the jar files that were not verified */
+    private ArrayList<String> unverifiedJars = null;
+
+    /** the certificates used for jar verification */
+    private ArrayList<CertPath> certs = null;
+
+    /** details of this signing */
+    private ArrayList<String> details = new ArrayList<String>();
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getAlreadyTrustPublisher()
+     */
+    public boolean getAlreadyTrustPublisher() {
+    	return alreadyTrustPublisher;
+    }
+    
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getRootInCacerts()
+     */
+    public boolean getRootInCacerts() {
+    	return rootInCacerts;
+    }
+    
+    public CertPath getCertPath() {
+    	return certPath;
+    }
+    
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#hasSigningIssues()
+     */
+    public boolean hasSigningIssues() {
+        return hasExpiredCert || notYetValidCert || badKeyUsage
+               || badExtendedKeyUsage || badNetscapeCertType;
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#noSigningIssues()
+     */
+    public boolean noSigningIssues() {
+        return noSigningIssues;
+    }
+
+    public boolean anyJarsSigned() {
+        return anyJarsSigned;
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getDetails()
+     */
+    public ArrayList<String> getDetails() {
+        return details;
+    }
+
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getCerts()
+     */
+    public ArrayList<CertPath> getCerts() {
+        return certs;
+    }
+
+    public void verifyJars(List<JARDesc> jars, ResourceTracker tracker)
+    throws Exception {
+
+	certs = new ArrayList<CertPath>();
+        for (int i = 0; i < jars.size(); i++) {
+
+            JARDesc jar = (JARDesc) jars.get(i);
+            verifiedJars = new ArrayList<String>();
+            unverifiedJars = new ArrayList<String>();
+
+            try {
+                
+                File jarFile = tracker.getCacheFile(jar.getLocation());
+                
+                // some sort of resource download/cache error. Nothing to add 
+                // in that case ... but don't fail here
+                if (jarFile == null) {
+                    return;
+                }
+
+                String localFile = jarFile.getAbsolutePath();
+                boolean result = verifyJar(localFile);
+
+                if (!result) {
+                    //allVerified is true until we encounter a problem
+                    //with one or more jars
+                    noSigningIssues = false;
+                    unverifiedJars.add(localFile);
+                } else {
+                    verifiedJars.add(localFile);
+                }
+            } catch (Exception e){
+                // We may catch exceptions from using verifyJar()
+            	// or from checkTrustedCerts	
+                throw e;
+            }
+        }
+    }
+
+    public boolean verifyJar(String jarName) throws Exception {
+        boolean anySigned = false;
+        boolean hasUnsignedEntry = false;
+        JarInputStream jis = null;
+
+        // certs could be uninitialized if one calls this method directly
+        if (certs == null)
+            certs = new ArrayList<CertPath>();
+        
+        try {
+            jis = new JarInputStream(new FileInputStream(jarName), true);
+            Vector<JarEntry> entriesVec = new Vector<JarEntry>();
+            byte[] buffer = new byte[8192];
+
+            JarEntry je;
+            while ((je = jis.getNextJarEntry()) != null) {
+                entriesVec.addElement(je);
+                InputStream is = null;
+                try {
+                    int n;
+                    while ((n = jis.read(buffer, 0, buffer.length)) != -1) {
+                        // we just read. this will throw a SecurityException
+                        // if  a signature/digest check fails.
+                    }
+                } finally {
+                    if (is != null) {
+                        is.close();
+                    }
+                }
+            }
+
+            Manifest man = jis.getManifest();
+
+            if (man != null) {
+                if (verbose) System.out.println();
+                Enumeration<JarEntry> e = entriesVec.elements();
+
+                long now = System.currentTimeMillis();
+
+                while (e.hasMoreElements()) {
+                    je = e.nextElement();
+                    String name = je.getName();
+                    CodeSigner[] signers = je.getCodeSigners();
+                    boolean isSigned = (signers != null);
+                    anySigned |= isSigned;
+                    hasUnsignedEntry |= !je.isDirectory() && !isSigned
+                                        && !signatureRelated(name);
+                    if (isSigned) {
+                    	// TODO: Perhaps we should check here that
+                    	// signers.length is only of size 1, and throw an
+                    	// exception if it's not?
+                        for (int i = 0; i < signers.length; i++) {
+                            CertPath certPath = signers[i].getSignerCertPath();
+                            if (!certs.contains(certPath))
+                                certs.add(certPath);
+                            
+                            //we really only want the first certPath
+                            if (!certPath.equals(this.certPath)){
+                            	this.certPath = certPath;
+                            }
+                            
+                            Certificate cert = signers[i].getSignerCertPath()
+                                .getCertificates().get(0);
+                            if (cert instanceof X509Certificate) {
+                                checkCertUsage((X509Certificate)cert, null);
+                                if (!showcerts) {
+                                    long notAfter = ((X509Certificate)cert)
+                                                    .getNotAfter().getTime();
+
+                                    if (notAfter < now) {
+                                        hasExpiredCert = true;
+                                    } else if (notAfter < now + SIX_MONTHS) {
+                                        hasExpiringCert = true;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                } //while e has more elements
+            } //if man not null
+
+            //Alert the user if any of the following are true.
+            if (!anySigned) {
+
+            } else {
+                anyJarsSigned = true;
+
+                //warnings
+                if (hasUnsignedEntry || hasExpiredCert || hasExpiringCert ||
+                        badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
+                        notYetValidCert) {
+
+                    addToDetails(R("SRunWithoutRestrictions"));
+
+                    if (badKeyUsage)
+                        addToDetails(R("SBadKeyUsage"));
+                    if (badExtendedKeyUsage)
+                        addToDetails(R("SBadExtendedKeyUsage"));
+                    if (badNetscapeCertType)
+                        addToDetails(R("SBadNetscapeCertType"));
+                    if (hasUnsignedEntry)
+                        addToDetails(R("SHasUnsignedEntry"));
+                    if (hasExpiredCert)
+                        addToDetails(R("SHasExpiredCert"));
+                    if (hasExpiringCert)
+                        addToDetails(R("SHasExpiringCert"));
+                    if (notYetValidCert)
+                        addToDetails(R("SNotYetValidCert"));
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw e;
+        } finally { // close the resource
+            if (jis != null) {
+                jis.close();
+            }
+        }
+
+        // check if the certs added above are in the trusted path
+        checkTrustedCerts();
+        
+        //anySigned does not guarantee that all files were signed.
+        return anySigned && !(hasUnsignedEntry || hasExpiredCert
+                              || badKeyUsage || badExtendedKeyUsage || badNetscapeCertType
+                              || notYetValidCert);
+    }
+
+    /**
+     * Checks the user's trusted.certs file and the cacerts file to see
+     * if a publisher's and/or CA's certificate exists there.
+     */
+    private void checkTrustedCerts() throws Exception {
+    	if (certPath != null) {
+    		try {
+    			KeyTool kt = new KeyTool();
+    			alreadyTrustPublisher = kt.isTrusted(getPublisher());
+   				rootInCacerts = kt.checkCacertsForCertificate(getRoot());
+    		} catch (Exception e) {
+    			// TODO: Warn user about not being able to
+    			// look through their cacerts/trusted.certs
+    			// file depending on exception.
+    			throw e;
+    		}
+    		
+    		if (!rootInCacerts)
+    			addToDetails(R("SUntrustedCertificate"));
+    		else 
+    			addToDetails(R("STrustedCertificate"));
+    	}
+    }
+    
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getPublisher()
+     */
+    public Certificate getPublisher() {
+    	if (certPath != null) {
+    		List<? extends Certificate> certList 
+			= certPath.getCertificates();
+    		if (certList.size() > 0) {
+    			return (Certificate)certList.get(0);
+    		} else {
+    			return null;
+    		}
+    	} else {
+    		return null;
+    	}
+    }
+    
+    /* (non-Javadoc)
+     * @see net.sourceforge.jnlp.tools.CertVerifier2#getRoot()
+     */
+    public Certificate getRoot() {
+    	if (certPath != null) {
+    		List<? extends Certificate> certList 
+			= certPath.getCertificates();
+    		if (certList.size() > 0) {
+    			return (Certificate)certList.get(
+    				certList.size() - 1);
+    		} else {
+    			return null;
+    		}
+    	} else {
+    		return null;
+    	}
+    }
+    
+	private void addToDetails(String detail) {
+		if (!details.contains(detail))
+			details.add(detail);
+	}
+
+    Hashtable<Certificate, String> storeHash =
+        new Hashtable<Certificate, String>();
+
+    /**
+     * signature-related files include:
+     * . META-INF/MANIFEST.MF
+     * . META-INF/SIG-*
+     * . META-INF/*.SF
+     * . META-INF/*.DSA
+     * . META-INF/*.RSA
+     *
+     * Required for verifyJar()
+     */
+    private boolean signatureRelated(String name) {
+        String ucName = name.toUpperCase();
+        if (ucName.equals(JarFile.MANIFEST_NAME) ||
+                ucName.equals(META_INF) ||
+                (ucName.startsWith(SIG_PREFIX) &&
+                 ucName.indexOf("/") == ucName.lastIndexOf("/"))) {
+            return true;
+        }
+
+        if (ucName.startsWith(META_INF) &&
+                SignatureFileVerifier.isBlockOrSF(ucName)) {
+            // .SF/.DSA/.RSA files in META-INF subdirs
+            // are not considered signature-related
+            return (ucName.indexOf("/") == ucName.lastIndexOf("/"));
+        }
+
+        return false;
+    }
+
+    /**
+     * Check if userCert is designed to be a code signer
+     * @param userCert the certificate to be examined
+     * @param bad 3 booleans to show if the KeyUsage, ExtendedKeyUsage,
+     *            NetscapeCertType has codeSigning flag turned on.
+     *            If null, the class field badKeyUsage, badExtendedKeyUsage,
+     *            badNetscapeCertType will be set.
+     *
+     * Required for verifyJar()
+     */
+    void checkCertUsage(X509Certificate userCert, boolean[] bad) {
+
+        // Can act as a signer?
+        // 1. if KeyUsage, then [0] should be true
+        // 2. if ExtendedKeyUsage, then should contains ANY or CODE_SIGNING
+        // 3. if NetscapeCertType, then should contains OBJECT_SIGNING
+        // 1,2,3 must be true
+
+        if (bad != null) {
+            bad[0] = bad[1] = bad[2] = false;
+        }
+
+        boolean[] keyUsage = userCert.getKeyUsage();
+        if (keyUsage != null) {
+            if (keyUsage.length < 1 || !keyUsage[0]) {
+                if (bad != null) {
+                    bad[0] = true;
+                } else {
+                    badKeyUsage = true;
+                }
+            }
+        }
+
+        try {
+            List<String> xKeyUsage = userCert.getExtendedKeyUsage();
+            if (xKeyUsage != null) {
+                if (!xKeyUsage.contains("2.5.29.37.0") // anyExtendedKeyUsage
+                        && !xKeyUsage.contains("1.3.6.1.5.5.7.3.3")) {  // codeSigning
+                    if (bad != null) {
+                        bad[1] = true;
+                    } else {
+                        badExtendedKeyUsage = true;
+                    }
+                }
+            }
+        } catch (java.security.cert.CertificateParsingException e) {
+            // shouldn't happen
+        }
+
+        try {
+            // OID_NETSCAPE_CERT_TYPE
+            byte[] netscapeEx = userCert.getExtensionValue
+                                ("2.16.840.1.113730.1.1");
+            if (netscapeEx != null) {
+                DerInputStream in = new DerInputStream(netscapeEx);
+                byte[] encoded = in.getOctetString();
+                encoded = new DerValue(encoded).getUnalignedBitString()
+                .toByteArray();
+
+                NetscapeCertTypeExtension extn =
+                    new NetscapeCertTypeExtension(encoded);
+
+                Boolean val = (Boolean)extn.get(
+                                  NetscapeCertTypeExtension.OBJECT_SIGNING);
+                if (!val) {
+                    if (bad != null) {
+                        bad[2] = true;
+                    } else {
+                        badNetscapeCertType = true;
+                    }
+                }
+            }
+        } catch (IOException e) {
+            //
+        }
+    }
+
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/JarSignerResources.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,212 @@
+/*
+ * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+/**
+ * <p> This class represents the <code>ResourceBundle</code>
+ * for JarSigner.
+ *
+ */
+public class JarSignerResources extends java.util.ListResourceBundle {
+
+    private static final Object[][] contents = {
+
+        // shared (from jarsigner)
+        {" ", " "},
+        {"  ", "  "},
+        {"      ", "      "},
+        {", ", ", "},
+
+        {"provName not a provider", "{0} not a provider"},
+        {"signerClass is not a signing mechanism", "{0} is not a signing mechanism"},
+        {"jarsigner error: ", "jarsigner error: "},
+        {"Illegal option: ", "Illegal option: "},
+        {"-keystore must be NONE if -storetype is {0}",
+                "-keystore must be NONE if -storetype is {0}"},
+        {"-keypass can not be specified if -storetype is {0}",
+                "-keypass can not be specified if -storetype is {0}"},
+        {"If -protected is specified, then -storepass and -keypass must not be specified",
+                "If -protected is specified, then -storepass and -keypass must not be specified"},
+        {"If keystore is not password protected, then -storepass and -keypass must not be specified",
+                 "If keystore is not password protected, then -storepass and -keypass must not be specified"},
+        {"Usage: jarsigner [options] jar-file alias",
+                "Usage: jarsigner [options] jar-file alias"},
+        {"       jarsigner -verify [options] jar-file",
+                "       jarsigner -verify [options] jar-file"},
+        {"[-keystore <url>]           keystore location",
+                "[-keystore <url>]           keystore location"},
+        {"[-storepass <password>]     password for keystore integrity",
+            "[-storepass <password>]     password for keystore integrity"},
+        {"[-storetype <type>]         keystore type",
+                "[-storetype <type>]         keystore type"},
+        {"[-keypass <password>]       password for private key (if different)",
+                "[-keypass <password>]       password for private key (if different)"},
+        {"[-sigfile <file>]           name of .SF/.DSA file",
+                "[-sigfile <file>]           name of .SF/.DSA file"},
+        {"[-signedjar <file>]         name of signed JAR file",
+                "[-signedjar <file>]         name of signed JAR file"},
+        {"[-digestalg <algorithm>]    name of digest algorithm",
+                "[-digestalg <algorithm>]    name of digest algorithm"},
+        {"[-sigalg <algorithm>]       name of signature algorithm",
+                "[-sigalg <algorithm>]       name of signature algorithm"},
+        {"[-verify]                   verify a signed JAR file",
+                "[-verify]                   verify a signed JAR file"},
+        {"[-verbose]                  verbose output when signing/verifying",
+                "[-verbose]                  verbose output when signing/verifying"},
+        {"[-certs]                    display certificates when verbose and verifying",
+                "[-certs]                    display certificates when verbose and verifying"},
+        {"[-tsa <url>]                location of the Timestamping Authority",
+                "[-tsa <url>]                location of the Timestamping Authority"},
+        {"[-tsacert <alias>]          public key certificate for Timestamping Authority",
+                "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
+        {"[-altsigner <class>]        class name of an alternative signing mechanism",
+                "[-altsigner <class>]        class name of an alternative signing mechanism"},
+        {"[-altsignerpath <pathlist>] location of an alternative signing mechanism",
+                "[-altsignerpath <pathlist>] location of an alternative signing mechanism"},
+        {"[-internalsf]               include the .SF file inside the signature block",
+                "[-internalsf]               include the .SF file inside the signature block"},
+        {"[-sectionsonly]             don't compute hash of entire manifest",
+                "[-sectionsonly]             don't compute hash of entire manifest"},
+        {"[-protected]                keystore has protected authentication path",
+                "[-protected]                keystore has protected authentication path"},
+        {"[-providerName <name>]      provider name",
+                "[-providerName <name>]      provider name"},
+        {"[-providerClass <class>     name of cryptographic service provider's",
+                "[-providerClass <class>     name of cryptographic service provider's"},
+        {"  [-providerArg <arg>]] ... master class file and constructor argument",
+                "  [-providerArg <arg>]] ... master class file and constructor argument"},
+        {"s", "s"},
+        {"m", "m"},
+        {"k", "k"},
+        {"i", "i"},
+        {"  s = signature was verified ",
+                "  s = signature was verified "},
+        {"  m = entry is listed in manifest",
+                "  m = entry is listed in manifest"},
+        {"  k = at least one certificate was found in keystore",
+                "  k = at least one certificate was found in keystore"},
+        {"  i = at least one certificate was found in identity scope",
+                "  i = at least one certificate was found in identity scope"},
+        {"no manifest.", "no manifest."},
+        {"jar is unsigned. (signatures missing or not parsable)",
+                "jar is unsigned. (signatures missing or not parsable)"},
+        {"jar verified.", "jar verified."},
+        {"jarsigner: ", "jarsigner: "},
+        {"signature filename must consist of the following characters: A-Z, 0-9, _ or -",
+                "signature filename must consist of the following characters: A-Z, 0-9, _ or -"},
+        {"unable to open jar file: ", "unable to open jar file: "},
+        {"unable to create: ", "unable to create: "},
+        {"   adding: ", "   adding: "},
+        {" updating: ", " updating: "},
+        {"  signing: ", "  signing: "},
+        {"attempt to rename signedJarFile to jarFile failed",
+                "attempt to rename {0} to {1} failed"},
+        {"attempt to rename jarFile to origJar failed",
+                "attempt to rename {0} to {1} failed"},
+        {"unable to sign jar: ", "unable to sign jar: "},
+        {"Enter Passphrase for keystore: ", "Enter Passphrase for keystore: "},
+        {"keystore load: ", "keystore load: "},
+        {"certificate exception: ", "certificate exception: "},
+        {"unable to instantiate keystore class: ",
+                "unable to instantiate keystore class: "},
+        {"Certificate chain not found for: alias.  alias must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.",
+                "Certificate chain not found for: {0}.  {1} must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."},
+        {"found non-X.509 certificate in signer's chain",
+                "found non-X.509 certificate in signer's chain"},
+        {"incomplete certificate chain", "incomplete certificate chain"},
+        {"Enter key password for alias: ", "Enter key password for {0}: "},
+        {"unable to recover key from keystore",
+                "unable to recover key from keystore"},
+        {"key associated with alias not a private key",
+                "key associated with {0} not a private key"},
+        {"you must enter key password", "you must enter key password"},
+        {"unable to read password: ", "unable to read password: "},
+        {"certificate is valid from", "certificate is valid from {0} to {1}"},
+        {"certificate expired on", "certificate expired on {0}"},
+        {"certificate is not valid until",
+                "certificate is not valid until {0}"},
+        {"certificate will expire on", "certificate will expire on {0}"},
+        {"requesting a signature timestamp",
+                "requesting a signature timestamp"},
+        {"TSA location: ", "TSA location: "},
+        {"TSA certificate: ", "TSA certificate: "},
+        {"no response from the Timestamping Authority. ",
+                "no response from the Timestamping Authority. "},
+        {"When connecting from behind a firewall then an HTTP proxy may need to be specified. ",
+                "When connecting from behind a firewall then an HTTP proxy may need to be specified. "},
+        {"Supply the following options to jarsigner: ",
+                "Supply the following options to jarsigner: "},
+        {"Certificate not found for: alias.  alias must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority.",
+                "Certificate not found for: {0}.  {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."},
+        {"using an alternative signing mechanism",
+                "using an alternative signing mechanism"},
+        {"entry was signed on", "entry was signed on {0}"},
+        {"Warning: ", "Warning: "},
+        {"This jar contains unsigned entries which have not been integrity-checked. ",
+                "This jar contains unsigned entries which have not been integrity-checked. "},
+        {"This jar contains entries whose signer certificate has expired. ",
+                "This jar contains entries whose signer certificate has expired. "},
+        {"This jar contains entries whose signer certificate will expire within six months. ",
+                "This jar contains entries whose signer certificate will expire within six months. "},
+        {"This jar contains entries whose signer certificate is not yet valid. ",
+                "This jar contains entries whose signer certificate is not yet valid. "},
+        {"Re-run with the -verbose option for more details.",
+                "Re-run with the -verbose option for more details."},
+        {"Re-run with the -verbose and -certs options for more details.",
+                "Re-run with the -verbose and -certs options for more details."},
+        {"The signer certificate has expired.",
+                "The signer certificate has expired."},
+        {"The signer certificate will expire within six months.",
+                "The signer certificate will expire within six months."},
+        {"The signer certificate is not yet valid.",
+                "The signer certificate is not yet valid."},
+        {"The signer certificate's KeyUsage extension doesn't allow code signing.",
+                 "The signer certificate's KeyUsage extension doesn't allow code signing."},
+        {"The signer certificate's ExtendedKeyUsage extension doesn't allow code signing.",
+                 "The signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
+        {"The signer certificate's NetscapeCertType extension doesn't allow code signing.",
+                 "The signer certificate's NetscapeCertType extension doesn't allow code signing."},
+         {"This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing.",
+                  "This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing."},
+         {"This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing.",
+                  "This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
+         {"This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing.",
+                  "This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing."},
+        {"[{0} extension does not support code signing]",
+                 "[{0} extension does not support code signing]"},
+    };
+
+    /**
+     * Returns the contents of this <code>ResourceBundle</code>.
+     *
+     * <p>
+     *
+     * @return the contents of this <code>ResourceBundle</code>.
+     */
+    public Object[][] getContents() {
+        return contents;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/KeyStoreUtil.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+/**
+ * <p> This class provides several utilities to <code>KeyStore</code>.
+ *
+ * @since 1.6.0
+ */
+public class KeyStoreUtil {
+
+    // Class and methods marked as public so that they can be
+    // accessed by JarSigner, which although lies in a package
+    // with the same name, but bundled in tools.jar and loaded
+    // by another class loader, hence in a different *runtime*
+    // package.
+    //
+    // See JVM Spec, 5.3 and 5.4.4
+
+    private KeyStoreUtil() {
+        // this class is not meant to be instantiated
+    }
+
+
+    /**
+     * Returns true if KeyStore has a password. This is true except for
+     * MSCAPI KeyStores
+     */
+    public static boolean isWindowsKeyStore(String storetype) {
+        return storetype.equalsIgnoreCase("Windows-MY")
+                || storetype.equalsIgnoreCase("Windows-ROOT");
+    }
+
+    /**
+     * Returns standard-looking names for storetype
+     */
+    public static String niceStoreTypeName(String storetype) {
+        if (storetype.equalsIgnoreCase("Windows-MY")) {
+            return "Windows-MY";
+        } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
+            return "Windows-ROOT";
+        } else {
+            return storetype.toUpperCase();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/tools/KeyTool.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,478 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package net.sourceforge.jnlp.tools;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.security.KeyStore;
+import java.security.MessageDigest;
+import java.security.PublicKey;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Random;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import net.sourceforge.jnlp.security.SecurityUtil;
+
+import sun.misc.BASE64Encoder;
+import sun.security.provider.X509Factory;
+
+/**
+ * This tool manages the user's trusted certificates
+ *
+ * @author Jan Luehe
+ * @author Joshua Sumali
+ */
+public class KeyTool {
+
+	// The user's keystore.
+	private KeyStore usercerts = null;
+	// JDK cacerts
+	private KeyStore cacerts = null;
+	// System ca-bundle.crt
+	private KeyStore systemcerts = null;
+	
+	private String fullCertPath = SecurityUtil.getTrustedCertsFilename();
+
+	private FileOutputStream fos = null;
+
+	/**
+	 * Whether we trust the system cacerts file.
+	 */
+	private boolean trustcacerts = true;
+	
+	/**
+	 * Whether we print certificates in rfc, base64 encoding.
+	 */
+	private boolean rfc = true;
+	
+	private final char[] password = "changeit".toCharArray();
+
+	/**
+	 * Whether we prompt for user input.
+	 */
+	private boolean noprompt = true;
+	
+	public KeyTool() throws Exception {
+
+		// Initialize all the keystores.
+		usercerts = SecurityUtil.getUserKeyStore();
+		cacerts = SecurityUtil.getCacertsKeyStore(); 
+		systemcerts = SecurityUtil.getSystemCertStore();
+	}
+
+	/**
+	 * Adds a trusted certificate to the user's keystore.
+	 * @return true if the add was successful, false otherwise.
+	 */
+	public boolean importCert(File file) throws Exception {
+	
+		BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
+		CertificateFactory cf = CertificateFactory.getInstance("X509");
+		X509Certificate cert = null;
+		
+		if (bis.available() >= 1) {
+			try {
+			cert = (X509Certificate)cf.generateCertificate(bis);
+			} catch (ClassCastException cce) {
+				throw new Exception("Input file is not an X509 Certificate");
+			} catch (CertificateException ce) {
+				throw new Exception("Input file is not an X509 Certificate");
+			}
+		}
+	
+		return importCert((Certificate)cert);
+	}
+	
+	/**
+	 * Adds a trusted certificate to the user's keystore.
+	 * @return true if the add was successful, false otherwise.
+	 */
+	public boolean importCert(Certificate cert) throws Exception {
+
+		String alias = usercerts.getCertificateAlias(cert);
+
+		if (alias != null) { //cert already exists
+			return true;
+		} else {
+			String newAlias = getRandomAlias();
+			//check to make sure this alias doesn't exist
+			while (usercerts.getCertificate(newAlias) != null)
+				newAlias = getRandomAlias();
+			return addTrustedCert(newAlias, cert);
+		}
+	}
+
+	/**
+	 * Generates a random alias for storing a trusted Certificate.
+	 */
+	private String getRandomAlias() {
+		Random r = new Random();
+		String token = Long.toString(Math.abs(r.nextLong()), 36);
+		return "trustedCert-" + token;
+	}
+	
+	/**
+     * Prints all keystore entries.
+     */
+	private void doPrintEntries(PrintStream out) throws Exception {
+
+		out.println("KeyStore type: " + usercerts.getType());
+		out.println("KeyStore provider: " + usercerts.getProvider().toString());
+		out.println();
+		
+		for (Enumeration<String> e = usercerts.aliases(); e.hasMoreElements();) {
+			String alias = e.nextElement();
+			doPrintEntry(alias, out, false);
+		}
+	}
+	
+    /**
+     * Prints a single keystore entry.
+     */
+	private void doPrintEntry(String alias, PrintStream out,
+			boolean printWarning) throws Exception {
+
+		if (usercerts.containsAlias(alias) == false) {
+			throw new Exception("Alias does not exist");
+		}
+
+		if (usercerts.entryInstanceOf(alias, 
+				KeyStore.TrustedCertificateEntry.class)) {
+			Certificate cert = usercerts.getCertificate(alias);
+
+			out.println("Alias: " + alias);
+			out.println("Date Created: " + usercerts.getCreationDate(alias));
+			out.println("Subject: " + getCN(((X509Certificate)usercerts
+				.getCertificate(alias)).getSubjectX500Principal().getName()));
+			out.println("Certificate fingerprint (MD5): "
+					+ getCertFingerPrint("MD5", cert));
+			out.println();
+		}
+	}
+
+	/**
+	 * Extracts the CN field from a Certificate principal string.
+	 */
+	private String getCN(String principal) {
+		int start = principal.indexOf("CN=");
+		int end = principal.indexOf(",", start);
+
+		if (end == -1) {
+			end = principal.length();
+		}
+
+		if (start >= 0)
+			return principal.substring(start+3, end);
+		else
+			return principal;
+    }
+
+    /**
+     * Gets the requested finger print of the certificate.
+     */
+	private String getCertFingerPrint(String mdAlg, Certificate cert)
+		throws Exception {
+		byte[] encCertInfo = cert.getEncoded();
+		MessageDigest md = MessageDigest.getInstance(mdAlg);
+		byte[] digest = md.digest(encCertInfo);
+		return toHexString(digest);
+	}
+
+    /**
+     * Converts a byte to hex digit and writes to the supplied buffer
+     */
+    private void byte2hex(byte b, StringBuffer buf) {
+        char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
+                            '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+        int high = ((b & 0xf0) >> 4);
+        int low = (b & 0x0f);
+        buf.append(hexChars[high]);
+        buf.append(hexChars[low]);
+    }
+
+    /**
+     * Converts a byte array to hex string
+     */
+    private String toHexString(byte[] block) {
+        StringBuffer buf = new StringBuffer();
+        int len = block.length;
+        for (int i = 0; i < len; i++) {
+             byte2hex(block[i], buf);
+             if (i < len-1) {
+                 buf.append(":");
+             }
+        }
+        return buf.toString();
+    }
+
+	/**
+	 * Adds a certificate to the keystore, and writes new keystore to disk.
+	 */
+    private boolean addTrustedCert(String alias, Certificate cert)
+    	throws Exception {
+    	
+    	if (isSelfSigned((X509Certificate)cert)) {
+			//will throw exception if this fails
+    		cert.verify(cert.getPublicKey());
+		}
+    
+    	if (noprompt) {
+    		usercerts.setCertificateEntry(alias, cert);
+			fos = new FileOutputStream(fullCertPath);
+			usercerts.store(fos, password);
+			fos.close();
+    		return true;
+    	}
+    	
+    	return false;
+    }    
+    
+    /**
+     * Returns true if the given certificate is trusted, false otherwise.
+     */
+    public boolean isTrusted(Certificate cert) throws Exception {
+    	if (cert != null) {
+    		if (usercerts.getCertificateAlias(cert) != null) {
+    			return true; // found in own keystore
+    		}
+    		return false;
+    	} else {
+    		return false;
+    	}
+    }
+    
+    /**
+     * Returns true if the certificate is self-signed, false otherwise.
+     */
+    private boolean isSelfSigned(X509Certificate cert) {
+        return cert.getSubjectDN().equals(cert.getIssuerDN());
+    }
+
+    /**
+     * Checks if a given certificate is part of the user's cacerts
+     * keystore.
+     * @param c the certificate to check
+     * @returns true if the certificate is in the user's cacerts and
+     * false otherwise
+     */
+    public boolean checkCacertsForCertificate(Certificate c) throws Exception {
+    	if (c != null) {
+
+			String alias = null;
+
+			//first try jdk cacerts.
+			if (cacerts != null) {
+    			alias = cacerts.getCertificateAlias(c);
+
+				//if we can't find it here, try the system certs.
+				if (alias == null && systemcerts != null)
+					alias = systemcerts.getCertificateAlias(c);
+			} 
+			//otherwise try the system certs if you can't use the jdk certs.
+			else if (systemcerts != null)
+				alias = systemcerts.getCertificateAlias(c);
+
+    		return (alias != null);
+    	} else 
+    		return false;
+    }
+    
+    /**
+     * Establishes a certificate chain (using trusted certificates in the
+     * keystore), starting with the user certificate
+     * and ending at a self-signed certificate found in the keystore.
+     *
+     * @param userCert the user certificate of the alias
+     * @param certToVerify the single certificate provided in the reply
+     */
+    public boolean establishCertChain(Certificate userCert,
+                                             Certificate certToVerify)
+        throws Exception
+    {
+        if (userCert != null) {
+            // Make sure that the public key of the certificate reply matches
+            // the original public key in the keystore
+            PublicKey origPubKey = userCert.getPublicKey();
+            PublicKey replyPubKey = certToVerify.getPublicKey();
+            if (!origPubKey.equals(replyPubKey)) {
+            	// TODO: something went wrong -- throw exception
+                throw new Exception(
+                	"Public keys in reply and keystore don't match");
+            }
+
+            // If the two certs are identical, we're done: no need to import
+            // anything
+            if (certToVerify.equals(userCert)) {
+                throw new Exception(
+                	"Certificate reply and certificate in keystore are identical");
+            }
+        }
+
+        // Build a hash table of all certificates in the keystore.
+        // Use the subject distinguished name as the key into the hash table.
+        // All certificates associated with the same subject distinguished
+        // name are stored in the same hash table entry as a vector.
+        Hashtable<Principal, Vector<Certificate>> certs = null;
+        if (usercerts.size() > 0) {
+            certs = new Hashtable<Principal, Vector<Certificate>>(11);
+            keystorecerts2Hashtable(usercerts, certs);
+        }
+        if (trustcacerts) { //if we're trusting the cacerts
+        	KeyStore caks = SecurityUtil.getCacertsKeyStore();
+            if (caks!=null && caks.size()>0) {
+                if (certs == null) {
+                    certs = new Hashtable<Principal, Vector<Certificate>>(11);
+                }
+                keystorecerts2Hashtable(caks, certs);
+            }
+        }
+
+        // start building chain
+        Vector<Certificate> chain = new Vector<Certificate>(2);
+        if (buildChain((X509Certificate)certToVerify, chain, certs)) {
+            Certificate[] newChain = new Certificate[chain.size()];
+            // buildChain() returns chain with self-signed root-cert first and
+            // user-cert last, so we need to invert the chain before we store
+            // it
+            int j=0;
+            for (int i=chain.size()-1; i>=0; i--) {
+                newChain[j] = chain.elementAt(i);
+                j++;
+            }
+            //return newChain;
+            return newChain != null;
+        } else {
+            throw new Exception("Failed to establish chain from reply");
+        }
+    }
+    
+    /**
+     * Stores the (leaf) certificates of a keystore in a hashtable.
+     * All certs belonging to the same CA are stored in a vector that
+     * in turn is stored in the hashtable, keyed by the CA's subject DN
+     */
+    private void keystorecerts2Hashtable(KeyStore ks,
+                Hashtable<Principal, Vector<Certificate>> hash)
+        throws Exception {
+
+        for (Enumeration<String> aliases = ks.aliases();
+                                        aliases.hasMoreElements(); ) {
+            String alias = aliases.nextElement();
+            Certificate cert = ks.getCertificate(alias);
+            if (cert != null) {
+                Principal subjectDN = ((X509Certificate)cert).getSubjectDN();
+                Vector<Certificate> vec = hash.get(subjectDN);
+                if (vec == null) {
+                    vec = new Vector<Certificate>();
+                    vec.addElement(cert);
+                } else {
+                    if (!vec.contains(cert)) {
+                        vec.addElement(cert);
+                    }
+                }
+                hash.put(subjectDN, vec);
+            }
+        }
+    }
+    
+    /**
+     * Recursively tries to establish chain from pool of trusted certs.
+     *
+     * @param certToVerify the cert that needs to be verified.
+     * @param chain the chain that's being built.
+     * @param certs the pool of trusted certs
+     *
+     * @return true if successful, false otherwise.
+     */
+    private boolean buildChain(X509Certificate certToVerify,
+                        Vector<Certificate> chain,
+                        Hashtable<Principal, Vector<Certificate>> certs) {
+        Principal subject = certToVerify.getSubjectDN();
+        Principal issuer = certToVerify.getIssuerDN();
+        if (subject.equals(issuer)) {
+            // reached self-signed root cert;
+            // no verification needed because it's trusted.
+            chain.addElement(certToVerify);
+            return true;
+        }
+
+        // Get the issuer's certificate(s)
+        Vector<Certificate> vec = certs.get(issuer);
+        if (vec == null) {
+            return false;
+        }
+
+        // Try out each certificate in the vector, until we find one
+        // whose public key verifies the signature of the certificate
+        // in question.
+        for (Enumeration<Certificate> issuerCerts = vec.elements();
+             issuerCerts.hasMoreElements(); ) {
+            X509Certificate issuerCert
+                = (X509Certificate)issuerCerts.nextElement();
+            PublicKey issuerPubKey = issuerCert.getPublicKey();
+            try {
+                certToVerify.verify(issuerPubKey);
+            } catch (Exception e) {
+                continue;
+            }
+            if (buildChain(issuerCert, chain, certs)) {
+                chain.addElement(certToVerify);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static void dumpCert(Certificate cert, PrintStream out)
+    	throws IOException, CertificateException {
+    	
+    	boolean printRfc = true;
+        if (printRfc) {
+            BASE64Encoder encoder = new BASE64Encoder();
+            out.println(X509Factory.BEGIN_CERT);
+            encoder.encodeBuffer(cert.getEncoded(), out);
+            out.println(X509Factory.END_CERT);
+        } else {
+            out.write(cert.getEncoded()); // binary
+        }
+    }
+    
+	public static void main(String[] args) throws Exception {
+		KeyTool kt = new KeyTool();
+		kt.doPrintEntries(System.out);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/util/PropertiesFile.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,148 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.util;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.*;
+
+/**
+ * A properties object backed by a specified file without throwing
+ * exceptions.  The properties are automatically loaded from the
+ * file when the first property is requested, but the save method
+ * must be called before changes are saved to the file.<p>
+ *
+ * This class does not report IO exceptions.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.4 $ 
+ */
+public class PropertiesFile extends Properties {
+
+    /** the file to save to */
+    File file;
+
+    /** the header string */
+    String header = "netx file";
+
+    /** lazy loaded on getProperty */
+    boolean loaded = false;
+
+
+    /** 
+     * Create a properties object backed by the specified file. 
+     *
+     * @param file the file to save and load to
+     */
+    public PropertiesFile(File file) {
+        this.file = file;
+    }
+
+    /** 
+     * Create a properties object backed by the specified file. 
+     *
+     * @param file the file to save and load to
+     * @param header the file header
+     */
+    public PropertiesFile(File file, String header) {
+        this.file = file;
+        this.header = header;
+    }
+
+    /**
+     * Returns the value of the specified key, or null if the key
+     * does not exist.
+     */
+    public String getProperty(String key) {
+        if (!loaded)
+            load();
+
+        return super.getProperty(key);
+    }
+
+    /**
+     * Returns the value of the specified key, or the default value
+     * if the key does not exist.
+     */
+    public String getProperty(String key, String defaultValue) {
+        if (!loaded)
+            load();
+
+        return super.getProperty(key, defaultValue);
+    }
+
+    /**
+     * Sets the value for the specified key.
+     *
+     * @return the previous value
+     */
+    public Object setProperty(String key, String value) {
+        if (!loaded)
+            load();
+
+        return super.setProperty(key, value);
+    }
+
+    /**
+     * Returns the file backing this properties object.
+     */
+    public File getStoreFile() {
+        return file;
+    }
+
+    /**
+     * Ensures that the file backing these properties has been
+     * loaded; call this method before calling any method defined by
+     * a superclass.
+     */
+    public void load() {
+        loaded = true;
+
+        try {
+            if (!file.exists())
+                return;
+
+            InputStream s = new FileInputStream(file);
+            load(s);
+        }
+        catch (IOException ex) {
+            // eat
+        }
+    }
+
+    /**
+     * Saves the properties to the file.
+     */
+    public void store() {
+        if (!loaded)
+            return; // nothing could have changed so save unnecessary load/save
+
+        try {
+            OutputStream s = new FileOutputStream(file);
+            store(s, header);
+        }
+        catch (IOException ex) {
+            // eat
+        }
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/util/Reflect.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,148 @@
+// Copyright (C) 2003 Jon A. Maxwell (JAM)
+// 
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+package net.sourceforge.jnlp.util;
+
+import java.util.*;
+import java.lang.reflect.*;
+
+
+/**
+ * Provides simply, convenient methods to invoke methods by
+ * name.  This class is used to consolidate reflection needed to
+ * access methods specific to Sun's JVM or to remain backward
+ * compatible while supporting method in newer JVMs.<p>
+ *
+ * Most methods of this class invoke the first method on the
+ * specified object that matches the name and number of
+ * parameters.  The type of the parameters are not considered, so
+ * do not attempt to use this class to invoke overloaded
+ * methods.<p>
+ *
+ * Instances of this class are not synchronized.<p>
+ *
+ * @author <a href="mailto:jon.maxwell@acm.org">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.1 $ 
+ */
+public class Reflect {
+
+    // todo: check non-null parameter types, try to send to proper
+    // method if overloaded ones exist on the target object
+
+    // todo: optimize slightly using hashtable of Methods
+
+    private boolean accessible;
+
+    private static Object zero[] = new Object[0];
+
+    
+    /**
+     * Create a new Reflect instance.
+     */
+    public Reflect() {
+        //
+    }
+
+    /**
+     * Create a new Reflect instance.
+     *
+     * @param accessible whether to bypass access permissions
+     */
+    public Reflect(boolean accessible) {
+        this.accessible = accessible;
+    }
+
+    /**
+     * Invoke a zero-parameter static method by name.
+     */
+    public Object invokeStatic(String className, String method) {
+        return invokeStatic(className, method, zero);
+    }
+
+    /**
+     * Invoke the static method using the specified parameters.
+     */
+    public Object invokeStatic(String className, String method, Object args[]) {
+        try {
+            Class c = Class.forName(className, true, Reflect.class.getClassLoader());
+
+            Method m = getMethod(c, method, args);
+            if (m.isAccessible() != accessible)
+                m.setAccessible(accessible);
+
+            return m.invoke(null, args);
+        }
+        catch (Exception ex) { // eat
+            return null;
+        }
+    }
+
+    /**
+     * Invoke a zero-parameter method by name on the specified
+     * object.
+     */
+    public Object invoke(Object object, String method) {
+        return invoke(object, method, zero);
+    }
+
+    /**
+     * Invoke a method by name with the specified parameters.
+     *
+     * @return the result of the method, or null on exception.
+     */
+    public Object invoke(Object object, String method, Object args[]) {
+        try {
+            Method m = getMethod(object.getClass(), method, args);
+            if (m.isAccessible() != accessible)
+                m.setAccessible(accessible);
+
+            return m.invoke(object, args);
+        }
+        catch (Exception ex) { // eat
+            ex.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * Return the Method matching the specified name and number of
+     * arguments.
+     */
+    public Method getMethod(Class type, String method, Object args[]) {
+        try {
+            for (Class c = type; c != null; c = c.getSuperclass()) {
+                Method methods[] = c.getMethods();
+
+                for (int i=0; i < methods.length; i++) {
+                    if (methods[i].getName().equals(method)) {
+                        Class parameters[] = methods[i].getParameterTypes();
+
+                        if (parameters.length == args.length)
+                            return methods[i];
+                    }
+                }
+            }
+        }
+        catch (Exception ex) { // eat
+            ex.printStackTrace();
+        }
+
+        return null;
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/util/WeakList.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,128 @@
+// Copyright (C) 2002-2003 Jon A. Maxwell (JAM)
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+
+package net.sourceforge.jnlp.util;
+
+import java.lang.ref.*;
+import java.util.*;
+
+
+/**
+ * This list stores objects automatically using weak references.
+ * Objects are added and removed from the list as normal, but may
+ * turn to null at any point (ie, indexOf(x) followed by get(x)
+ * may return null).  The weak references are only removed when
+ * the trimToSize method is called so that the indices remain
+ * constant otherwise.<p>
+ *
+ * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
+ * @version $Revision: 1.3 $ 
+ */
+public class WeakList extends AbstractList {
+
+    /* list of weak references */
+    private ArrayList refs = new ArrayList();
+
+
+    /** 
+     * Create a weak random-access list.
+     */
+    public WeakList() {
+    }
+
+    /**
+     * Extract the hard reference out of a weak reference.
+     */
+    private Object deref(Object o) {
+        if (o != null && o instanceof WeakReference)
+            return ((WeakReference)o).get();
+        else
+            return null;
+    }
+
+    /**
+     * Returns the object at the specified index, or null if the
+     * object has been collected.
+     */
+    public Object get(int index) {
+        return deref(refs.get(index));
+    }
+
+    /**
+     * Returns the size of the list, including already collected
+     * objects.
+     */
+    public int size() {
+        return refs.size();
+    }
+
+    /**
+     * Sets the object at the specified position and returns the
+     * previous object at that position or null if it was already
+     * collected.
+     */
+    public Object set(int index, Object element) {
+        return deref(refs.set(index, new WeakReference(element)));
+    }
+
+    /**
+     * Inserts the object at the specified position in the list.
+     * Automatically creates a weak reference to the object.
+     */
+    public void add(int index, Object element) {
+        refs.add(index, new WeakReference(element));
+    }
+
+    /**
+     * Removes the object at the specified position and returns it
+     * or returns null if it was already collected.
+     */
+    public Object remove(int index) {
+        return deref(refs.remove(index));
+    }
+
+    /**
+     * Returns a list of hard references to the objects.  The
+     * returned list does not include the collected elements, so its
+     * indices do not necessarily correlate with those of this list.
+     */
+    public List hardList() {
+        List result = new ArrayList();
+
+        for (int i=0; i < size(); i++) {
+            Object tmp = get(i);
+
+            if (tmp != null)
+                result.add(tmp);
+        }
+
+        return result;
+    }
+
+    /**
+     * Compacts the list by removing references to collected
+     * objects.
+     */
+    public void trimToSize() {
+        for (int i=size(); i-->0;)
+            if (get(i)==null)
+                remove(i);
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/nanoxml/XMLElement.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,1334 @@
+/* XMLElement.java
+ *
+ * $Revision: 1.2 $
+ * $Date: 2002/08/03 04:36:34 $
+ * $Name:  $
+ *
+ * This file is part of NanoXML 2 Lite.
+ * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
+ *
+ * This software is provided 'as-is', without any express or implied warranty.
+ * In no event will the authors be held liable for any damages arising from the
+ * use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ *  1. The origin of this software must not be misrepresented; you must not
+ *     claim that you wrote the original software. If you use this software in
+ *     a product, an acknowledgment in the product documentation would be
+ *     appreciated but is not required.
+ *
+ *  2. Altered source versions must be plainly marked as such, and must not be
+ *     misrepresented as being the original software.
+ *
+ *  3. This notice may not be removed or altered from any source distribution.
+ *****************************************************************************/
+
+/* JAM: hacked the source to remove unneeded methods and comments. */
+
+package net.sourceforge.nanoxml;
+
+import java.io.*;
+import java.util.*;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+
+/**
+ * XMLElement is a representation of an XML object. The object is able to parse
+ * XML code.
+ * <P><DL>
+ * <DT><B>Parsing XML Data</B></DT>
+ * <DD>
+ * You can parse XML data using the following code:
+ * <UL><CODE>
+ * XMLElement xml = new XMLElement();<BR>
+ * FileReader reader = new FileReader("filename.xml");<BR>
+ * xml.parseFromReader(reader);
+ * </CODE></UL></DD></DL>
+ * <DL><DT><B>Retrieving Attributes</B></DT>
+ * <DD>
+ * You can enumerate the attributes of an element using the method
+ * {@link #enumerateAttributeNames() enumerateAttributeNames}.
+ * The attribute values can be retrieved using the method
+ * {@link #getStringAttribute(java.lang.String) getStringAttribute}.
+ * The following example shows how to list the attributes of an element:
+ * <UL><CODE>
+ * XMLElement element = ...;<BR>
+ * Enumeration enum = element.getAttributeNames();<BR>
+ * while (enum.hasMoreElements()) {<BR>
+ * &nbsp;&nbsp;&nbsp;&nbsp;String key = (String) enum.nextElement();<BR>
+ * &nbsp;&nbsp;&nbsp;&nbsp;String value = element.getStringAttribute(key);<BR>
+ * &nbsp;&nbsp;&nbsp;&nbsp;System.out.println(key + " = " + value);<BR>
+ * }
+ * </CODE></UL></DD></DL>
+ * <DL><DT><B>Retrieving Child Elements</B></DT>
+ * <DD>
+ * You can enumerate the children of an element using
+ * {@link #enumerateChildren() enumerateChildren}.
+ * The number of child elements can be retrieved using
+ * {@link #countChildren() countChildren}.
+ * </DD></DL>
+ * <DL><DT><B>Elements Containing Character Data</B></DT>
+ * <DD>
+ * If an elements contains character data, like in the following example:
+ * <UL><CODE>
+ * &lt;title&gt;The Title&lt;/title&gt;
+ * </CODE></UL>
+ * you can retrieve that data using the method
+ * {@link #getContent() getContent}.
+ * </DD></DL>
+ * <DL><DT><B>Subclassing XMLElement</B></DT>
+ * <DD>
+ * When subclassing XMLElement, you need to override the method
+ * {@link #createAnotherElement() createAnotherElement}
+ * which has to return a new copy of the receiver.
+ * </DD></DL>
+ * <P>
+ *
+ * @see net.sourceforge.nanoxml.XMLParseException
+ *
+ * @author Marc De Scheemaecker
+ *         &lt;<A href="mailto:cyberelf@mac.com">cyberelf@mac.com</A>&gt;
+ * @version $Name:  $, $Revision: 1.2 $
+ */
+public class XMLElement
+{
+
+    /**
+     * The attributes given to the element.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field can be empty.
+     *     <li>The field is never <code>null</code>.
+     *     <li>The keys and the values are strings.
+     * </ul></dd></dl>
+     */
+    private Hashtable attributes;
+
+
+    /**
+     * Child elements of the element.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field can be empty.
+     *     <li>The field is never <code>null</code>.
+     *     <li>The elements are instances of <code>XMLElement</code>
+     *         or a subclass of <code>XMLElement</code>.
+     * </ul></dd></dl>
+     */
+    private Vector children;
+
+
+    /**
+     * The name of the element.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field is <code>null</code> iff the element is not
+     *         initialized by either parse or setName.
+     *     <li>If the field is not <code>null</code>, it's not empty.
+     *     <li>If the field is not <code>null</code>, it contains a valid
+     *         XML identifier.
+     * </ul></dd></dl>
+     */
+    private String name;
+
+
+    /**
+     * The #PCDATA content of the object.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field is <code>null</code> iff the element is not a
+     *         #PCDATA element.
+     *     <li>The field can be any string, including the empty string.
+     * </ul></dd></dl>
+     */
+    private String contents;
+
+
+    /**
+     * Conversion table for &amp;...; entities. The keys are the entity names
+     * without the &amp; and ; delimiters.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field is never <code>null</code>.
+     *     <li>The field always contains the following associations:
+     *         "lt"&nbsp;=&gt;&nbsp;"&lt;", "gt"&nbsp;=&gt;&nbsp;"&gt;",
+     *         "quot"&nbsp;=&gt;&nbsp;"\"", "apos"&nbsp;=&gt;&nbsp;"'",
+     *         "amp"&nbsp;=&gt;&nbsp;"&amp;"
+     *     <li>The keys are strings
+     *     <li>The values are char arrays
+     * </ul></dd></dl>
+     */
+    private Hashtable entities;
+
+
+    /**
+     * The line number where the element starts.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li><code>lineNr &gt= 0</code>
+     * </ul></dd></dl>
+     */
+    private int lineNr;
+
+
+    /**
+     * <code>true</code> if the case of the element and attribute names
+     * are case insensitive.
+     */
+    private boolean ignoreCase;
+
+
+    /**
+     * <code>true</code> if the leading and trailing whitespace of #PCDATA
+     * sections have to be ignored.
+     */
+    private boolean ignoreWhitespace;
+
+
+    /**
+     * Character read too much.
+     * This character provides push-back functionality to the input reader
+     * without having to use a PushbackReader.
+     * If there is no such character, this field is '\0'.
+     */
+    private char charReadTooMuch;
+
+    /**
+     * Character read too much for the comment remover.
+     */
+    private char sanitizeCharReadTooMuch;
+
+    /**
+     * The reader provided by the caller of the parse method.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>The field is not <code>null</code> while the parse method
+     *         is running.
+     * </ul></dd></dl>
+     */
+    private Reader reader;
+
+
+    /**
+     * The current line number in the source content.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li>parserLineNr &gt; 0 while the parse method is running.
+     * </ul></dd></dl>
+     */
+    private int parserLineNr;
+
+
+    /**
+     * Creates and initializes a new XML element.
+     * Calling the construction is equivalent to:
+     * <ul><code>new XMLElement(new Hashtable(), false, true)
+     * </code></ul>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>countChildren() => 0
+     *     <li>enumerateChildren() => empty enumeration
+     *     <li>enumeratePropertyNames() => empty enumeration
+     *     <li>getChildren() => empty vector
+     *     <li>getContent() => ""
+     *     <li>getLineNr() => 0
+     *     <li>getName() => null
+     * </ul></dd></dl>
+     *
+     */
+    public XMLElement()
+    {
+        this(new Hashtable(), false, true, true);
+    }
+    
+
+    /**
+     * Creates and initializes a new XML element.
+     * <P>
+     * This constructor should <I>only</I> be called from
+     * {@link #createAnotherElement() createAnotherElement}
+     * to create child elements.
+     *
+     * @param entities
+     *     The entity conversion table.
+     * @param skipLeadingWhitespace
+     *     <code>true</code> if leading and trailing whitespace in PCDATA
+     *     content has to be removed.
+     * @param fillBasicConversionTable
+     *     <code>true</code> if the basic entities need to be added to
+     *     the entity list (client code calling this constructor).
+     * @param ignoreCase
+     *     <code>true</code> if the case of element and attribute names have
+     *     to be ignored.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>entities != null</code>
+     *     <li>if <code>fillBasicConversionTable == false</code>
+     *         then <code>entities</code> contains at least the following
+     *         entries: <code>amp</code>, <code>lt</code>, <code>gt</code>,
+     *         <code>apos</code> and <code>quot</code>
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>countChildren() => 0
+     *     <li>enumerateChildren() => empty enumeration
+     *     <li>enumeratePropertyNames() => empty enumeration
+     *     <li>getChildren() => empty vector
+     *     <li>getContent() => ""
+     *     <li>getLineNr() => 0
+     *     <li>getName() => null
+     * </ul></dd></dl><dl>
+     *
+     */
+    protected XMLElement(Hashtable entities,
+                         boolean   skipLeadingWhitespace,
+                         boolean   fillBasicConversionTable,
+                         boolean   ignoreCase)
+    {
+        this.ignoreWhitespace = skipLeadingWhitespace;
+        this.ignoreCase = ignoreCase;
+        this.name = null;
+        this.contents = "";
+        this.attributes = new Hashtable();
+        this.children = new Vector();
+        this.entities = entities;
+        this.lineNr = 0;
+        Enumeration e = this.entities.keys();
+        while (e.hasMoreElements()) {
+            Object key = e.nextElement();
+            Object value = this.entities.get(key);
+            if (value instanceof String) {
+                value = ((String) value).toCharArray();
+                this.entities.put(key, value);
+            }
+        }
+        if (fillBasicConversionTable) {
+            this.entities.put("amp", new char[] { '&' });
+            this.entities.put("quot", new char[] { '"' });
+            this.entities.put("apos", new char[] { '\'' });
+            this.entities.put("lt", new char[] { '<' });
+            this.entities.put("gt", new char[] { '>' });
+        }
+    }
+
+
+    /**
+     * Adds a child element.
+     *
+     * @param child
+     *     The child element to add.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>child != null</code>
+     *     <li><code>child.getName() != null</code>
+     *     <li><code>child</code> does not have a parent element
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>countChildren() => old.countChildren() + 1
+     *     <li>enumerateChildren() => old.enumerateChildren() + child
+     *     <li>getChildren() => old.enumerateChildren() + child
+     * </ul></dd></dl><dl>
+     *
+     */
+    public void addChild(XMLElement child)
+    {
+        this.children.addElement(child);
+    }
+
+
+    /**
+     * Adds or modifies an attribute.
+     *
+     * @param name
+     *     The name of the attribute.
+     * @param value
+     *     The value of the attribute.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     *     <li><code>name</code> is a valid XML identifier
+     *     <li><code>value != null</code>
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>enumerateAttributeNames()
+     *         => old.enumerateAttributeNames() + name
+     *     <li>getAttribute(name) => value
+     * </ul></dd></dl><dl>
+     *
+     */
+    public void setAttribute(String name,
+                             Object value)
+    {
+        if (this.ignoreCase) {
+            name = name.toUpperCase();
+        }
+        this.attributes.put(name, value.toString());
+    }
+
+
+    /**
+     * Returns the number of child elements of the element.
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li><code>result >= 0</code>
+     * </ul></dd></dl>
+     *
+     */
+    public int countChildren()
+    {
+        return this.children.size();
+    }
+
+
+    /**
+     * Enumerates the attribute names.
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li><code>result != null</code>
+     * </ul></dd></dl>
+     *
+     */
+    public Enumeration enumerateAttributeNames()
+    {
+        return this.attributes.keys();
+    }
+
+
+    /**
+     * Enumerates the child elements.
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li><code>result != null</code>
+     * </ul></dd></dl>
+     *
+     */
+    public Enumeration enumerateChildren()
+    {
+        return this.children.elements();
+    }
+
+
+    /**
+     * Returns the PCDATA content of the object. If there is no such content,
+     * <CODE>null</CODE> is returned.
+     *
+     */
+    public String getContent()
+    {
+        return this.contents;
+    }
+
+
+    /**
+     * Returns the line nr in the source data on which the element is found.
+     * This method returns <code>0</code> there is no associated source data.
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li><code>result >= 0</code>
+     * </ul></dd></dl>
+     */
+    public int getLineNr()
+    {
+        return this.lineNr;
+    }
+
+
+    /**
+     * Returns an attribute of the element.
+     * If the attribute doesn't exist, <code>null</code> is returned.
+     *
+     * @param name The name of the attribute.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     *     <li><code>name</code> is a valid XML identifier
+     * </ul></dd></dl><dl>
+     *
+     */
+    public Object getAttribute(String name)
+    {
+        if (this.ignoreCase) {
+            name = name.toUpperCase();
+        }
+        Object value = this.attributes.get(name);
+        return value;
+    }
+
+
+    /**
+     * Returns the name of the element.
+     *
+     */
+    public String getName()
+    {
+        return this.name;
+    }
+
+
+    /**
+     * Reads one XML element from a java.io.Reader and parses it.
+     *
+     * @param reader
+     *     The reader from which to retrieve the XML data.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>reader != null</code>
+     *     <li><code>reader</code> is not closed
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>the state of the receiver is updated to reflect the XML element
+     *         parsed from the reader
+     *     <li>the reader points to the first character following the last
+     *         '&gt;' character of the XML element
+     * </ul></dd></dl><dl>
+     *
+     * @throws java.io.IOException
+     *     If an error occured while reading the input.
+     * @throws net.sourceforge.nanoxml.XMLParseException
+     *     If an error occured while parsing the read data.
+     */
+    public void parseFromReader(Reader reader)
+    throws IOException, XMLParseException
+    {
+        this.parseFromReader(reader, /*startingLineNr*/ 1);
+    }
+
+
+    /**
+     * Reads one XML element from a java.io.Reader and parses it.
+     *
+     * @param reader
+     *     The reader from which to retrieve the XML data.
+     * @param startingLineNr
+     *     The line number of the first line in the data.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>reader != null</code>
+     *     <li><code>reader</code> is not closed
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>the state of the receiver is updated to reflect the XML element
+     *         parsed from the reader
+     *     <li>the reader points to the first character following the last
+     *         '&gt;' character of the XML element
+     * </ul></dd></dl><dl>
+     *
+     * @throws java.io.IOException
+     *     If an error occured while reading the input.
+     * @throws net.sourceforge.nanoxml.XMLParseException
+     *     If an error occured while parsing the read data.
+     */
+    public void parseFromReader(Reader reader,
+                                int    startingLineNr)
+        throws IOException, XMLParseException
+    {
+        this.charReadTooMuch = '\0';
+        this.reader = reader;
+        this.parserLineNr = startingLineNr;
+
+        for (;;) {
+            char ch = this.scanWhitespace();
+
+            if (ch != '<') {
+                throw this.expectedInput("<", ch);
+            }
+
+            ch = this.readChar();
+
+            if ((ch == '!') || (ch == '?')) {
+                this.skipSpecialTag(0);
+            } else {
+                this.unreadChar(ch);
+                this.scanElement(this);
+                return;
+            }
+        }
+    }
+
+
+    /**
+     * Creates a new similar XML element.
+     * <P>
+     * You should override this method when subclassing XMLElement.
+     */
+    protected XMLElement createAnotherElement()
+    {
+        return new XMLElement(this.entities,
+                              this.ignoreWhitespace,
+                              false,
+                              this.ignoreCase);
+    }
+
+
+    /**
+     * Changes the content string.
+     *
+     * @param content
+     *     The new content string.
+     */
+    public void setContent(String content)
+    {
+        this.contents = content;
+    }
+
+
+    /**
+     * Changes the name of the element.
+     *
+     * @param name
+     *     The new name.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     *     <li><code>name</code> is a valid XML identifier
+     * </ul></dd></dl>
+     *
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * Scans an identifier from the current reader.
+     * The scanned identifier is appended to <code>result</code>.
+     *
+     * @param result
+     *     The buffer in which the scanned identifier will be put.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>result != null</code>
+     *     <li>The next character read from the reader is a valid first
+     *         character of an XML identifier.
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>The next character read from the reader won't be an identifier
+     *         character.
+     * </ul></dd></dl><dl>
+     */
+    protected void scanIdentifier(StringBuffer result)
+        throws IOException
+    {
+        for (;;) {
+            char ch = this.readChar();
+            if (((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z'))
+                && ((ch < '0') || (ch > '9')) && (ch != '_') && (ch != '.')
+                && (ch != ':') && (ch != '-') && (ch <= '\u007E')) {
+                this.unreadChar(ch);
+                return;
+            }
+            result.append(ch);
+        }
+    }
+
+
+    /**
+     * This method scans an identifier from the current reader.
+     *
+     * @return the next character following the whitespace.
+     */
+    protected char scanWhitespace()
+        throws IOException
+    {
+        for (;;) {
+            char ch = this.readChar();
+            switch (ch) {
+                case ' ':
+                case '\t':
+                case '\n':
+                case '\r':
+                    break;
+                default:
+                    return ch;
+            }
+        }
+    }
+
+
+    /**
+     * This method scans an identifier from the current reader.
+     * The scanned whitespace is appended to <code>result</code>.
+     *
+     * @return the next character following the whitespace.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>result != null</code>
+     * </ul></dd></dl>
+     */
+    protected char scanWhitespace(StringBuffer result)
+        throws IOException
+    {
+        for (;;) {
+            char ch = this.readChar();
+            switch (ch) {
+                case ' ':
+                case '\t':
+                case '\n':
+                    result.append(ch);
+                case '\r':
+                    break;
+                default:
+                    return ch;
+            }
+        }
+    }
+
+
+    /**
+     * This method scans a delimited string from the current reader.
+     * The scanned string without delimiters is appended to
+     * <code>string</code>.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>string != null</code>
+     *     <li>the next char read is the string delimiter
+     * </ul></dd></dl>
+     */
+    protected void scanString(StringBuffer string)
+        throws IOException
+    {
+        char delimiter = this.readChar();
+        if ((delimiter != '\'') && (delimiter != '"')) {
+            throw this.expectedInput("' or \"");
+        }
+        for (;;) {
+            char ch = this.readChar();
+            if (ch == delimiter) {
+                return;
+            } else if (ch == '&') {
+                this.resolveEntity(string);
+            } else {
+                string.append(ch);
+            }
+        }
+    }
+
+
+    /**
+     * Scans a #PCDATA element. CDATA sections and entities are resolved.
+     * The next &lt; char is skipped.
+     * The scanned data is appended to <code>data</code>.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>data != null</code>
+     * </ul></dd></dl>
+     */
+    protected void scanPCData(StringBuffer data)
+        throws IOException
+    {
+        for (;;) {
+            char ch = this.readChar();
+            if (ch == '<') {
+                ch = this.readChar();
+                if (ch == '!') {
+                    this.checkCDATA(data);
+                } else {
+                    this.unreadChar(ch);
+                    return;
+                }
+            } else if (ch == '&') {
+                this.resolveEntity(data);
+            } else {
+                data.append(ch);
+            }
+        }
+    }
+
+
+    /**
+     * Scans a special tag and if the tag is a CDATA section, append its
+     * content to <code>buf</code>.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>buf != null</code>
+     *     <li>The first &lt; has already been read.
+     * </ul></dd></dl>
+     */
+    protected boolean checkCDATA(StringBuffer buf)
+        throws IOException
+    {
+        char ch = this.readChar();
+        if (ch != '[') {
+            this.unreadChar(ch);
+            this.skipSpecialTag(0);
+            return false;
+        } else if (! this.checkLiteral("CDATA[")) {
+            this.skipSpecialTag(1); // one [ has already been read
+            return false;
+        } else {
+            int delimiterCharsSkipped = 0;
+            while (delimiterCharsSkipped < 3) {
+                ch = this.readChar();
+                switch (ch) {
+                    case ']':
+                        if (delimiterCharsSkipped < 2) {
+                            delimiterCharsSkipped += 1;
+                        } else {
+                            buf.append(']');
+                            buf.append(']');
+                            delimiterCharsSkipped = 0;
+                        }
+                        break;
+                    case '>':
+                        if (delimiterCharsSkipped < 2) {
+                            for (int i = 0; i < delimiterCharsSkipped; i++) {
+                                buf.append(']');
+                            }
+                            delimiterCharsSkipped = 0;
+                            buf.append('>');
+                        } else {
+                            delimiterCharsSkipped = 3;
+                        }
+                        break;
+                    default:
+                        for (int i = 0; i < delimiterCharsSkipped; i += 1) {
+                            buf.append(']');
+                        }
+                        buf.append(ch);
+                        delimiterCharsSkipped = 0;
+                }
+            }
+            return true;
+        }
+    }
+
+
+    /**
+     * Skips a comment.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li>The first &lt;!-- has already been read.
+     * </ul></dd></dl>
+     */
+    protected void skipComment()
+        throws IOException
+    {
+        int dashesToRead = 2;
+        while (dashesToRead > 0) {
+            char ch = this.readChar();
+            if (ch == '-') {
+                dashesToRead -= 1;
+            } else {
+                dashesToRead = 2;
+            }
+
+            // Be more tolerant of extra -- (double dashes)
+            // in comments.
+            if (dashesToRead == 0) {
+                ch = this.readChar();
+                if (ch == '>') {
+                    return;
+                } else {
+                    dashesToRead = 2;
+                    this.unreadChar(ch);
+                }
+            }
+        }
+        /*
+        if (this.readChar() != '>') {
+            throw this.expectedInput(">");
+        }
+        */
+    }
+
+
+    /**
+     * Skips a special tag or comment.
+     *
+     * @param bracketLevel The number of open square brackets ([) that have
+     *                     already been read.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li>The first &lt;! has already been read.
+     *     <li><code>bracketLevel >= 0</code>
+     * </ul></dd></dl>
+     */
+    protected void skipSpecialTag(int bracketLevel)
+        throws IOException
+    {
+        int tagLevel = 1; // <
+        char stringDelimiter = '\0';
+        if (bracketLevel == 0) {
+            char ch = this.readChar();
+            if (ch == '[') {
+                bracketLevel += 1;
+            } else if (ch == '-') {
+                ch = this.readChar();
+                if (ch == '[') {
+                    bracketLevel += 1;
+                } else if (ch == ']') {
+                    bracketLevel -= 1;
+                } else if (ch == '-') {
+                    this.skipComment();
+                    return;
+                }
+            }
+        }
+        while (tagLevel > 0) {
+            char ch = this.readChar();
+            if (stringDelimiter == '\0') {
+                if ((ch == '"') || (ch == '\'')) {
+                    stringDelimiter = ch;
+                } else if (bracketLevel <= 0) {
+                    if (ch == '<') {
+                        tagLevel += 1;
+                    } else if (ch == '>') {
+                        tagLevel -= 1;
+                    }
+                }
+                if (ch == '[') {
+                    bracketLevel += 1;
+                } else if (ch == ']') {
+                    bracketLevel -= 1;
+                }
+            } else {
+                if (ch == stringDelimiter) {
+                    stringDelimiter = '\0';
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Scans the data for literal text.
+     * Scanning stops when a character does not match or after the complete
+     * text has been checked, whichever comes first.
+     *
+     * @param literal the literal to check.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>literal != null</code>
+     * </ul></dd></dl>
+     */
+    protected boolean checkLiteral(String literal)
+        throws IOException
+    {
+        int length = literal.length();
+        for (int i = 0; i < length; i += 1) {
+            if (this.readChar() != literal.charAt(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    /**
+     * Reads a character from a reader.
+     */
+    protected char readChar()
+        throws IOException
+    {
+        if (this.charReadTooMuch != '\0') {
+            char ch = this.charReadTooMuch;
+            this.charReadTooMuch = '\0';
+            return ch;
+        } else {
+            int i = this.reader.read();
+            if (i < 0) {
+                throw this.unexpectedEndOfData();
+            } else if (i == 10) {
+                this.parserLineNr += 1;
+                return '\n';
+            } else {
+                return (char) i;
+            }
+        }
+    }
+
+
+    /**
+     * Scans an XML element.
+     *
+     * @param elt The element that will contain the result.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li>The first &lt; has already been read.
+     *     <li><code>elt != null</code>
+     * </ul></dd></dl>
+     */
+    protected void scanElement(XMLElement elt)
+        throws IOException
+    {
+        StringBuffer buf = new StringBuffer();
+        this.scanIdentifier(buf);
+        String name = buf.toString();
+        elt.setName(name);
+        char ch = this.scanWhitespace();
+        while ((ch != '>') && (ch != '/')) {
+            buf.setLength(0);
+            this.unreadChar(ch);
+            this.scanIdentifier(buf);
+            String key = buf.toString();
+            ch = this.scanWhitespace();
+            if (ch != '=') {
+                throw this.expectedInput("=");
+            }
+            this.unreadChar(this.scanWhitespace());
+            buf.setLength(0);
+            this.scanString(buf);
+            elt.setAttribute(key, buf);
+            ch = this.scanWhitespace();
+        }
+        if (ch == '/') {
+            ch = this.readChar();
+            if (ch != '>') {
+                throw this.expectedInput(">");
+            }
+            return;
+        }
+        buf.setLength(0);
+        ch = this.scanWhitespace(buf);
+        if (ch != '<') {
+            this.unreadChar(ch);
+            this.scanPCData(buf);
+        } else {
+            for (;;) {
+                ch = this.readChar();
+                if (ch == '!') {
+                    if (this.checkCDATA(buf)) {
+                        this.scanPCData(buf);
+                        break;
+                    } else {
+                        ch = this.scanWhitespace(buf);
+                        if (ch != '<') {
+                            this.unreadChar(ch);
+                            this.scanPCData(buf);
+                            break;
+                        }
+                    }
+                } else {
+                    buf.setLength(0);
+                    break;
+                }
+            }
+        }
+        if (buf.length() == 0) {
+            while (ch != '/') {
+                if (ch == '!') {
+                    ch = this.readChar();
+                    if (ch != '-') {
+                        throw this.expectedInput("Comment or Element");
+                    }
+                    ch = this.readChar();
+                    if (ch != '-') {
+                        throw this.expectedInput("Comment or Element");
+                    }
+                    this.skipComment();
+                } else {
+                    this.unreadChar(ch);
+                    XMLElement child = this.createAnotherElement();
+                    this.scanElement(child);
+                    elt.addChild(child);
+                }
+                ch = this.scanWhitespace();
+                if (ch != '<') {
+                    throw this.expectedInput("<");
+                }
+                ch = this.readChar();
+            }
+            this.unreadChar(ch);
+        } else {
+            if (this.ignoreWhitespace) {
+                elt.setContent(buf.toString().trim());
+            } else {
+                elt.setContent(buf.toString());
+            }
+        }
+        ch = this.readChar();
+        if (ch != '/') {
+            throw this.expectedInput("/");
+        }
+        this.unreadChar(this.scanWhitespace());
+        if (! this.checkLiteral(name)) {
+            throw this.expectedInput(name);
+        }
+        if (this.scanWhitespace() != '>') {
+            throw this.expectedInput(">");
+        }
+    }
+
+
+    /**
+     * Resolves an entity. The name of the entity is read from the reader.
+     * The value of the entity is appended to <code>buf</code>.
+     *
+     * @param buf Where to put the entity value.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li>The first &amp; has already been read.
+     *     <li><code>buf != null</code>
+     * </ul></dd></dl>
+     */
+    protected void resolveEntity(StringBuffer buf)
+        throws IOException
+    {
+        char ch = '\0';
+        StringBuffer keyBuf = new StringBuffer();
+        for (;;) {
+            ch = this.readChar();
+            if (ch == ';') {
+                break;
+            }
+            keyBuf.append(ch);
+        }
+        String key = keyBuf.toString();
+        if (key.charAt(0) == '#') {
+            try {
+                if (key.charAt(1) == 'x') {
+                    ch = (char) Integer.parseInt(key.substring(2), 16);
+                } else {
+                    ch = (char) Integer.parseInt(key.substring(1), 10);
+                }
+            } catch (NumberFormatException e) {
+                throw this.unknownEntity(key);
+            }
+            buf.append(ch);
+        } else {
+            char[] value = (char[]) this.entities.get(key);
+            if (value == null) {
+                throw this.unknownEntity(key);
+            }
+            buf.append(value);
+        }
+    }
+
+
+    /**
+     * Pushes a character back to the read-back buffer.
+     *
+     * @param ch The character to push back.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li>The read-back buffer is empty.
+     *     <li><code>ch != '\0'</code>
+     * </ul></dd></dl>
+     */
+    protected void unreadChar(char ch)
+    {
+        this.charReadTooMuch = ch;
+    }
+
+
+    /**
+     * Creates a parse exception for when an invalid valueset is given to
+     * a method.
+     *
+     * @param name The name of the entity.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException invalidValueSet(String name)
+    {
+        String msg = "Invalid value set (entity name = \"" + name + "\")";
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+
+    /**
+     * Creates a parse exception for when an invalid value is given to a
+     * method.
+     *
+     * @param name  The name of the entity.
+     * @param value The value of the entity.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     *     <li><code>value != null</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException invalidValue(String name,
+                                             String value)
+    {
+        String msg = "Attribute \"" + name + "\" does not contain a valid "
+                   + "value (\"" + value + "\")";
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+
+    /**
+     * Creates a parse exception for when the end of the data input has been
+     * reached.
+     */
+    protected XMLParseException unexpectedEndOfData()
+    {
+        String msg = "Unexpected end of data reached";
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+
+    /**
+     * Creates a parse exception for when a syntax error occured.
+     *
+     * @param context The context in which the error occured.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>context != null</code>
+     *     <li><code>context.length() &gt; 0</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException syntaxError(String context)
+    {
+        String msg = "Syntax error while parsing " + context;
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+
+    /**
+     * Creates a parse exception for when the next character read is not
+     * the character that was expected.
+     *
+     * @param charSet The set of characters (in human readable form) that was
+     *                expected.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>charSet != null</code>
+     *     <li><code>charSet.length() &gt; 0</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException expectedInput(String charSet)
+    {
+        String msg = "Expected: " + charSet;
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+    /**
+     * Creates a parse exception for when the next character read is not
+     * the character that was expected.
+     *
+     * @param charSet The set of characters (in human readable form) that was
+     *                expected.
+     * @param ch The character that was received instead.
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>charSet != null</code>
+     *     <li><code>charSet.length() &gt; 0</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException expectedInput(String charSet, char ch)
+    {
+        String msg = "Expected: '" + charSet +"'" + " but got: '" + ch + "'";
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+    /**
+     * Creates a parse exception for when an entity could not be resolved.
+     *
+     * @param name The name of the entity.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>name != null</code>
+     *     <li><code>name.length() &gt; 0</code>
+     * </ul></dd></dl>
+     */
+    protected XMLParseException unknownEntity(String name)
+    {
+        String msg = "Unknown or invalid entity: &" + name + ";";
+        return new XMLParseException(this.getName(), this.parserLineNr, msg);
+    }
+
+    /**
+     * Reads an xml file and removes the comments, leaving only relevant
+     * xml code.
+     *
+     * @param isr The reader of the InputStream containing the xml.
+     * @param pout The PipedOutputStream that will be receiving the filtered
+     *             xml file.
+     */
+    public void sanitizeInput(InputStreamReader isr, PipedOutputStream pout) {
+        try {
+            PrintStream out = new PrintStream(pout);
+
+            this.sanitizeCharReadTooMuch = '\0';
+            this.reader = isr;
+            this.parserLineNr = 0;
+            int newline = 2;
+	    char prev = ' ';
+
+            while(true) {
+                char ch;
+                if (this.sanitizeCharReadTooMuch != '\0') {
+                    ch = this.sanitizeCharReadTooMuch;
+                    this.sanitizeCharReadTooMuch = '\0';
+                } else {
+
+                    int i = this.reader.read();
+                    if (i == -1) {
+                        // no character in buffer, and nothing read
+                        out.flush();
+                        break;
+                    } else if (i == 10) {
+                        ch = '\n';
+                    } else {
+                        ch = (char) i;
+                    }
+                }
+
+                char next;
+                int i = this.reader.read();
+                if (i == -1) {
+                    // character in buffer and nothing read. write out
+                    // what's in the buffer
+                    out.print(ch);
+                    out.flush();
+                    if (JNLPRuntime.isDebug()) {
+                        if (ch == 10) {
+                            System.out.println();
+                            System.out.print("line: " + newline + " ");
+                            newline++;
+                        } else {
+                            System.out.print(ch);
+                        }
+                    }
+                    break;
+                } else if (i == 10) {
+                    next = '\n';
+                } else {
+                    next = (char) i;
+                }
+
+                this.sanitizeCharReadTooMuch = next;
+
+                // If the next char is a ? or !, then we've hit a special tag,
+                // and should skip it.
+                if (prev == '<' && (next == '!' || next == '?')) {
+                    this.skipSpecialTag(0);
+                    this.sanitizeCharReadTooMuch = '\0';
+                }
+                // Otherwise we haven't hit a comment, and we should write ch.
+                else {
+                    out.print(ch);
+                    if (JNLPRuntime.isDebug()) {
+                        if (ch == 10) {
+                            System.out.println();
+                            System.out.print("line: " + newline + " ");
+                            newline++;
+                        } else {
+                            System.out.print(ch);
+                        }
+                    }
+                }
+		prev = next;
+            }
+
+            out.close();
+            isr.close();
+        } catch (Exception e) {
+            // Print the stack trace here -- xml.parseFromReader() will
+            // throw the ParseException if something goes wrong.
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/nanoxml/XMLParseException.java	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,130 @@
+/* XMLParseException.java
+ *
+ * $Revision: 1.1 $
+ * $Date: 2002/08/03 04:05:32 $
+ * $Name:  $
+ *
+ * This file is part of NanoXML 2 Lite.
+ * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
+ *
+ * This software is provided 'as-is', without any express or implied warranty.
+ * In no event will the authors be held liable for any damages arising from the
+ * use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ *  1. The origin of this software must not be misrepresented; you must not
+ *     claim that you wrote the original software. If you use this software in
+ *     a product, an acknowledgment in the product documentation would be
+ *     appreciated but is not required.
+ *
+ *  2. Altered source versions must be plainly marked as such, and must not be
+ *     misrepresented as being the original software.
+ *
+ *  3. This notice may not be removed or altered from any source distribution.
+ *****************************************************************************/
+
+
+package net.sourceforge.nanoxml;
+
+
+/**
+ * An XMLParseException is thrown when an error occures while parsing an XML
+ * string.
+ * <P>
+ * $Revision: 1.1 $<BR>
+ * $Date: 2002/08/03 04:05:32 $<P>
+ *
+ * @see net.sourceforge.nanoxml.XMLElement
+ *
+ * @author Marc De Scheemaecker
+ * @version $Name:  $, $Revision: 1.1 $
+ */
+public class XMLParseException
+    extends RuntimeException
+{
+
+    /**
+     * Indicates that no line number has been associated with this exception.
+     */
+    public static final int NO_LINE = -1;
+
+
+    /**
+     * The line number in the source code where the error occurred, or
+     * <code>NO_LINE</code> if the line number is unknown.
+     *
+     * <dl><dt><b>Invariants:</b></dt><dd>
+     * <ul><li><code>lineNr &gt 0 || lineNr == NO_LINE</code>
+     * </ul></dd></dl>
+     */
+    private int lineNr;
+
+
+    /**
+     * Creates an exception.
+     *
+     * @param name    The name of the element where the error is located.
+     * @param message A message describing what went wrong.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>message != null</code>
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>getLineNr() => NO_LINE
+     * </ul></dd></dl><dl>
+     */
+    public XMLParseException(String name,
+                             String message)
+    {
+        super("XML Parse Exception during parsing of "
+              + ((name == null) ? "the XML definition"
+                                : ("a " + name + " element"))
+              + ": " + message);
+        this.lineNr = XMLParseException.NO_LINE;
+    }
+
+
+    /**
+     * Creates an exception.
+     *
+     * @param name    The name of the element where the error is located.
+     * @param lineNr  The number of the line in the input.
+     * @param message A message describing what went wrong.
+     *
+     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
+     * <ul><li><code>message != null</code>
+     *     <li><code>lineNr &gt; 0</code>
+     * </ul></dd></dl>
+     *
+     * <dl><dt><b>Postconditions:</b></dt><dd>
+     * <ul><li>getLineNr() => lineNr
+     * </ul></dd></dl><dl>
+     */
+    public XMLParseException(String name,
+                             int    lineNr,
+                             String message)
+    {
+        super("XML Parse Exception during parsing of "
+              + ((name == null) ? "the XML definition"
+                                : ("a " + name + " element"))
+              + " at line " + lineNr + ": " + message);
+        this.lineNr = lineNr;
+    }
+
+
+    /**
+     * Where the error occurred, or <code>NO_LINE</code> if the line number is
+     * unknown.
+     *
+     * @see net.sourceforge.nanoxml.XMLParseException#NO_LINE
+     */
+    public int getLineNr()
+    {
+        return this.lineNr;
+    }
+
+}
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/BasicService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface BasicService {
-
-  public java.net.URL getCodeBase();
-  public boolean isOffline();
-  public boolean showDocument(java.net.URL url);
-  public boolean isWebBrowserSupported();
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/ClipboardService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface ClipboardService {
-
-  public java.awt.datatransfer.Transferable getContents();
-  public void setContents(java.awt.datatransfer.Transferable contents);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface DownloadService {
-
-  public boolean isResourceCached(java.net.URL ref, java.lang.String version);
-  public boolean isPartCached(java.lang.String part);
-  public boolean isPartCached(java.lang.String[] parts);
-  public boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String part);
-  public boolean isExtensionPartCached(java.net.URL ref, java.lang.String version, java.lang.String[] parts);
-  public void loadResource(java.net.URL ref, java.lang.String version, DownloadServiceListener progress) throws java.io.IOException;
-  public void loadPart(java.lang.String part, DownloadServiceListener progress) throws java.io.IOException;
-  public void loadPart(java.lang.String[] parts, DownloadServiceListener progress) throws java.io.IOException;
-  public void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part, DownloadServiceListener progress) throws java.io.IOException;
-  public void loadExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts, DownloadServiceListener progress) throws java.io.IOException;
-  public void removeResource(java.net.URL ref, java.lang.String version) throws java.io.IOException;
-  public void removePart(java.lang.String part) throws java.io.IOException;
-  public void removePart(java.lang.String[] parts) throws java.io.IOException;
-  public void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String part) throws java.io.IOException;
-  public void removeExtensionPart(java.net.URL ref, java.lang.String version, java.lang.String[] parts) throws java.io.IOException;
-  public DownloadServiceListener getDefaultProgressWindow();
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/DownloadServiceListener.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface DownloadServiceListener {
-
-  public void progress(java.net.URL url, java.lang.String version, long readSoFar, long total, int overallPercent);
-  public void validating(java.net.URL url, java.lang.String version, long entry, long total, int overallPercent);
-  public void upgradingArchive(java.net.URL url, java.lang.String version, int patchPercent, int overallPercent);
-  public void downloadFailed(java.net.URL url, java.lang.String version);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/ExtensionInstallerService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface ExtensionInstallerService {
-
-  public java.lang.String getInstallPath();
-  public java.lang.String getExtensionVersion();
-  public java.net.URL getExtensionLocation();
-  public void hideProgressBar();
-  public void hideStatusWindow();
-  public void setHeading(java.lang.String heading);
-  public void setStatus(java.lang.String status);
-  public void updateProgress(int value);
-  public void installSucceeded(boolean needsReboot);
-  public void installFailed();
-  public void setJREInfo(java.lang.String platformVersion, java.lang.String jrePath);
-  public void setNativeLibraryInfo(java.lang.String path);
-  public java.lang.String getInstalledJRE(java.net.URL url, java.lang.String version);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileContents.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface FileContents {
-
-  public java.lang.String getName() throws java.io.IOException;
-  public java.io.InputStream getInputStream() throws java.io.IOException;
-  public java.io.OutputStream getOutputStream(boolean overwrite) throws java.io.IOException;
-  public long getLength() throws java.io.IOException;
-  public boolean canRead() throws java.io.IOException;
-  public boolean canWrite() throws java.io.IOException;
-  public JNLPRandomAccessFile getRandomAccessFile(java.lang.String mode) throws java.io.IOException;
-  public long getMaxLength() throws java.io.IOException;
-  public long setMaxLength(long maxlength) throws java.io.IOException;
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileOpenService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface FileOpenService {
-
-  public FileContents openFileDialog(java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException;
-  public FileContents[] openMultiFileDialog(java.lang.String pathHint, java.lang.String[] extensions) throws java.io.IOException;
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/FileSaveService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface FileSaveService {
-
-  public FileContents saveFileDialog(java.lang.String pathHint, java.lang.String[] extensions, java.io.InputStream stream, java.lang.String name) throws java.io.IOException;
-  public FileContents saveAsFileDialog(java.lang.String pathHint, java.lang.String[] extensions, FileContents contents) throws java.io.IOException;
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/JNLPRandomAccessFile.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface JNLPRandomAccessFile {
-
-  public void close() throws java.io.IOException;
-  public long length() throws java.io.IOException;
-  public long getFilePointer() throws java.io.IOException;
-  public int read() throws java.io.IOException;
-  public int read(byte[] b, int off, int len) throws java.io.IOException;
-  public int read(byte[] b) throws java.io.IOException;
-  public void readFully(byte[] b) throws java.io.IOException;
-  public void readFully(byte[] b, int off, int len) throws java.io.IOException;
-  public int skipBytes(int n) throws java.io.IOException;
-  public boolean readBoolean() throws java.io.IOException;
-  public byte readByte() throws java.io.IOException;
-  public int readUnsignedByte() throws java.io.IOException;
-  public short readShort() throws java.io.IOException;
-  public int readUnsignedShort() throws java.io.IOException;
-  public char readChar() throws java.io.IOException;
-  public int readInt() throws java.io.IOException;
-  public long readLong() throws java.io.IOException;
-  public float readFloat() throws java.io.IOException;
-  public double readDouble() throws java.io.IOException;
-  public java.lang.String readLine() throws java.io.IOException;
-  public java.lang.String readUTF() throws java.io.IOException;
-  public void seek(long pos) throws java.io.IOException;
-  public void setLength(long newLength) throws java.io.IOException;
-  public void write(int b) throws java.io.IOException;
-  public void write(byte[] b) throws java.io.IOException;
-  public void write(byte[] b, int off, int len) throws java.io.IOException;
-  public void writeBoolean(boolean v) throws java.io.IOException;
-  public void writeByte(int v) throws java.io.IOException;
-  public void writeShort(int v) throws java.io.IOException;
-  public void writeChar(int v) throws java.io.IOException;
-  public void writeInt(int v) throws java.io.IOException;
-  public void writeLong(long v) throws java.io.IOException;
-  public void writeFloat(float v) throws java.io.IOException;
-  public void writeDouble(double v) throws java.io.IOException;
-  public void writeBytes(java.lang.String s) throws java.io.IOException;
-  public void writeChars(java.lang.String s) throws java.io.IOException;
-  public void writeUTF(java.lang.String str) throws java.io.IOException;
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/PersistenceService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-package javax.jnlp;
-
-public interface PersistenceService {
-
-  public static final int CACHED = 0;
-  public static final int TEMPORARY = 1;
-  public static final int DIRTY = 2;
-
-  public long create(java.net.URL url, long maxsize) throws java.net.MalformedURLException, java.io.IOException;
-  public FileContents get(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException, java.io.FileNotFoundException;
-  public void delete(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
-  public java.lang.String[] getNames(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
-  public int getTag(java.net.URL url) throws java.net.MalformedURLException, java.io.IOException;
-  public void setTag(java.net.URL url, int tag) throws java.net.MalformedURLException, java.io.IOException;
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/PrintService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface PrintService {
-
-  public java.awt.print.PageFormat getDefaultPage();
-  public java.awt.print.PageFormat showPageFormatDialog(java.awt.print.PageFormat page);
-  public boolean print(java.awt.print.Pageable document);
-  public boolean print(java.awt.print.Printable painter);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManager.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-
-
-
-package javax.jnlp;
-
-import java.util.*;
-
-
-public final class ServiceManager {
-
-  private static ServiceManagerStub stub = null;
-
-  private static Map lookupTable = new HashMap(); // ensure lookup is idempotent
-
-  private ServiceManager() {
-    // says it can't be instantiated
-  }
-
-
-  public static java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException {
-    if (stub == null)
-      throw new UnavailableServiceException("service stub not set.");
-
-    synchronized(lookupTable) {
-      Object result = lookupTable.get(name);
-
-      if (result == null) {
-        result = stub.lookup(name);
-        if (result != null)
-          lookupTable.put(name, result);
-      }
-
-      if (result == null)
-        throw new UnavailableServiceException("service not available (stub returned null).");
-
-      return result;
-    }
-  }
-
-  public static java.lang.String[] getServiceNames() {
-    // should this return the required ones even though no stub??
-    if (stub == null)
-      return new String[0];
-
-    return stub.getServiceNames();
-  }
-
-  public static void setServiceManagerStub(ServiceManagerStub stub) {
-    if (ServiceManager.stub == null)
-      ServiceManager.stub = stub;
-  }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/ServiceManagerStub.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-
-
-package javax.jnlp;
-
-public interface ServiceManagerStub {
-
-  public java.lang.Object lookup(java.lang.String name) throws UnavailableServiceException;
-  public java.lang.String[] getServiceNames();
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/javax/jnlp/UnavailableServiceException.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-
-package javax.jnlp;
-
-public class UnavailableServiceException extends Exception {
-
-  public UnavailableServiceException() {
-    super();
-  }
-
-  public UnavailableServiceException(java.lang.String message) {
-    super(message);
-  }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/AppletDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The applet-desc element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.8 $
- */
-public class AppletDesc {
-
-    /** the applet name */
-    private String name;
-
-    /** the main class name and package */
-    private String mainClass;
-
-    /** the document base */
-    private URL documentBase;
-
-    /** the width */
-    private int width;
-
-    /** the height */
-    private int height;
-
-    /** the parameters */
-    private Map parameters;
-
-
-    /**
-     * Create an Applet descriptor.
-     * 
-     * @param name the applet name
-     * @param mainClass the main class name and package
-     * @param documentBase the document base
-     * @param width the width
-     * @param height the height
-     * @param parameters the parameters
-     */
-    public AppletDesc(String name, String mainClass, URL documentBase, int width, int height, Map parameters) {
-        this.name = name;
-        this.mainClass = mainClass;
-        this.documentBase = documentBase;
-        this.width = width;
-        this.height = height;
-        this.parameters = new HashMap(parameters);
-    }
-
-    /**
-     * Returns the applet name 
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the main class name 
-     */
-    public String getMainClass() {
-        return mainClass;
-    }
-
-    /**
-     * Returns the document base 
-     */
-    public URL getDocumentBase() {
-        return documentBase;
-    }
-
-    /**
-     * Returns the width 
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /** 
-     * Returns the height 
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /** 
-     * Returns the applet parameters 
-     */
-    public Map getParameters() {
-        return new HashMap(parameters);
-    }
-
-    /**
-     * Adds a parameter to the applet.  If the parameter already
-     * exists then it is overwritten with the new value.  Adding a
-     * parameter will have no effect on already-running applets
-     * launched from this JNLP file.
-     */
-    public void addParameter(String name, String value) {
-        parameters.put(name, value);
-    }
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ApplicationDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The application-desc element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $
- */
-public class ApplicationDesc {
-
-    /** the main class name and package */
-    private String mainClass;
-
-    /** the arguments */
-    private String arguments[];
-
-
-    /**
-     * Create an Application descriptor.
-     * 
-     * @param mainClass the main class name and package
-     * @param arguments the arguments
-     */
-    public ApplicationDesc(String mainClass, String arguments[]) {
-        this.mainClass = mainClass;
-        this.arguments = arguments;
-    }
-
-    /**
-     * Returns the main class name 
-     */
-    public String getMainClass() {
-        return mainClass;
-    }
-
-    /** 
-     * Returns the arguments
-     */
-    public String[] getArguments() {
-        return (String[]) arguments.clone();
-    }
-
-    /**
-     * Add an argument to the end of the arguments.
-     */
-    public void addArgument(String arg) {
-        ArrayList l = new ArrayList(Arrays.asList(arguments));
-        l.add(arg);
-
-        arguments = (String[]) l.toArray(arguments);
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ComponentDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The component-desc element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $
- */
-public class ComponentDesc {
-
-    // this is for completeness and in case of changes to spec for components.
-
-    /**
-     * Create a component descriptor.
-     */
-    public ComponentDesc() {
-    }
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/DefaultLaunchHandler.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp;
-
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-import java.awt.*;
-import java.util.*;
-import javax.swing.*;
-
-
-/**
- * This default implementation shows prints the exception to
- * stdout and if not in headless mode displays the exception in a
- * dialog.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.1 $
- */
-public class DefaultLaunchHandler implements LaunchHandler {
-
-    /**
-     * Called when the application could not be launched due to a
-     * fatal error, such as the inability to find the main class
-     * or non-parseable XML.
-     */
-    public void launchError(LaunchException exception) {
-        printMessage(exception);
-    }
-
-    /**
-     * Called when launching the application can not be launched
-     * due to an error that is not fatal.  For example a JNLP file
-     * that is not strictly correct yet does not necessarily
-     * prohibit the system from attempting to launch the
-     * application.
-     *
-     * @return true if the launch should continue, false to abort
-     */
-    public boolean launchWarning(LaunchException warning) {
-        printMessage(warning);
-        return true;
-    }
-
-    /**
-     * Called when a security validation error occurs while
-     * launching the application.
-     *
-     * @return true to allow the application to continue, false to stop it.
-     */
-    public boolean validationError(LaunchException security) {
-        printMessage(security);
-        return true;
-    }
-
-    /**
-     * Called when an application, applet, or installer has been
-     * launched successfully (the main method or applet start method
-     * returned normally).
-     *
-     * @param application the launched application instance
-     */
-    public void launchCompleted(ApplicationInstance application) {
-        //
-    }
-
-    /**
-     * Print a message to stdout.
-     */
-    protected void printMessage(LaunchException ex) {
-        StringBuffer result = new StringBuffer();
-        result.append("netx: ");
-        result.append(ex.getCategory());
-        if (ex.getSummary() != null) {
-            result.append(": ");
-            result.append(ex.getSummary());
-        }
-
-        if (JNLPRuntime.isDebug()) {
-            if (ex.getCause() != null)
-                ex.getCause().printStackTrace();
-            else
-                ex.printStackTrace();
-        }
-
-        Throwable causes[] = ex.getCauses();
-
-        for (int i=0; i < causes.length; i++) {
-            result.append(" (");
-            result.append(causes[i].getClass().getName());
-            result.append(" ");
-            result.append(causes[i].getMessage());
-            result.append(")");
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ExtensionDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-
-/**
- * The extension element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.8 $
- */
-public class ExtensionDesc {
-
-    /** the extension name */
-    private String name;
-
-    /** the required extension version */
-    private Version version;
-
-    /** the location of the extension JNLP file */
-    private URL location;
-    
-    /** the cookie string sent with resource requests */
-    private String cookieStr;
-
-    /** the JNLPFile the extension refers to */
-    private JNLPFile file;
-
-    /** map from ext-part to local part */
-    private Map extToPart = new HashMap();
-
-    /** eager ext parts */ 
-    private List eagerExtParts = new ArrayList();
-
-
-    /**
-     * Create an extention descriptor.
-     *
-     * @param name the extension name
-     * @param version the required version of the extention JNLPFile
-     * @param location the location of the extention JNLP file
-     */
-    public ExtensionDesc(String name, Version version, URL location, String cookieStr) {
-        this.name = name;
-        this.version = version;
-        this.location = location;
-        this.cookieStr = cookieStr;
-    }
-
-    /**
-     * Adds an extension part to be downloaded when the specified
-     * part of the main JNLP file is loaded.  The extension part
-     * will be downloaded before the application is launched if the
-     * lazy value is false or the part is empty or null.
-     *
-     * @param extPart the part name in the extension file
-     * @param part the part name in the main file
-     * @param lazy whether to load the part before launching
-     */
-    protected void addPart(String extPart, String part, boolean lazy) {
-        extToPart.put(extPart, part);
-
-        if (!lazy || part == null || part.length() == 0)
-            eagerExtParts.add(extPart);
-    }
-
-    /**
-     * Returns the parts in the extension JNLP file mapped to the
-     * part of the main file.
-     */
-    public String[] getExtensionParts(String thisPart) {
-
-        return null;
-    }
-
-    /**
-     * Returns the name of the extension.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the required version of the extension JNLP file.
-     */
-    public Version getVersion() {
-        return version;
-    }
-
-    /**
-     * Returns the location of the extension JNLP file.
-     */
-    public URL getLocation() {
-        return location;
-    }
-
-    /**
-     * Resolves the extension by creating a JNLPFile from the file
-     * specified by the extension's location property.
-     *
-     * @throws IOException if the extension JNLPFile could not be resolved.
-     * @throws ParseException if the extension JNLPFile could not be
-     * parsed or was not a component or installer descriptor.
-     */
-    public void resolve() throws ParseException, IOException {
-        if (file == null) {
-            file = new JNLPFile(location, cookieStr);
-
-            if (JNLPRuntime.isDebug())
-                System.out.println("Resolve: "+file.getInformation().getTitle());
-
-            // check for it being an extension descriptor
-            if (!file.isComponent() && !file.isInstaller())
-                throw new ParseException(JNLPRuntime.getMessage("JInvalidExtensionDescriptor", new Object[] {name, location} ));
-        }
-
-    }
-
-    /**
-     * Returns a JNLPFile for the extension, or null if the JNLP
-     * file has not been resolved.
-     */
-    public JNLPFile getJNLPFile() {
-        return file;
-    }
-    
-    /**
-     * Returns the cookie associated with this instance
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/IconDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The icon element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.8 $
- */
-public class IconDesc {
-
-    /** default icon */
-    public static final Object DEFAULT = "default";
-
-    /** selected icon */
-    public static final Object SELECTED = "selected";
-
-    /** disabled icon */
-    public static final Object DISABLED = "disabled";
-
-    /** rollover icon */
-    public static final Object ROLLOVER = "rollover";
-
-    /** splash icon */
-    public static final Object SPLASH = "splash";
-
-
-    /** the location of the icon */
-    private URL location;
-
-    /** the type of icon*/
-    private Object kind;
-
-    /** the width, or -1 if unknown*/
-    private int width;
-
-    /** the height, or -1 if unknown*/
-    private int height;
-
-    /** the depth, or -1 if unknown*/
-    private int depth;
-
-    /** the size, or -1 if unknown*/
-    private int size;
-
-
-    /**
-     * Creates an icon descriptor with the specified information.
-     *
-     * @param location the location of the icon 
-     * @param kind the type of icon
-     * @param width the width, or -1 if unknown
-     * @param height the height, or -1 if unknown
-     * @param depth the depth, or -1 if unknown
-     * @param size the size, or -1 if unknown
-     */
-    IconDesc(URL location, Object kind, int width, int height, int depth, int size) {
-        this.location = location;
-        this.kind = kind;
-        this.width = width;
-        this.height = height;
-        this.depth = depth;
-        this.size = size;
-    }
-
-    /**
-     * Returns the location of the icon.
-     */
-    public URL getLocation() { 
-        return location; 
-    }
-
-    /**
-     * Returns the icon type.
-     */
-    public Object getKind() { 
-        return kind; 
-    }
-
-    /**
-     * Returns the icon width or -1 if not specified in the
-     * JNLPFile.
-     */
-    public int getWidth() { 
-        return width; 
-    }
-
-    /**
-     * Returns the icon height or -1 if not specified in the
-     * JNLPFile.
-     */
-    public int getHeight() { 
-        return height; 
-    }
-
-    /**
-     * Returns the icon size or -1 if not specified in the JNLPFile.
-     */
-    public int getSize() { 
-        return size; 
-    }
-
-    /**
-     * Returns the icon depth or -1 if not specified in the
-     * JNLPFile.
-     */
-    public int getDepth() { 
-        return depth; 
-    }
-
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InformationDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.awt.Dimension;
-import java.net.*;
-import java.util.*;
-
-/**
- * The information element.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.9 $
- */
-public class InformationDesc {
-
-    // There is an understanding between this class and the parser
-    // that description and icon types are keyed by "icon-"+kind and
-    // "description-"+kind, and that other types are keyed by their
-    // specification name.
-
-    /** one-line description */
-    public static final Object ONE_LINE= "oneline";
-
-    /** short description */
-    public static final Object SHORT= "short";
-
-    /** tooltip description */
-    public static final Object TOOLTIP= "tooltip";
-
-    /** default description */
-    public static final Object DEFAULT = "default";
-
-    /** the locales for the information */
-    private Locale locales[];
-
-    /** the data as list of key,value pairs */
-    private List info;
-
-    /** the JNLPFile this information is for */
-    private JNLPFile jnlpFile;
-
-
-    /**
-     * Create an information element object.
-     *
-     * @param jnlpFile file that the information is for
-     * @param locale the the information is for
-     */
-    public InformationDesc(JNLPFile jnlpFile, Locale locales[]) {
-        this.jnlpFile = jnlpFile;
-        this.locales = locales;
-    }
-
-    /**
-     * Returns the application's title.
-     */
-    public String getTitle() {
-        return (String) getItem("title");
-    }
-
-    /**
-     * Returns the application's vendor.
-     */
-    public String getVendor() {
-        return (String) getItem("vendor");
-    }
-
-    /**
-     * Returns the application's homepage.
-     */
-    public URL getHomepage() {
-        return (URL)getItem("homepage");
-    }
-
-    /**
-     * Returns the default description for the application.
-     */
-    public String getDescription() {
-        String result = getDescription(DEFAULT);
-
-        // try to find any description if default is null
-        if (result == null)
-            result = getDescription(ONE_LINE);
-        if (result == null)
-            result = getDescription(SHORT);
-        if (result == null)
-            result = getDescription(TOOLTIP);
-
-        return result;
-    }
-
-    /**
-     * Returns the application's description of the specified type.
-     *
-     * @param kind one of Information.SHORT, Information.ONE_LINE,
-     * Information.TOOLTIP, Information.DEFAULT
-     */
-    public String getDescription(Object kind) {
-        String result = (String) getItem("description-"+kind);
-        if (result == null)
-            return (String) getItem("description-"+DEFAULT);
-        else
-            return result;
-    }
-
-    /**
-     * Returns the icons specified by the JNLP file.
-     *
-     * @param kind one of IconDesc.SELECTED, IconDesc.DISABLED,
-     * IconDesc.ROLLOVER, IconDesc.SPLASH, IconDesc.DEFAULT
-     * @return an array of zero of more IconDescs of the specified icon type
-     */
-    public IconDesc[] getIcons(Object kind) {
-        List icons = getItems("icon-"+kind);
-
-        return (IconDesc[]) icons.toArray(new IconDesc[icons.size()]);
-    };
-
-    /**
-     * Returns the URL of the icon closest to the specified size and
-     * kind.  This method will not return an icon smaller than the
-     * specified width and height unless there are no other icons
-     * available.
-     *
-     * @param kind the kind of icon to get
-     * @param width desired width of icon
-     * @param height desired height of icon
-     * @return the closest icon by size or null if no icons declared
-     */
-    public URL getIconLocation(Object kind, int width, int height) {
-        IconDesc icons[] = getIcons(kind);
-        if (icons.length == 0)
-            return null;
-
-        IconDesc best = null;
-        for (int i=0; i < icons.length; i++) {
-            if (icons[i].getWidth() >= width &&
-                icons[i].getHeight() >= height) {
-                if (best == null)
-                    best = icons[i];
-
-                if (icons[i].getWidth() <= best.getWidth() && // Use <= so last specified of
-                    icons[i].getHeight() <= best.getHeight()) // equivalent icons is chosen.
-                    best = icons[i];
-            }
-        }
-
-        if (best == null)
-            best = icons[0];
-
-        return best.getLocation();
-    }
-
-    /**
-     * Returns the locales for the information.
-     */
-    public Locale[] getLocales() {
-        return locales;
-    }
-
-    /**
-     * Returns the JNLPFile the information is for.
-     */
-    public JNLPFile getJNLPFile() {
-        return jnlpFile;
-    }
-
-    /**
-     * Returns whether offline execution allowed.
-     */
-    public boolean isOfflineAllowed() {
-        return null != getItem("offline-allowed");
-    }
-
-    /**
-     * Returns whether the resources specified in the JNLP file may
-     * be shared by more than one instance in the same JVM
-     * (JNLP extension).  This is an extension to the JNLP spec and
-     * will always return false for standard JNLP files.
-     */
-    public boolean isSharingAllowed() {
-        return null != getItem("sharing-allowed");
-    }
-
-    /**
-     * Returns the last item matching the specified key.
-     */
-    protected Object getItem(Object key) {
-        List items = getItems(key);
-        if (items.size() == 0)
-            return null;
-        else
-            return items.get( items.size()-1 );
-    }
-
-    /**
-     * Returns all items matching the specified key.
-     */
-    protected List getItems(Object key) {
-        if (info == null)
-            return Collections.EMPTY_LIST;
-
-        List result = new ArrayList();
-        for (int i=0; i < info.size(); i+=2)
-            if (info.get(i).equals(key))
-                result.add( info.get(i+1) );
-
-        return result;
-    }
-
-    /**
-     * Add an information item (description, icon, etc) under a
-     * specified key name.
-     */
-    protected void addItem(String key, Object value) {
-        if (info == null)
-            info = new ArrayList();
-
-        info.add(key);
-        info.add(value);
-    }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/InstallerDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The installer-desc element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $
- */
-public class InstallerDesc {
-
-    /** the main class name and package. */
-    private String mainClass;
-
-
-    /**
-     * Creates a installer descriptor.
-     *
-     * @param mainClass main class name and package
-     */
-    public InstallerDesc(String mainClass) {
-        this.mainClass = mainClass;
-    }
-
-    /**
-     * Returns the main class name and package.
-     */
-    public String getMainClass() {
-        return mainClass;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JARDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The JAR element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $
- */
-public class JARDesc {
-
-    /** the location of the JAR file */
-    private URL location;
-
-    /** the required JAR versions, or null */
-    private Version version;
-
-    /** the part name */
-    private String part;
-
-    /** whether to load the JAR on demand */
-    private boolean lazy;
-
-    /** whether the JAR contains the main class */
-    private boolean main;
-
-    /** whether the JAR contains native libraries */
-    private boolean nativeJar;
-    
-    /** whether the JAR can be cached */
-    private boolean cacheable;
-
-    /**
-     * Create a JAR descriptor.
-     *
-     * @param location the location of the JAR file
-     * @param version the required JAR versions, or null
-     * @param part the part name, or null
-     * @param lazy whether to load the JAR on demand
-     * @param main whether the JAR contains the main class
-     * @param nativeJam whether the JAR contains native libraries
-     */
-    public JARDesc(URL location, Version version, String part, boolean lazy, boolean main, boolean nativeJar, boolean cacheable) {
-        this.location = location;
-        this.version = version;
-        this.part = part;
-        this.lazy = lazy;
-        this.main = main;
-        this.nativeJar = nativeJar;
-        this.cacheable = cacheable;
-    }
-
-    /**
-     * Returns the URL of the JAR file.
-     */
-    public URL getLocation() {
-        return location;
-    }
-
-    /**
-     * Returns the required version of the JAR file.
-     */
-    public Version getVersion() {
-        return version;
-    }
-
-    /**
-     * Returns the part name, or null if not specified in the JNLP
-     * file.
-     */
-    public String getPart() {
-        return part;
-    }
-
-    /**
-     * Returns true if the JAR file contains native code
-     * libraries.
-     */
-    public boolean isNative() {
-        return nativeJar;
-    }
-
-    // these both are included in case the spec adds a new value,
-    // where !lazy would no longer imply eager.
-
-    /**
-     * Returns true if the JAR file should be downloaded before
-     * starting the application.
-     */
-    public boolean isEager() {
-        return !lazy;
-    }
-
-    /**
-     * Returns true if the JAR file should be downloaded on demand.
-     */
-    public boolean isLazy() {
-        return lazy;
-    }
-
-    /**
-     * Returns true if the JNLP file defined this JAR as containing
-     * the main class.  If no JARs were defined as the main JAR then
-     * the first JAR should be used to locate the main class.
-     *
-     * @see ResourcesDesc#getMainJAR
-     */
-    public boolean isMain() {
-        return main;
-    }
-    
-    /**
-     * Returns if this jar is cacheable
-     * 
-     * @return Whether or not this jar is cacheable
-     */
-    public boolean isCacheable() {
-        return cacheable;
-    }
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPFile.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,523 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * Provides methods to access the information in a Java Network
- * Launching Protocol (JNLP) file.  The Java Network Launching
- * Protocol specifies in an XML file the information needed to
- * load, cache, and run Java code over the network and in a secure
- * environment.<p>
- *
- * This class represents the overall information about a JNLP file
- * from the jnlp element.  Other information is accessed through
- * objects that represent the elements of a JNLP file
- * (information, resources, application-desc, etc).  References to
- * these objects are obtained by calling the getInformation,
- * getResources, getSecurity, etc methods.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.21 $ 
- */
-public class JNLPFile {
-
-    // todo: save the update policy, then if file was not updated
-    // then do not check resources for being updated.
-    //
-    // todo: make getLaunchInfo return a superclass that all the
-    // launch types implement (can get codebase from it).
-    //
-    // todo: currently does not filter resources by jvm version.
-    //
-    
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
-    /** the location this JNLP file was created from */
-    protected URL sourceLocation = null;
-
-    /** the network location of this JNLP file */
-    protected URL fileLocation;
-
-    /** the URL used to resolve relative URLs in the file */
-    protected URL codeBase;
-    
-    /** cookie string to send alongwith resource requests */
-    protected String cookieStr;
-
-    /** file version */
-    protected Version fileVersion;
-
-    /** spec version */
-    protected Version specVersion;
-
-    /** information */
-    protected List info;
-
-    /** resources */
-    protected List resources;
-
-    /** additional resources not in JNLP file (from command line) */
-    protected ResourcesDesc sharedResources = new ResourcesDesc(this, null, null, null);
-
-    /** the application description */
-    protected Object launchType;
-
-    /** the security descriptor */
-    protected SecurityDesc security;
-
-    /** the default OS */
-    protected Locale defaultLocale = null;
-
-    /** the default arch */
-    protected String defaultOS = null;
-
-    /** the default jvm */
-    protected String defaultArch = null;
-
-    { // initialize defaults if security allows
-        try {
-            defaultLocale = Locale.getDefault();
-            defaultOS = System.getProperty("os.name");
-            defaultArch = System.getProperty("os.arch");
-        }
-        catch (SecurityException ex) {
-            // null values will still work, and app can set defaults later
-        }
-    }
-    
-    /**
-     * Empty stub, allowing child classes to override the constructor
-     */
-    protected JNLPFile() {
-    }
-
-    /**
-     * Create a JNLPFile from a URL.
-     *
-     * @param location the location of the JNLP file
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    public JNLPFile(URL location, String cookieStr) throws IOException, ParseException {
-        this(location, cookieStr, false); // not strict
-    }
-
-    /**
-     * Create a JNLPFile from a URL checking for updates using the
-     * default policy.
-     *
-     * @param location the location of the JNLP file
-     * @param strict whether to enforce the spec when 
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    public JNLPFile(URL location, String cookieStr, boolean strict) throws IOException, ParseException {
-        this(location, cookieStr, strict, JNLPRuntime.getDefaultUpdatePolicy());
-    }
-
-    /**
-     * Create a JNLPFile from a URL checking for updates using the
-     * specified policy.
-     *
-     * @param location the location of the JNLP file
-     * @param strict whether to enforce the spec when 
-     * @param policy the update policy
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    public JNLPFile(URL location, String cookieStr, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        Node root = Parser.getRootNode(openURL(location, cookieStr, policy));
-        parse(root, strict, location);
-
-        this.fileLocation = location;
-        this.cookieStr = cookieStr;
-    }
-
-    /**
-     * Create a JNLPFile from an input stream.
-     *
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    public JNLPFile(InputStream input, boolean strict) throws ParseException {
-        parse(Parser.getRootNode(input), strict, null);
-    }
-
-    /**
-     * Create a JNLPFile from a character stream.
-     *
-     * @param input the stream
-     * @param strict whether to enforce the spec when 
-     * @throws IOException if an IO exception occurred
-     * @throws ParseException if the JNLP file was invalid
-     */
-    private JNLPFile(Reader input, boolean strict) throws ParseException {
-        // todo: now that we are using NanoXML we can use a Reader
-        //parse(Parser.getRootNode(input), strict, null);
-    }
-
-
-    /**
-     * Open the jnlp file URL from the cache if there, otherwise
-     * download to the cache.  Called from constructor.
-     */
-    private static InputStream openURL(URL location, String cookieStr, UpdatePolicy policy) throws IOException {
-        if (location == null || policy == null)
-            throw new IllegalArgumentException(R("NullParameter"));
-
-        try {
-            ResourceTracker tracker = new ResourceTracker(false); // no prefetch
-            tracker.addResource(location, cookieStr, null/*version*/, policy);
-
-            return tracker.getInputStream(location);
-        }
-        catch (Exception ex) {
-            throw new IOException(ex.getMessage());
-        }
-    }
-
-    /**
-     * Returns the JNLP specification versions supported.
-     */
-    public static Version getSupportedVersions() {
-        return Parser.getSupportedVersions();
-    }
-
-    /**
-     * Returns the JNLP file's title.  This method returns the same
-     * value as InformationDesc.getTitle().
-     */
-    public String getTitle() {
-        return getInformation().getTitle();
-    }
-
-    /**
-     * Returns the JNLP file's network location as specified in the
-     * JNLP file.
-     */
-    public URL getSourceLocation() {
-        return sourceLocation;
-    }
-
-    /**
-     * Returns the location of the file parsed to create the JNLP
-     * file, or null if it was not created from a URL.
-     */
-    public URL getFileLocation() {
-        return fileLocation;
-    }
-
-    /**
-     * Returns the JNLP file's version.
-     */
-    public Version getFileVersion() {
-        return fileVersion;
-    }
-
-    /**
-     * Returns the specification version required by the file.
-     */
-    public Version getSpecVersion() {
-        return specVersion;
-    }
-
-    /**
-     * Returns the codebase URL for the JNLP file.
-     */
-    public URL getCodeBase() {
-        return codeBase;
-    }
-
-    /**
-     * Returns the cookie string that will be send when resources for this file are requested 
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
-    
-    /**
-     * Returns the information section of the JNLP file as viewed
-     * through the default locale.
-     */
-    public InformationDesc getInformation() {
-        return getInformation(defaultLocale);
-    }
-
-    /**
-     * Returns the information section of the JNLP file as viewed
-     * through the specified locale.
-     */
-    public InformationDesc getInformation(final Locale locale) {
-        return new InformationDesc(this, new Locale[] {locale}) {
-            protected List getItems(Object key) {
-                List result = new ArrayList();
-
-                for (int i=0; i < info.size(); i++) {
-                    InformationDesc infoDesc = (InformationDesc) info.get(i);
-
-                    if (localMatches(locale, infoDesc.getLocales()))
-                        if (localMatches(locale, infoDesc.getLocales()))
-                            result.addAll(infoDesc.getItems(key) );
-                }
-
-                return result;
-            }
-        };
-    }
-
-    /**
-     * Returns the security section of the JNLP file.
-     */
-    public SecurityDesc getSecurity() {
-        return security;
-    }
-
-    /**
-     * Returns the resources section of the JNLP file as viewed
-     * through the default locale and the os.name and os.arch
-     * properties.
-     */
-    public ResourcesDesc getResources() {
-        return getResources(defaultLocale, defaultOS, defaultArch);
-    }
-
-    /**
-     * Returns the information section of the JNLP file for the
-     * specified locale, os, and arch.
-     */
-    public ResourcesDesc getResources(final Locale locale, final String os, final String arch) {
-        return new ResourcesDesc(this, new Locale[] {locale}, new String[] {os}, new String[] {arch}) {
-            public List getResources(Class launchType) {
-                List result = new ArrayList();
-
-                for (int i=0; i < resources.size(); i++) {
-                    ResourcesDesc rescDesc = (ResourcesDesc) resources.get(i);
-
-                    if (localMatches(locale, rescDesc.getLocales())
-                        && stringMatches(os, rescDesc.getOS())
-                        && stringMatches(arch, rescDesc.getArch()))
-                        result.addAll(rescDesc.getResources(launchType) );
-                }
-
-                result.addAll(sharedResources.getResources(launchType));
-
-                return result;
-            }
-
-            public void addResource(Object resource) {
-                // todo: honor the current locale, os, arch values
-                sharedResources.addResource(resource);
-            }
-        };
-    }
-
-    /**
-     * Returns an object of one of the following types: AppletDesc,
-     * ApplicationDesc, InstallerDesc, and ComponentDesc.
-     */
-    public Object getLaunchInfo() {
-        return launchType;
-    }
-
-    /**
-     * Returns the launch information for an applet.
-     *
-     * @throws UnsupportedOperationException if there is no applet information
-     */
-    public AppletDesc getApplet() {
-        if (!isApplet())
-            throw new UnsupportedOperationException(R("JNotApplet"));
-
-        return (AppletDesc) launchType;
-    }
-
-    /**
-     * Returns the launch information for an application.
-     *
-     * @throws UnsupportedOperationException if there is no application information
-     */
-    public ApplicationDesc getApplication() {
-        if (!isApplication())
-            throw new UnsupportedOperationException(R("JNotApplication"));
-
-        return (ApplicationDesc) launchType;
-    }
-
-    /**
-     * Returns the launch information for a component.
-     *
-     * @throws UnsupportedOperationException if there is no component information
-     */
-    public ComponentDesc getComponent() {
-        if (!isComponent())
-            throw new UnsupportedOperationException(R("JNotComponent"));
-
-        return (ComponentDesc) launchType;
-    }
-
-    /**
-     * Returns the launch information for an installer.
-     *
-     * @throws UnsupportedOperationException if there is no installer information
-     */
-    public InstallerDesc getInstaller() {
-        if (!isInstaller())
-            throw new UnsupportedOperationException(R("NotInstaller"));
-
-        return (InstallerDesc) launchType;
-    }
-
-    /** 
-     * Returns whether the lauch descriptor describes an Applet.
-     */
-    public boolean isApplet() {
-        return launchType instanceof AppletDesc;
-    }
-
-    /** 
-     * Returns whether the lauch descriptor describes an Application.
-     */
-    public boolean isApplication() {
-        return launchType instanceof ApplicationDesc;
-    }
-
-    /** 
-     * Returns whether the lauch descriptor describes a Component.
-     */
-    public boolean isComponent() {
-        return launchType instanceof ComponentDesc;
-    }
-
-    /** 
-     * Returns whether the lauch descriptor describes an Installer.
-     */
-    public boolean isInstaller() {
-        return launchType instanceof InstallerDesc;
-    }
-
-    /**
-     * Sets the default view of the JNLP file returned by
-     * getInformation, getResources, etc.  If unset, the defaults
-     * are the properties os.name, os.arch, and the locale returned
-     * by Locale.getDefault().
-     */
-    public void setDefaults(String os, String arch, Locale locale) {
-        defaultOS = os;
-        defaultArch = arch;
-        defaultLocale = locale;
-    }
-
-
-    /**
-     * Returns whether a locale is matched by one of more other
-     * locales.  Only the non-empty language, country, and variant
-     * codes are compared; for example, a requested locale of
-     * Locale("","","") would always return true.
-     *
-     * @param requested the local
-     * @param available the available locales
-     * @return true if requested matches any of available, or if
-     * available is empty or null.
-     */
-    private boolean localMatches(Locale requested, Locale available[]) {
-        if (available == null || available.length == 0)
-            return true;
-
-        for (int i=0; i < available.length; i++) {
-            String language = requested.getLanguage(); // "" but never null
-            String country = requested.getCountry();
-            String variant = requested.getVariant();
-
-            if (!"".equals(language) && !language.equalsIgnoreCase(available[i].getLanguage()))
-                continue;
-            if (!"".equals(country) && !country.equalsIgnoreCase(available[i].getCountry()))
-                continue;
-            if (!"".equals(variant) && !variant.equalsIgnoreCase(available[i].getVariant()))
-                continue;
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns whether the string is a prefix for any of the strings
-     * in the specified array.
-     *
-     * @param prefixStr the prefix string
-     * @param available the strings to test
-     * @return true if prefixStr is a prefix of any strings in
-     * available, or if available is empty or null.
-     */
-    private boolean stringMatches(String prefixStr, String available[]) {
-        if (available == null || available.length == 0)
-            return true;
-
-        for (int i=0; i < available.length; i++)
-            if (available[i] != null && available[i].startsWith(prefixStr))
-                return true;
-
-        return false;
-    }
-
-    /**
-     * Initialize the JNLPFile fields. Private because it's called
-     * from the constructor.
-     *
-     * @param root the root node
-     * @param strict whether to enforce the spec when 
-     * @param location the file location or null
-     */
-    private void parse(Node root, boolean strict, URL location) throws ParseException {
-        try {
-            //if (location != null)
-            //  location = new URL(location, "."); // remove filename
-
-            Parser parser = new Parser(this, location, root, strict, true); // true == allow extensions
-
-            // JNLP tag information
-            specVersion = parser.getSpecVersion();
-            fileVersion = parser.getFileVersion();
-            codeBase = parser.getCodeBase();
-            sourceLocation = parser.getFileLocation();
-
-            info = parser.getInfo(root);
-            resources = parser.getResources(root, false); // false == not a j2se resources section
-            launchType = parser.getLauncher(root);
-            security = parser.getSecurity(root);
-        }
-        catch (ParseException ex) {
-            throw ex;
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            throw new RuntimeException(ex.toString());
-        }
-    }
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JNLPSplashScreen.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-package net.sourceforge.jnlp;
-
-import java.awt.Dimension;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Image;
-import java.awt.Insets;
-import java.awt.Toolkit;
-import java.io.IOException;
-import java.net.URL;
-
-import javax.imageio.ImageIO;
-import javax.swing.JFrame;
-
-import net.sourceforge.jnlp.cache.ResourceTracker;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-public class JNLPSplashScreen extends JFrame {
-
-    String applicationTitle;
-    String applicationVendor;
-
-    ResourceTracker resourceTracker;
-
-    URL splashImageUrl;
-    Image splashImage;
-
-    public JNLPSplashScreen(ResourceTracker resourceTracker,
-            String applicationTitle, String applicationVendor) {
-
-        // If the JNLP file does not contain any icon images, the splash image
-        // will consist of the application's title and vendor, as taken from the
-        // JNLP file.
-
-        this.resourceTracker = resourceTracker;
-        this.applicationTitle = applicationTitle;
-        this.applicationVendor = applicationVendor;
-
-    }
-
-    public void setSplashImageURL(URL url) {
-        splashImageUrl = url;
-        splashImage = null;
-        try {
-            splashImage = ImageIO.read(resourceTracker
-                    .getCacheFile(splashImageUrl));
-        } catch (IOException e) {
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Error loading splash image: " + url);
-            }
-            splashImage = null;
-            return;
-        } catch (IllegalArgumentException argumentException) {
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Error loading splash image: " + url);
-            }
-            splashImage = null;
-            return;
-        }
-
-        correctSize();
-    }
-
-    public boolean isSplashScreenValid() {
-        return (splashImage != null);
-    }
-    
-    private void correctSize() {
-
-        Insets insets = getInsets();
-        int minimumWidth = splashImage.getWidth(null) + insets.left
-                + insets.right;
-        int minimumHeight = splashImage.getHeight(null) + insets.top
-                + insets.bottom;
-        setMinimumSize(new Dimension(minimumWidth, minimumHeight));
-
-        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-        setLocation((screenSize.width - minimumWidth) / 2,
-                (screenSize.height - minimumHeight) / 2);
-    }
-
-    @Override
-    public void paint(Graphics g) {
-        if (splashImage == null) {
-            return;
-        }
-
-        correctSize();
-        Graphics2D g2 = (Graphics2D) g;
-        g2.drawImage(splashImage, getInsets().left, getInsets().top, null);
-
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/JREDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The J2SE element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $
- */
-public class JREDesc {
-
-    /** the platform version or the product version if location is not null */
-    private Version version;
-
-    /** the location of a JRE product or null */
-    private URL location;
-
-    /** inital heap size */
-    private long initialHeapSize;
-
-    /** maximum head size */
-    private long maximumHeapSize;
-
-    /** list of ResourceDesc objects */
-    private List resources;
-
-
-    /**
-     * Create a JRE descriptor.
-     *
-     * @param version the platform version or the product version
-     * if location is not null
-     * @param location the location of a JRE product or null
-     * @param initialHeapSize inital heap size
-     * @param maximumHeadSize maximum head size
-     * @param resources list of ResourceDesc objects
-     */
-    public JREDesc(Version version, URL location, String initialHeapSize, String maximumHeapSize, List resources) {
-        this.version = version;
-        this.location = location;
-        this.initialHeapSize = heapToLong(initialHeapSize);
-        this.maximumHeapSize = heapToLong(maximumHeapSize);
-        this.resources = resources;
-    }
-
-    /**
-     * Returns the JRE version.  Use isPlatformVersion to
-     * determine if this version corresponds to a platform or
-     * product version.
-     */
-    public Version getVersion() {
-        return version;
-    }
-
-    /**
-     * Returns true if the JRE version is a Java platform version
-     * (java.specification.version property) or false if it is a
-     * product version (java.version property).
-     */
-    public boolean isPlatformVersion() {
-        return getLocation() == null;
-    }
-
-    /**
-     * Returns the JRE version string.
-     */
-    public URL getLocation() {
-        return location;
-    }
-
-    /**
-     * Returns the maximum heap size in bytes.
-     */
-    public long getMaximumHeapSize() {
-        return maximumHeapSize;
-    }
-
-    /**
-     * Returns the initial heap size in bytes.
-     */
-    public long getInitialHeapSize() {
-        return initialHeapSize;
-    }
-
-    /**
-     * Returns the resources defined for this JRE.
-     */
-    public List getResourcesDesc() {
-        return resources;
-    }
-
-    /**
-     * Convert a heap size description string to a long value
-     * indicating the heap min/max size.
-     */
-    static private long heapToLong(String heapSize) {
-        // need to implement for completeness even though not used in netx
-        return -1;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchException.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.util.*;
-
-/**
- * Thrown when a JNLP application, applet, or installer could not
- * be created.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.9 $
- */
-public class LaunchException extends Exception {
-
-    /** the original exception */
-    private Throwable cause = null;
-
-    /** the file being launched */
-    private JNLPFile file;
-
-    /** the category of the exception */
-    private String category;
-
-    /** summary */
-    private String summary;
-
-    /** description of the action that was taking place */
-    private String description;
-
-    /** severity of the warning/error */
-    private String severity;
-
-
-    /**
-     * Creates a LaunchException without detail message.
-     */
-    public LaunchException(JNLPFile file, Exception cause, String severity, String category, String summary, String description) {
-        super(severity + ": " + category  + ": "+ summary);
-
-        this.file = file;
-        this.category = category;
-        this.summary = summary;
-        this.description = description;
-        this.severity = severity;
-
-        // replace with setCause when no longer 1.3 compatible
-        this.cause = cause;
-    }
-
-    /**
-     * Creates a LaunchException with a cause. 
-     */
-    public LaunchException(Throwable cause) {
-        this(cause.getMessage());
-
-        // replace with setCause when no longer 1.3 compatible
-        this.cause = cause;
-    }
-
-    /**
-     * Creates a LaunchException with a cause and detail message
-     */
-    public LaunchException(String message, Throwable cause) {
-        this(message+": "+cause.getMessage());
-
-        // replace with setCause when no longer 1.3 compatible
-        this.cause = cause;
-    }
-
-    /**
-     * Constructs a LaunchException with the specified detail
-     * message.
-     * 
-     * @param message the detail message
-     */
-    public LaunchException(String message) {
-        super(message);
-    }
-
-    /**
-     * Returns the JNLPFile being launched.
-     */
-    public JNLPFile getFile() {
-        return file;
-    }
-
-    /**
-     * Returns the category string, a short description of the
-     * exception suitable for displaying in a window title.
-     */
-    public String getCategory() {
-        return category;
-    }
-
-    /**
-     * Returns a one-sentence summary of the problem.
-     */
-    public String getSummary() {
-        return summary;
-    }
-
-    /**
-     * Return a description of the exception and the action being
-     * performed when the exception occurred.
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Returns a short description of the severity of the problem.
-     */
-    public String getSeverity() {
-        return severity;
-    }
-
-    /**
-     * Return the cause of the launch exception or null if there
-     * is no cause exception.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Returns the causes for this exception.  This method is
-     * useful on JRE 1.3 since getCause is not a standard method,
-     * and will be removed once netx no longer supports 1.3.
-     */
-    public Throwable[] getCauses() {
-        ArrayList result = new ArrayList();
-
-        Reflect r = new Reflect();
-        Throwable cause = this.cause;
-
-        while (cause != null) {
-            result.add(cause);
-            cause = (Throwable) r.invoke(cause, "getCause");
-        }
-
-        return (Throwable[]) result.toArray(new Throwable[0]);
-    }
-
-    /**
-     * Print the stack trace and the cause exception (1.3
-     * compatible)
-     */
-    public void printStackTrace(PrintStream stream) {
-        super.printStackTrace(stream);
-
-        if (cause != null) {
-            stream.println("Caused by: ");
-            cause.printStackTrace(stream);
-        }
-    }
-
-    /**
-     * Print the stack trace and the cause exception (1.3
-     * compatible)
-     */
-    public void printStackTrace(PrintWriter stream) {
-        super.printStackTrace(stream);
-
-        if (cause != null) {
-            stream.println("Caused by: ");
-            cause.printStackTrace(stream);
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/LaunchHandler.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp;
-
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * This optional interface is used to handle conditions that occur
- * while launching JNLP applications, applets, and installers.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.9 $
- */
-public interface LaunchHandler {
-
-    /**
-     * Called when the application could not be launched due to a
-     * fatal error, such as the inability to find the main class or
-     * non-parseable XML.
-     */
-    public void launchError(LaunchException exception);
-
-    /**
-     * Called when launching the application can not be launched due
-     * to an error that is not fatal.  For example a JNLP file that
-     * is not strictly correct yet does not necessarily prohibit the
-     * system from attempting to launch the application.
-     *
-     * @return true if the launch should continue, false to abort
-     */
-    public boolean launchWarning(LaunchException warning);
-
-    /**
-     * Called when a security validation error occurs while
-     * launching the application.
-     *
-     * @return true to allow the application to continue, false to stop it.
-     */
-    public boolean validationError(LaunchException security);
-    // this method will probably be replaced when real security
-    // controller is in place.
-
-    /**
-     * Called when an application, applet, or installer has been
-     * launched successfully (the main method or applet start method
-     * returned normally).
-     *
-     * @param application the launched application instance
-     */
-    public void launchCompleted(ApplicationInstance application); 
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Launcher.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,710 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.applet.*;
-import java.awt.Container;
-import java.io.*;
-import java.net.*;
-import java.util.jar.JarFile;
-import java.lang.reflect.*;
-
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * Launches JNLPFiles either in the foreground or background.<p>
- *
- * An optional LaunchHandler can be specified that is notified of
- * warning and error condition while launching and that indicates
- * whether a launch may proceed after a warning has occurred.  If
- * specified, the LaunchHandler is notified regardless of whether
- * the file is launched in the foreground or background.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.22 $ 
- */
-public class Launcher {
-
-    // defines class Launcher.BgRunner, Launcher.TgThread
-
-    /** shortcut for resources */
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
-    /** shared thread group */
-    private static final ThreadGroup mainGroup = new ThreadGroup(R("LAllThreadGroup"));
-
-    /** the handler */
-    private LaunchHandler handler = null;
-
-    /** the update policy */
-    private UpdatePolicy updatePolicy = JNLPRuntime.getDefaultUpdatePolicy();
-
-    /** whether to create an AppContext (if possible) */
-    private boolean context = true;
-
-    /** If the application should call System.exit on fatal errors */
-    private boolean exitOnFailure = true;
-
-    /**
-     * Create a launcher with the runtime's default update policy
-     * and launch handler.
-     */
-    public Launcher() {
-        this(null, null);
-
-        if (handler == null)
-            handler = JNLPRuntime.getDefaultLaunchHandler();
-    }
-    
-    /**
-     * Create a launcher with the runtime's default update policy
-     * and launch handler.
-     * 
-     * @param exitOnError Exit if there is an error (usually default, but false when being used from the plugin)
-     */
-    public Launcher(boolean exitOnFailure) {
-        this(null, null);
-
-        if (handler == null)
-            handler = JNLPRuntime.getDefaultLaunchHandler();
-        
-        this.exitOnFailure = exitOnFailure;
-    }
-
-    /**
-     * Create a launcher with the specified handler and the
-     * runtime's default update policy.
-     *
-     * @param handler the handler to use or null for no handler.
-     */
-    public Launcher(LaunchHandler handler) {
-        this(handler, null);
-    }
-
-    /**
-     * Create a launcher with an optional handler using the
-     * specified update policy and launch handler.
-     *
-     * @param handler the handler to use or null for no handler.
-     * @param policy the update policy to use or null for default policy.
-     */
-    public Launcher(LaunchHandler handler, UpdatePolicy policy) {
-        if (policy == null)
-            policy = JNLPRuntime.getDefaultUpdatePolicy();
-
-        this.handler = handler;
-        this.updatePolicy = policy;
-    }
-
-    /**
-     * Sets the update policy used by launched applications.
-     */
-    public void setUpdatePolicy(UpdatePolicy policy) {
-        if (policy == null)
-            throw new IllegalArgumentException(R("LNullUpdatePolicy"));
-
-        this.updatePolicy = policy;
-    }
-
-    /**
-     * Returns the update policy used when launching applications.
-     */
-    public UpdatePolicy getUpdatePolicy() {
-        return updatePolicy;
-    }
-
-    /**
-     * Sets whether to launch the application in a new AppContext
-     * (a separate event queue, look and feel, etc).  If the
-     * sun.awt.SunToolkit class is not present then this method
-     * has no effect.  The default value is true.
-     */
-    public void setCreateAppContext(boolean context) {
-        this.context = context;
-    }
-
-    /**
-     * Returns whether applications are launched in their own
-     * AppContext.
-     */
-    public boolean isCreateAppContext() {
-        return this.context;
-    }
-
-    /**
-     * Launches a JNLP file by calling the launch method for the
-     * appropriate file type.  The application will be started in
-     * a new window.
-     *
-     * @param file the JNLP file to launch
-     * @return the application instance
-     * @throws LaunchException if an error occurred while launching (also sent to handler)
-     */
-    public ApplicationInstance launch(JNLPFile file) throws LaunchException {
-        return launch(file, null);
-    }
-
-    /**
-     * Launches a JNLP file inside the given container if it is an applet.  Specifying a
-     * container has no effect for Applcations and Installers.
-     *
-     * @param file the JNLP file to launch
-     * @param cont the container in which to place the application, if it is an applet
-     * @return the application instance
-     * @throws LaunchException if an error occurred while launching (also sent to handler)
-     */
-    public ApplicationInstance launch(JNLPFile file, Container cont) throws LaunchException {
-        TgThread tg;
-
-        if (file instanceof PluginBridge && cont != null)
-        	tg = new TgThread(file, cont, true);
-        else if (cont == null)
-        	tg = new TgThread(file);
-        else
-        	tg = new TgThread(file, cont);
-
-        tg.start();
-
-        try {
-            tg.join();
-        }
-        catch (InterruptedException ex) {
-			//By default, null is thrown here, and the message dialog is shown.
-            throw launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCSystem"), R("LThreadInterrupted"), R("LThreadInterruptedInfo")));
-        }
-
-        if (tg.getException() != null)
-            throw tg.getException(); // passed to handler when first created
-
-        if (handler != null)
-            handler.launchCompleted(tg.getApplication());
-
-        return tg.getApplication();
-    }    
-
-    /**
-     * Launches a JNLP file by calling the launch method for the
-     * appropriate file type.
-     *
-     * @param location the URL of the JNLP file to launch
-     * @throws LaunchException if there was an exception 
-     * @return the application instance
-     */
-    public ApplicationInstance launch(URL location) throws LaunchException {
-        return launch(toFile(location));
-    }
-
-    /** 
-     * Launches a JNLP file by calling the launch method for the
-     * appropriate file type in a different thread.
-     *
-     * @param file the JNLP file to launch
-     */
-    public void launchBackground(JNLPFile file) {
-        BgRunner runner = new BgRunner(file, null);
-        new Thread(runner).start();
-    }
-
-    /**
-     * Launches the JNLP file at the specified location in the
-     * background by calling the launch method for its file type.
-     *
-     * @param location the location of the JNLP file
-     */
-    public void launchBackground(URL location) {
-        BgRunner runner = new BgRunner(null, location);
-        new Thread(runner).start();
-    }
-
-    /**
-     * Launches the JNLP file in a new JVM instance.  The launched
-     * application's output is sent to the system out and it's
-     * standard input channel is closed.
-     *
-     * @param file the JNLP file to launch
-     * @throws LaunchException if there was an exception 
-     */
-    public void launchExternal(JNLPFile file) throws LaunchException {
-        if (file.getSourceLocation() != null)
-            launchExternal(file.getSourceLocation());
-        else if (file.getFileLocation() != null)
-            launchExternal(file.getFileLocation());
-        else
-            launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo")));
-    }
-
-    /**
-     * Launches the JNLP file at the specified location in a new JVM
-     * instance.  The launched application's output is sent to the
-     * system out and it's standard input channel is closed.
-     *
-     * @param location the URL of the JNLP file to launch
-     * @throws LaunchException if there was an exception 
-     */
-    public void launchExternal(URL location) throws LaunchException {
-        try {
-            URL cs = Launcher.class.getProtectionDomain().getCodeSource().getLocation();
-            if (JNLPRuntime.isDebug())
-                System.out.println("netx.jar path: "+cs.getPath());
-
-            File netxFile = new File(cs.getPath());
-            if (!netxFile.exists())
-                throw launchError(new LaunchException(null, null, R("LSFatal"), R("LCExternalLaunch"), R("LNetxJarMissing"), R("LNetxJarMissingInfo")));
-
-            String command[] = {
-                "javaw",
-                "-jar",
-                netxFile.toString(),
-                "-jnlp",
-                location.toString(),
-                "-verbose",
-            };
-
-            Process p = Runtime.getRuntime().exec(command);
-            new StreamEater(p.getErrorStream()).start();
-            new StreamEater(p.getInputStream()).start();
-            p.getOutputStream().close();
-
-        }
-        catch (NullPointerException ex) {
-            throw launchError(new LaunchException(null, null, R("LSFatal"), R("LCExternalLaunch"), R("LNetxJarMissing"), R("LNetxJarMissingInfo")));
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(null, ex, R("LSFatal"), R("LCExternalLaunch"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
-        }
-    }
-
-    /**
-     * Returns the JNLPFile for the URL, with error handling.
-     */
-    private JNLPFile toFile(URL location) throws LaunchException {
-        try { 
-            JNLPFile file = null;
-
-            try {
-                file = new JNLPFile(location, null, true, updatePolicy); // strict
-            }
-            catch (ParseException ex) {
-                file = new JNLPFile(location, null, false, updatePolicy);
-
-                // only here if strict failed but lax did not fail 
-                LaunchException lex = 
-                    launchWarning(new LaunchException(file, ex, R("LSMinor"), R("LCFileFormat"), R("LNotToSpec"), R("LNotToSpecInfo")));
-
-                if (lex != null)
-                    throw lex;
-            }
-
-            return file;
-        }
-        catch (Exception ex) {
-            if (ex instanceof LaunchException)
-                throw (LaunchException) ex; // already sent to handler when first thrown
-            else  // IO and Parse
-                throw launchError(new LaunchException(null, ex, R("LSFatal"), R("LCReadError"), R("LCantRead"), R("LCantReadInfo")));
-        }
-    }
-
-    /** 
-     * Launches a JNLP application.  This method should be called
-     * from a thread in the application's thread group.
-     */
-    protected ApplicationInstance launchApplication(JNLPFile file) throws LaunchException {
-        if (!file.isApplication())
-            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplication"), R("LNotApplicationInfo")));
-
-        try {
-            final int preferredWidth = 500;
-            final int preferredHeight = 400;
-            JNLPSplashScreen splashScreen = null;
-            URL splashImageURL = file.getInformation().getIconLocation(
-                    IconDesc.SPLASH, preferredWidth, preferredHeight);
-            if (splashImageURL != null) {
-                ResourceTracker resourceTracker = new ResourceTracker(true);
-                resourceTracker.addResource(splashImageURL, "SPLASH", file.getFileVersion(), updatePolicy);
-                splashScreen = new JNLPSplashScreen(resourceTracker, null, null);
-                splashScreen.setSplashImageURL(splashImageURL);
-                if (splashScreen.isSplashScreenValid()) {
-                    splashScreen.setVisible(true);
-                }
-            }
-
-
-            ApplicationInstance app = createApplication(file);
-            app.initialize();
-
-            String mainName = file.getApplication().getMainClass();
-            
-            // When the application-desc field is empty, we should take a 
-            // look at the main jar for the main class.
-            if (mainName == null) {
-            	JARDesc mainJarDesc = file.getResources().getMainJAR();
-            	File f = CacheUtil.getCacheFile(mainJarDesc.getLocation(), null);
-            	if (f != null) {
-            		JarFile mainJar = new JarFile(f);
-            		mainName = mainJar.getManifest().
-            			getMainAttributes().getValue("Main-Class");
-            	}
-            }
-            
-            if (mainName == null)
-            	throw launchError(new LaunchException(file, null, 
-            		R("LSFatal"), R("LCClient"), R("LCantDetermineMainClass") , 
-            		R("LCantDetermineMainClassInfo")));
-            
-            Class mainClass = app.getClassLoader().loadClass(mainName);
-
-            Method main = mainClass.getDeclaredMethod("main", new Class[] {String[].class} );
-            String args[] = file.getApplication().getArguments();
-
-            // required to make some apps work right
-            Thread.currentThread().setContextClassLoader(app.getClassLoader());
-
-            if (splashScreen != null) {
-                if (splashScreen.isSplashScreenValid()) {
-                    splashScreen.setVisible(false);
-                }
-                splashScreen.dispose();
-            }
-
-            main.invoke(null, new Object[] { args } );
-
-            return app;
-        }
-        catch (LaunchException lex) {
-            throw launchError(lex);
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
-        }
-    }
-
-    /** 
-     * Launches a JNLP applet. This method should be called from a
-     * thread in the application's thread group.<p>
-     *
-     * The enableCodeBase parameter adds the applet's codebase to
-     * the locations searched for resources and classes.  This can
-     * slow down the applet loading but allows browser-style applets
-     * that don't use JAR files exclusively to be run from a applet
-     * JNLP file.  If the applet JNLP file does not specify any
-     * resources then the code base will be enabled regardless of
-     * the specified value.<p>
-     *
-     * @param file the JNLP file
-     * @param enableCodeBase whether to add the codebase URL to the classloader
-     */
-    protected ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
-        if (!file.isApplet())
-            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo")));
-
-        try {
-            AppletInstance applet = createApplet(file, enableCodeBase, cont);
-            applet.initialize();
-            
-            applet.getAppletEnvironment().startApplet(); // this should be a direct call to applet instance
-            return applet;
-        }
-        catch (LaunchException lex) {
-            throw launchError(lex);
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
-        }
-    }
-    
-    /**
-     * Gets an ApplicationInstance, but does not launch the applet.
-     */
-    protected ApplicationInstance getApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
-        if (!file.isApplet())
-            throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo")));
-
-        try {
-            AppletInstance applet = createApplet(file, enableCodeBase, cont);
-            applet.initialize();
-            return applet;
-        }
-        catch (LaunchException lex) {
-            throw launchError(lex);
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")));
-        }
-    }
-
-    /** 
-     * Launches a JNLP installer.  This method should be called from
-     * a thread in the application's thread group.
-     */
-    protected ApplicationInstance launchInstaller(JNLPFile file) throws LaunchException {
-        throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCNotSupported"), R("LNoInstallers"), R("LNoInstallersInfo")));
-    }
-
-    /**
-     * Create an AppletInstance.
-     *
-     * @param enableCodeBase whether to add the code base URL to the classloader
-     */
-    protected AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
-        try {
-            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
-
-            if (enableCodeBase || file.getResources().getJARs().length == 0)
-                loader.enableCodeBase();
-
-            AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup();
-
-            String appletName = file.getApplet().getMainClass();
-
-			//Classloader chokes if there's '/' in the path to the main class.
-			//Must replace with '.' instead.
-			appletName = appletName.replace('/', '.');
-            Class appletClass = loader.loadClass(appletName);
-            Applet applet = (Applet) appletClass.newInstance();
-
-            AppletInstance appletInstance;
-            if (cont == null)
-              appletInstance = new AppletInstance(file, group, loader, applet);
-            else
-              appletInstance = new AppletInstance(file, group, loader, applet, cont);
-
-            group.setApplication(appletInstance);
-            loader.setApplication(appletInstance);
-
-            return appletInstance;
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")));
-        }
-    }
-
-    /**
-     * Creates an Applet object from a JNLPFile. This is mainly to be used with
-     * gcjwebplugin.
-     * @param file the PluginBridge to be used.
-     * @param enableCodeBase whether to add the code base URL to the classloader.
-     */
-    protected Applet createAppletObject(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
-        try {
-            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
-
-            if (enableCodeBase || file.getResources().getJARs().length == 0)
-                loader.enableCodeBase();
-
-            String appletName = file.getApplet().getMainClass();
-
-			//Classloader chokes if there's '/' in the path to the main class.
-			//Must replace with '.' instead.
-			appletName = appletName.replace('/', '.');
-            Class appletClass = loader.loadClass(appletName);
-            Applet applet = (Applet) appletClass.newInstance();
-
-            return applet;
-        }
-        catch (Exception ex) {
-            throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")));
-        }
-    }
-    
-    /**
-     * Creates an Application.
-     */
-    protected ApplicationInstance createApplication(JNLPFile file) throws LaunchException {
-        try {
-            JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
-            AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup();
-
-            ApplicationInstance app = new ApplicationInstance(file, group, loader);
-            group.setApplication(app);
-            loader.setApplication(app);
-
-            return app;
-        }
-        catch (Exception ex) {
-            throw new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo"));
-        }
-    }
-
-    /**
-     * Create a thread group for the JNLP file.
-     */
-    protected AppThreadGroup createThreadGroup(JNLPFile file) {
-        return new AppThreadGroup(mainGroup, file.getTitle());
-    }
-
-    /**
-     * Send n launch error to the handler, if set, and also to the
-     * caller.
-     */
-    private LaunchException launchError(LaunchException ex) {
-        if (handler != null)
-            handler.launchError(ex);
-
-        return ex;
-    }
-
-    /**
-     * Send a launch error to the handler, if set, and to the
-     * caller only if the handler indicated that the launch should
-     * continue despite the warning.
-     *
-     * @return an exception to throw if the launch should be aborted, or null otherwise
-     */
-    private LaunchException launchWarning(LaunchException ex) {
-        if (handler != null)
-            if (!handler.launchWarning(ex))
-                // no need to destroy the app b/c it hasn't started
-                return ex; // chose to abort
-
-        return null; // chose to continue, or no handler
-    }
-
-
-
-    /**
-     * This runnable is used to call the appropriate launch method
-     * for the application, applet, or installer in its thread group.
-     */
-    private class TgThread extends Thread { // ThreadGroupThread
-        private JNLPFile file;
-        private ApplicationInstance application;
-        private LaunchException exception;
-        private Container cont;
-        private boolean isPlugin = false;
-
-        TgThread(JNLPFile file) {
-            this(file, null);
-        }
-
-        TgThread(JNLPFile file, Container cont) {
-            super(createThreadGroup(file), file.getTitle());
-
-            this.file = file;
-            this.cont = cont;
-        }
-        
-        TgThread(JNLPFile file, Container cont, boolean isPlugin) {
-            super(createThreadGroup(file), file.getTitle());
-            this.file = file;
-            this.cont = cont;
-            this.isPlugin = isPlugin;
-        }
-
-        public void run() {
-            try {
-                // Do not create new AppContext if we're using NetX and gcjwebplugin.
-                if (context && !isPlugin)
-                	new Reflect().invokeStatic("sun.awt.SunToolkit", "createNewAppContext");
-
-                if (isPlugin) {
-                	// Do not display download indicators if we're using gcjwebplugin.
-                	JNLPRuntime.setDefaultDownloadIndicator(null);
-                	application = getApplet(file, true, cont);
-                } else {
-                	if (file.isApplication())
-                		application = launchApplication(file);
-                	else if (file.isApplet())
-                		application = launchApplet(file, true, cont); // enable applet code base
-                	else if (file.isInstaller())
-                		application = launchInstaller(file);
-                	else 
-                		throw launchError(new LaunchException(file, null, 
-                				R("LSFatal"), R("LCClient"), R("LNotLaunchable"), 
-                				R("LNotLaunchableInfo")));
-                }
-            }
-            catch (LaunchException ex) {
-                ex.printStackTrace();
-                exception = ex;
-                // Exit if we can't launch the application.
-                if (exitOnFailure)
-                	System.exit(0);
-            }
-        }
-
-        public LaunchException getException() {
-            return exception;
-        }
-
-        public ApplicationInstance getApplication() {
-            return application;
-        }
-        
-    };
-
-
-    /**
-     * This runnable is used by the <code>launchBackground</code>
-     * methods to launch a JNLP file from a separate thread.
-     */
-    private class BgRunner implements Runnable {
-        private JNLPFile file;
-        private URL location;
-
-        BgRunner(JNLPFile file, URL location) {
-            this.file = file;
-            this.location = location;
-        }
-
-        public void run() {
-            try {
-                if (file != null)
-                    launch(file);
-                if (location != null)
-                    launch(location);
-            }
-            catch (LaunchException ex) {
-                // launch method communicates error conditions to the
-                // handler if it exists, otherwise we don't care because
-                // there's nothing that can be done about the exception.
-            }
-        }
-    };
-
-    /**
-     * This class reads the output from a launched process and
-     * writes it to stdout.
-     */
-    private static class StreamEater extends Thread {
-        private InputStream stream;
-
-        StreamEater(InputStream stream) {
-            this.stream = new BufferedInputStream(stream);
-        }
-
-        public void run() {
-            try {
-                while (true) {
-                    int c = stream.read();
-                    if (c == -1)
-                        break;
-
-                    System.out.write(c);
-                }
-            }
-            catch (IOException ex) {
-            }
-        }
-    };
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/NetxPanel.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright 2007 Red Hat, Inc.
- * This file is part of IcedTea, http://icedtea.classpath.org
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package net.sourceforge.jnlp;
-
-import net.sourceforge.jnlp.runtime.AppletInstance;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-import java.net.URL;
-import java.util.Hashtable;
-
-import sun.applet.AppletViewerPanel;
-
-/**
- * This panel calls into netx to run an applet, and pipes the display
- * into a panel from gcjwebplugin.
- *
- * @author      Francis Kung <fkung@redhat.com>
- */
-public class NetxPanel extends AppletViewerPanel
-{
-    private PluginBridge bridge = null;
-    private boolean exitOnFailure = true;
-    private AppletInstance appInst = null;
-    private String cookieStr;
-    private boolean appletAlive;
-
-    public NetxPanel(URL documentURL, Hashtable atts)
-    {
-        super(documentURL, atts);
-    }
-    
-    // overloaded constructor, called when initialized via plugin 
-    public NetxPanel(URL documentURL, String cookieStr, Hashtable atts, boolean exitOnFailure)
-    {
-        this(documentURL, atts);
-        this.exitOnFailure = exitOnFailure;
-        this.cookieStr = cookieStr;
-        this.appletAlive = true;
-    }
-
-    //Overriding to use Netx classloader. You might need to relax visibility
-    //in sun.applet.AppletPanel for runLoader().
-    protected void runLoader() {
-
-    	try {
-    		bridge = new PluginBridge(baseURL,
-    				cookieStr,
-    				getDocumentBase(),
-    				getJarFiles(), 
-    				getCode(),
-    				getWidth(), 
-    				getHeight(), 
-    				atts);
-
-    		synchronized(JNLPRuntime.initMutex) {
-    			//The custom NetX Policy and SecurityManager are set here.
-    			if (!JNLPRuntime.isInitialized()) {
-    			    if (JNLPRuntime.isDebug())
-    			        System.out.println("initializing JNLPRuntime...");
-
-    				JNLPRuntime.initialize(false);
-    			} else {
-    			    if (JNLPRuntime.isDebug())
-    			        System.out.println("JNLPRuntime already initialized");
-    			}
-    		}
-
-    		doInit = true;
-    		dispatchAppletEvent(APPLET_LOADING, null);
-    		status = APPLET_LOAD;
-
-    		Launcher l = new Launcher(exitOnFailure);
-    		
-                try {
-                    appInst = (AppletInstance) l.launch(bridge, this);
-                } catch (LaunchException e) {
-                    // Assume user has indicated he does not trust the
-                    // applet.
-                	if (exitOnFailure)
-                		System.exit(0);
-                }
-    		applet = appInst.getApplet();
-    		
-    		//On the other hand, if you create an applet this way, it'll work
-    		//fine. Note that you might to open visibility in sun.applet.AppletPanel
-    		//for this to work (the loader field, and getClassLoader).
-    		//loader = getClassLoader(getCodeBase(), getClassLoaderCacheKey());
-    		//applet = createApplet(loader);
-    		
-    		// This shows that when using NetX's JNLPClassLoader, keyboard input
-    		// won't make it to the applet, whereas using sun.applet.AppletClassLoader
-    		// works just fine.
-    		
-    		dispatchAppletEvent(APPLET_LOADING_COMPLETED, null);
-
-    		if (applet != null)
-    		{
-    			// Stick it in the frame
-    			applet.setStub(this);
-    			applet.setVisible(false);
-    			add("Center", applet);
-    			showAppletStatus("loaded");
-    			validate();
-    		}
-    	} catch (Exception e) {
-    	    this.appletAlive = false;
-    		e.printStackTrace();
-    	}
-    }
-
-    // Reminder: Relax visibility in sun.applet.AppletPanel
-    protected synchronized void createAppletThread() {
-    	handler = new Thread(this);
-    	handler.start();
-    }
-    
-    public void updateSizeInAtts(int height, int width) {
-    	this.atts.put("height", Integer.toString(height));
-    	this.atts.put("width", Integer.toString(width));
-    }
-    
-    public ClassLoader getAppletClassLoader() {
-        return appInst.getClassLoader();
-    }
-    
-    public boolean isAlive() {
-        return handler.isAlive() && this.appletAlive;
-    }
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Node.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-package net.sourceforge.jnlp;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import net.sourceforge.nanoxml.XMLElement;
-
-// this class makes assumptions on how parser calls methods (such
-// as getFirstChild->getNextChild only called by a single loop at
-// a time, so no need for an iterator).
-
-/**
- * This class converts the NanoXML's XMLElement nodes into the
- * regular XML Node interface (for the methods used by Parser).
- */
-/* NANO */
-class Node {
-    private XMLElement xml;
-    private Node next;
-    private Node children[];
-
-    Node(XMLElement xml) {
-        this.xml = xml;
-    }
-
-    Node getFirstChild() {
-        if (children == null)
-            getChildNodes();
-
-        if (children.length == 0)
-            return null;
-        else
-            return children[0];
-    }
-
-    Node getNextSibling() {
-        return next;
-    }
-
-    void normalize() {
-    }
-
-    String getNodeValue() {
-        return xml.getContent();
-    }
-
-    Node[] getChildNodes() {
-        if (children == null) {
-            List list = new ArrayList();
-
-            for (Enumeration e = xml.enumerateChildren(); e.hasMoreElements();)
-                list.add( new Node((XMLElement)e.nextElement()) );
-
-            children = (Node[]) list.toArray( new Node[list.size()] );
-
-            for (int i=0; i < children.length-1; i++)
-                children[i].next = children[i+1];
-        }
-
-        return children;
-    }
-
-    String getAttribute(String name) {
-        return (String)xml.getAttribute(name);
-    }
-
-    String getNodeName() {
-        if (xml.getName() == null)
-            return "";
-        else
-            return xml.getName();
-    }
-
-    public String toString() {
-        return getNodeName();
-    }
-}
-
-/**
- * This class converts the TinyXML's ParsedXML nodes into the
- * regular XML Node interface (for the methods used by Parser).
- */
-/* TINY 
-class Node {
-    private ParsedXML tinyNode;
-    private Node next;
-    private Node children[];
-
-    Node(ParsedXML tinyNode) {
-        this.tinyNode = tinyNode;
-    }
-
-    Node getFirstChild() {
-        if (children == null)
-            getChildNodes();
-
-        if (children.length == 0)
-            return null;
-        else
-            return children[0];
-    }
-
-    Node getNextSibling() {
-        return next;
-    }
-
-    void normalize() {
-    }
-
-    String getNodeValue() {
-        return tinyNode.getContent();
-    }
-
-    Node[] getChildNodes() {
-        if (children == null) {
-            List list = new ArrayList();
-
-            for (Enumeration e = tinyNode.elements(); e.hasMoreElements();) {
-                list.add( new Node((ParsedXML)e.nextElement()) );
-            }
-            children = (Node[]) list.toArray( new Node[list.size()] );
-
-            for (int i=0; i < children.length-1; i++)
-                children[i].next = children[i+1];
-        }
-
-        return children;
-    }
-
-    String getAttribute(String name) {
-        return tinyNode.getAttribute(name);
-    }
-
-    String getNodeName() {
-        if (tinyNode.getName() == null)
-            return "";
-        else
-            return tinyNode.getName();
-    }
-
-    public String toString() {
-        return getNodeName();
-    }
-}
-*/
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PackageDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * The package element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $
- */
-public class PackageDesc {
-
-    /** the package name */
-    private String name;
-
-    /** the part required by the package */
-    private String part;
-
-    /** whether the package includes subpackages */
-    private boolean recursive;
-
-
-    /**
-     * Create a package descriptor.
-     *
-     * @param name the package name
-     * @param part the part required by the package
-     * @param recursive whether the package includes subpackages
-     */
-    public PackageDesc(String name, String part, boolean recursive) {
-        this.name = name;
-        this.part = part;
-        this.recursive = recursive;
-    }
-
-    /**
-     * Returns whether the specified class is part of this package.
-     *
-     * @param className the fully qualified class name
-     */
-    public boolean matches(String className) {
-        // form 1: exact class
-        if (name.equals(className))
-            return true;
-
-        // form 2: package.*
-        if (name.endsWith(".*")) {
-            String pkName = name.substring(0, name.length()-1);
-
-            if (className.startsWith(pkName)) {
-                String postfix = className.substring(pkName.length()+1);
-
-                if (recursive || -1 == postfix.indexOf("."))
-                    return true;
-            }
-        }
-
-        return false;
-    }
-
-    /** 
-     * Returns the package name.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the part name.
-     */
-    public String getPart() {
-        return part;
-    }
-
-    /**
-     * Returns whether subpackages should be matched by this
-     * package.
-     */
-    public boolean isRecursive() {
-        return recursive;
-    }
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ParseException.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Thrown to indicate that an error has occurred while parsing a
- * JNLP file.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $
- */
-public class ParseException extends Exception {
-
-    // todo: add meaningful information, such as the invalid
-    // element, parse position, etc.
-    
-    /** the original exception */
-    private Throwable cause = null;
-
-
-    /**
-     * Create a parse exception with the specified message.
-     */
-    public ParseException(String message) {
-        super(message);
-    }
-
-    /**
-     * Create a parse exception with the specified message and
-     * cause.
-     */
-    public ParseException(String message, Throwable cause) {
-        super(message);
-
-        // replace with setCause when no longer 1.3 compatible
-        this.cause = cause;
-    }
-
-    /**
-     * Return the cause of the launch exception or null if there
-     * is no cause exception.
-     */
-    public Throwable getCause() {
-        return cause;
-    }
-
-    /**
-     * Print the stack trace and the cause exception (1.3
-     * compatible)
-     */
-    public void printStackTrace(PrintStream stream) {
-        super.printStackTrace(stream);
-
-        if (cause != null) {
-            stream.println("Caused by: ");
-            cause.printStackTrace(stream);
-        }
-    }
-
-    /**
-     * Print the stack trace and the cause exception (1.3
-     * compatible)
-     */
-    public void printStackTrace(PrintWriter stream) {
-        super.printStackTrace(stream);
-
-        if (cause != null) {
-            stream.println("Caused by: ");
-            cause.printStackTrace(stream);
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Parser.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,979 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-//import javax.xml.parsers.*; // commented to use right Node
-//import org.w3c.dom.*;       // class for using Tiny XML | NanoXML
-//import org.xml.sax.*;
-//import gd.xml.tiny.*;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.nanoxml.*;
-
-
-/**
- * Contains methods to parse an XML document into a JNLPFile.
- * Implements JNLP specification version 1.0.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.13 $ 
- */
-class Parser {
-
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-    private static String R(String key, Object p1) { return R(key, p1, null); }
-    private static String R(String key, Object p1, Object p2) { return R(key, p1, p2, null); }
-    private static String R(String key, Object p1, Object p2, Object p3) { return JNLPRuntime.getMessage(key, new Object[] { p1, p2, p3 }); }
-
-
-    // defines netx.jnlp.Node class if using Tiny XML or Nano XML
-
-    // Currently uses the Nano XML parse.  Search for "SAX" or
-    // "TINY" or "NANO" and uncomment those blocks and comment the
-    // active ones (if any) to switch XML parsers.  Also
-    // (un)comment appropriate Node class at end of this file and
-    // do a clean build.
-
-    /**
-     * Ensure consistent error handling.
-     */
-    /* SAX
-    static ErrorHandler errorHandler = new ErrorHandler() {
-        public void error(SAXParseException exception) throws SAXParseException {
-            //throw exception;
-        }
-        public void fatalError(SAXParseException exception) throws SAXParseException {
-            //throw exception;
-        }
-        public void warning(SAXParseException exception) {
-            System.err.println("XML parse warning:");
-            exception.printStackTrace();
-        }
-    };
-    */
-
-
-    /** the supported JNLP file versions */
-    private static Version supportedVersions = new Version("1.0");
-
-    // fix: some descriptors need to use the jnlp file at a later
-    // date and having file ref lets us pass it to their
-    // constructors
-    //
-    /** the file reference */
-    private JNLPFile file; // do not use (uninitialized)
-
-    /** the root node */
-    private Node root;
-
-    /** the specification version */
-    private Version spec;
-
-    /** the base URL that all hrefs are relative to */
-    private URL base;
-
-    /** the codebase URL */
-    private URL codebase;
-
-    /** the file URL */
-    private URL fileLocation;
-
-    /** whether to throw errors on non-fatal errors. */
-    private boolean strict; // if strict==true parses a file with no error then strict==false should also
-
-    /** whether to allow extensions to the JNLP specification */
-    private boolean allowExtensions; // true if extensions to JNLP spec are ok
-
-
-    /**
-     * Create a parser for the JNLP file.  If the location
-     * parameters is not null it is used as the default codebase
-     * (does not override value of jnlp element's href
-     * attribute).<p>
-     *
-     * The root node may be normalized as a side effect of this
-     * constructor.
-     *
-     * @param file the (uninitialized) file reference
-     * @param base if codebase is not specified, a default base for relative URLs 
-     * @param root the root node
-     * @param strict whether to enforce strict compliance with the JNLP spec
-     * @param allowExtensions whether to allow extensions to the JNLP spec
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public Parser(JNLPFile file, URL base, Node root, boolean strict, boolean allowExtensions) throws ParseException {
-        this.file = file;
-        this.root = root;
-        this.strict = strict;
-        this.allowExtensions = allowExtensions;
-
-        // ensure it's a JNLP node
-        if (root == null || !root.getNodeName().equals("jnlp"))
-            throw new ParseException(R("PInvalidRoot"));
-
-        // JNLP tag information
-        this.spec = getVersion(root, "spec", "1.0+");
-        this.codebase = addSlash(getURL(root, "codebase", base));
-        this.base = (codebase!=null) ? codebase : base; // if codebase not specified use default codebase
-        fileLocation = getURL(root, "href", this.base);
-
-        // ensure version is supported
-        if (!supportedVersions.matchesAny(spec))
-            throw new ParseException(R("PSpecUnsupported", supportedVersions));
-
-        // normalize the text nodes
-        root.normalize();
-    }
-
-    /**
-     * Return the JNLP specification versions supported.
-     */
-    public static Version getSupportedVersions() {
-        return supportedVersions;
-    }
-
-    /** 
-     * Returns the file version.
-     */
-    public Version getFileVersion() {
-        return getVersion(root, "version", null);
-    }
-
-    /** 
-     * Returns the file location.
-     */
-    public URL getFileLocation() {
-        return fileLocation;
-    }
-
-    /** 
-     * Returns the codebase.
-     */
-    public URL getCodeBase() {
-        return codebase;
-    }
-
-    /** 
-     * Returns the specification version.
-     */
-    public Version getSpecVersion() {
-        return spec;
-    }
-
-    // 
-    // This section loads the resources elements
-    // 
-
-    /**
-     * Returns all of the ResourcesDesc elements under the specified
-     * node (jnlp or j2se).
-     *
-     * @param parent the parent node (either jnlp or j2se)
-     * @param j2se true if the resources are located under a j2se node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public List getResources(Node parent, boolean j2se) throws ParseException {
-        List result = new ArrayList();
-        Node resources[] = getChildNodes(parent, "resources");
-
-        // ensure that there are at least one information section present
-        if (resources.length == 0 && !j2se)
-            throw new ParseException(R("PNoResources"));
-
-        // create objects from the resources sections
-        for (int i=0; i < resources.length; i++)
-            result.add(getResourcesDesc(resources[i], j2se));
-
-        return result;
-    }
-
-    /**
-     * Returns the ResourcesDesc element at the specified node.
-     *
-     * @param node the resources node
-     * @param j2se true if the resources are located under a j2se node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public ResourcesDesc getResourcesDesc(Node node, boolean j2se) throws ParseException {
-        boolean mainFlag = false; // if found a main tag
-
-        // create resources
-        ResourcesDesc resources = 
-            new ResourcesDesc(file, 
-                              getLocales(node), 
-                              splitString(getAttribute(node, "os", null)),
-                              splitString(getAttribute(node, "arch", null)));
-
-        // step through the elements
-        Node child = node.getFirstChild();
-        while (child != null) {
-            String name = child.getNodeName();
-
-            // check for nativelib but no trusted environment 
-            if ("nativelib".equals(name))
-                if (!isTrustedEnvironment())
-                    throw new ParseException(R("PUntrustedNative"));
-
-            if ("j2se".equals(name)) {
-                if (getChildNode(root, "component-desc") != null)
-                    if (strict)
-                        throw new ParseException(R("PExtensionHasJ2SE"));
-                if (!j2se)
-                    resources.addResource( getJRE(child) );
-                else
-                    throw new ParseException(R("PInnerJ2SE"));
-            }
-
-            if ("jar".equals(name) || "nativelib".equals(name)) {
-                JARDesc jar = getJAR(child);
-
-                // check for duplicate main entries
-                if (jar.isMain()) {
-                    if (mainFlag == true)
-                        if (strict)
-                            throw new ParseException(R("PTwoMains"));
-                    mainFlag = true;
-                }
-
-                resources.addResource(jar);
-            }
-
-            if ("extension".equals(name))
-                resources.addResource( getExtension(child) );
-
-            if ("property".equals(name)) 
-                resources.addResource( getProperty(child) );
-
-            if ("package".equals(name))
-                resources.addResource( getPackage(child) );
-
-            child = child.getNextSibling();
-        }
-
-        return resources;
-    }
-
-    /**
-     * Returns the JRE element at the specified node.
-     *
-     * @param node the j2se node 
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public JREDesc getJRE(Node node) throws ParseException {
-        Version version = getVersion(node, "version", null);
-        URL location = getURL(node, "href", base);
-        String initialHeap = getAttribute(node, "initial-heap-size", null);
-        String maxHeap = getAttribute(node, "max-heap-size", null);
-        List resources = getResources(node, true);
-
-        // require version attribute
-        getRequiredAttribute(node, "version", null);
-
-        return new JREDesc(version, location, initialHeap, maxHeap, resources);
-    }
-
-    /**
-     * Returns the JAR element at the specified node.
-     *
-     * @param node the jar or nativelib node 
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public JARDesc getJAR(Node node) throws ParseException {
-        boolean nativeJar = "nativelib".equals(node.getNodeName());
-        URL location = getRequiredURL(node, "href", base);
-        Version version = getVersion(node, "version", null);
-        String part = getAttribute(node, "part", null);
-        boolean main = "true".equals(getAttribute(node, "main", "false"));
-        boolean lazy = "lazy".equals(getAttribute(node, "download", "eager"));
-        int size = Integer.parseInt(getAttribute(node, "size", "0"));
-
-        if (nativeJar && main)
-            if (strict) 
-                throw new ParseException(R("PNativeHasMain"));
-
-        return new JARDesc(location, version, part, lazy, main, nativeJar, true);
-
-    }
-
-    /**
-     * Returns the Extension element at the specified node.
-     *
-     * @param node the extension node 
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public ExtensionDesc getExtension(Node node) throws ParseException {
-        String name = getAttribute(node, "name", null);
-        Version version = getVersion(node, "version", null);
-        URL location = getRequiredURL(node, "href", base);
-
-        ExtensionDesc ext = new ExtensionDesc(name, version, location, null);
-
-        Node dload[] = getChildNodes(node, "ext-download");
-        for (int i=0; i < dload.length; i++) {
-            boolean lazy = "lazy".equals(getAttribute(node, "download", "eager"));
-
-            ext.addPart(getRequiredAttribute(node, "ext-part", null),
-                        getAttribute(node, "part", null),
-                        lazy);
-        }
-
-        return ext;
-    }
-
-    /**
-     * Returns the Property element at the specified node.
-     *
-     * @param node the property node 
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public PropertyDesc getProperty(Node node) throws ParseException {
-        String name = getRequiredAttribute(node, "name", null);
-        String value = getRequiredAttribute(node, "value", "");
-
-        return new PropertyDesc(name, value);
-    }
-
-    /**
-     * Returns the Package element at the specified node.
-     *
-     * @param node the package node 
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public PackageDesc getPackage(Node node) throws ParseException {
-        String name = getRequiredAttribute(node, "name", null);
-        String part = getRequiredAttribute(node, "part", "");
-        boolean recursive = getAttribute(node, "recursive", "false").equals("true");
-
-        return new PackageDesc(name, part, recursive);
-    }
-
-    // 
-    // This section loads the information elements
-    // 
-
-    /**
-     * Returns all of the information elements under the specified
-     * node.
-     *
-     * @param parent the parent node (jnlp)
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public List getInfo(Node parent) throws ParseException {
-        List result = new ArrayList();
-        Node info[] = getChildNodes(parent, "information");
-
-        // ensure that there are at least one information section present
-        if (info.length == 0)
-            throw new ParseException(R("PNoInfoElement"));
-
-        // create objects from the info sections
-        for (int i=0; i < info.length; i++)
-            result.add(getInformationDesc(info[i]));
-
-        return result;
-    }
-
-    /**
-     * Returns the information element at the specified node.
-     *
-     * @param node the information node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public InformationDesc getInformationDesc(Node node) throws ParseException {
-        List descriptionsUsed = new ArrayList();
-
-        // locale
-        Locale locales[] = getLocales(node);
-
-        // create information
-        InformationDesc info = new InformationDesc(file, locales);
-
-        // step through the elements
-        Node child = node.getFirstChild();
-        while (child != null) {
-            String name = child.getNodeName();
-
-            if ("title".equals(name))
-                addInfo(info, child, null, getSpanText(child));
-            if ("vendor".equals(name))
-                addInfo(info, child, null, getSpanText(child));
-            if ("description".equals(name)) {
-                String kind = getAttribute(child, "kind", "default");
-                if (descriptionsUsed.contains(kind))
-                    if (strict)
-                        throw new ParseException(R("PTwoDescriptions", kind));
-
-                descriptionsUsed.add(kind);
-                addInfo(info, child, kind, getSpanText(child));
-            }
-            if ("homepage".equals(name))
-                addInfo(info, child, null, getRequiredURL(child, "href", base));
-            if ("icon".equals(name))
-                addInfo(info, child, getAttribute(child, "kind", "default"), getIcon(child));
-            if ("offline-allowed".equals(name))
-                addInfo(info, child, null, Boolean.TRUE);
-            if ("sharing-allowed".equals(name)) {
-                if (strict && !allowExtensions)
-                    throw new ParseException(R("PSharing"));
-                addInfo(info, child, null, Boolean.TRUE);
-            }
-
-            child = child.getNextSibling();
-        }
-
-        return info;
-    }
-
-    /**
-     * Adds a key,value pair to the information object.
-     *
-     * @param info the information object 
-     * @param node node name to be used as the key
-     * @param mod key name appended with "-"+mod if not null
-     * @param value the info object to add (icon or string)
-     */
-    protected void addInfo(InformationDesc info, Node node, String mod, Object value) {
-        String modStr = (mod == null) ? "" : "-"+mod;
-
-        if (node == null)
-            return;
-
-        info.addItem(node.getNodeName()+modStr, value);
-    }
-
-    /**
-     * Returns the icon element at the specified node.
-     *
-     * @param node the icon node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public IconDesc getIcon(Node node) throws ParseException {
-        int width = Integer.parseInt(getAttribute(node, "width", "-1"));
-        int height = Integer.parseInt(getAttribute(node, "height", "-1"));
-        int size = Integer.parseInt(getAttribute(node, "size", "-1"));
-        int depth = Integer.parseInt(getAttribute(node, "depth", "-1"));
-        URL location = getRequiredURL(node, "href", base);
-        Object kind = getAttribute(node, "kind", "default"); 
-
-        return new IconDesc(location, kind, width, height, depth, size);
-    }
-
-    // 
-    // This section loads the security descriptor element
-    // 
-
-    /**
-     * Returns the security descriptor element.  If no security
-     * element was specified in the JNLP file then a SecurityDesc
-     * with applet permissions is returned.
-     *
-     * @param parent the parent node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public SecurityDesc getSecurity(Node parent) throws ParseException {
-        Node nodes[] = getChildNodes(parent, "security");
-
-        // test for too many security elements
-        if (nodes.length > 1) 
-            if (strict)
-                throw new ParseException(R("PTwoSecurity"));
-
-        Object type = SecurityDesc.SANDBOX_PERMISSIONS;
-
-        if (nodes.length == 0)
-            type = SecurityDesc.SANDBOX_PERMISSIONS;
-        else if (null != getChildNode(nodes[0], "all-permissions"))
-            type = SecurityDesc.ALL_PERMISSIONS;
-        else if (null != getChildNode(nodes[0], "j2ee-application-client-permissions"))
-            type = SecurityDesc.J2EE_PERMISSIONS;
-        else if (strict)
-            throw new ParseException(R("PEmptySecurity"));
-
-        if (base != null)
-            return new SecurityDesc(file, type, base.getHost());
-        else
-            return new SecurityDesc(file, type, null);
-    }
-
-    /**
-     * Returns whether the JNLP file requests a trusted execution
-     * environment.
-     */
-    protected boolean isTrustedEnvironment() {
-        Node security = getChildNode(root, "security");
-
-        if (security != null)
-            if (getChildNode(security, "all-permissions") != null
-                || getChildNode(security, "j2ee-application-client-permissions") != null)
-                return true;
-
-        return false;
-    }
-
-    // 
-    // This section loads the launch descriptor element
-    // 
-
-    /**
-     * Returns the launch descriptor element, either AppletDesc,
-     * ApplicationDesc, ComponentDesc, or InstallerDesc.
-     *
-     * @param parent the parent node
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public Object getLauncher(Node parent) throws ParseException {
-        // check for other than one application type
-        if (1 != getChildNodes(parent, "applet-desc").length
-            + getChildNodes(parent, "application-desc").length
-            + getChildNodes(parent, "component-desc").length
-            + getChildNodes(parent, "installer-desc").length)
-            throw new ParseException(R("PTwoDescriptors"));
-
-        Node child = parent.getFirstChild();
-        while (child != null) {
-            String name = child.getNodeName();
-
-            if ("applet-desc".equals(name))
-                return getApplet(child);
-            if ("application-desc".equals(name))
-                return getApplication(child);
-            if ("component-desc".equals(name))
-                return getComponent(child);
-            if ("installer-desc".equals(name))
-                return getInstaller(child);
-
-            child = child.getNextSibling();
-        }
-
-        // not reached
-        return null;
-    }
-
-    /**
-     * Returns the applet descriptor.
-     *
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public AppletDesc getApplet(Node node) throws ParseException {
-        String name = getRequiredAttribute(node, "name", R("PUnknownApplet"));
-        String main = getRequiredAttribute(node, "main-class", null);
-        URL docbase = getURL(node, "documentbase", base);
-        Map paramMap = new HashMap();
-        int width = 0;
-        int height = 0;
-
-        try {
-            width = Integer.parseInt(getRequiredAttribute(node, "width", "100"));
-            height = Integer.parseInt(getRequiredAttribute(node, "height", "100"));
-        }
-        catch (NumberFormatException nfe) {
-            if (width <= 0)
-                throw new ParseException(R("PBadWidth"));
-            throw new ParseException(R("PBadWidth"));
-        }
-
-        // read params
-        Node params[] = getChildNodes(node, "param");
-        for (int i=0; i < params.length; i++) {
-            paramMap.put(getRequiredAttribute(params[i], "name", null),
-                         getRequiredAttribute(params[i], "value", ""));
-        }
-
-        return new AppletDesc(name, main, docbase, width, height, paramMap);
-    }
-
-    /**
-     * Returns the application descriptor.
-     *
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public ApplicationDesc getApplication(Node node) throws ParseException {
-        String main = getAttribute(node, "main-class", null);
-        List argsList = new ArrayList();
-
-        // if (main == null)
-        //   only ok if can be found in main jar file (can't check here but make a note)
-
-        // read parameters
-        Node args[] = getChildNodes(node, "argument");
-        for (int i=0; i < args.length; i++) {
-            //argsList.add( args[i].getNodeValue() );
-            
-            //This approach was not finding the argument text
-            argsList.add( getSpanText(args[i]) );
-        }
-
-        String argStrings[] = 
-            (String[]) argsList.toArray( new String[argsList.size()] );
-
-        return new ApplicationDesc(main, argStrings);
-    }
-
-    /**
-     * Returns the component descriptor.
-     */
-    public ComponentDesc getComponent(Node node) {
-        return new ComponentDesc();
-    }
-
-    /**
-     * Returns the installer descriptor.
-     */
-    public InstallerDesc getInstaller(Node node) {
-        String main = getAttribute(node, "main-class", null);
-
-        return new InstallerDesc(main);
-    }
-
-    // other methods
-
-    /**
-     * Returns an array of substrings seperated by spaces (spaces
-     * escaped with backslash do not separate strings).  This method
-     * splits strings as per the spec except that it does replace
-     * escaped other characters with their own value.
-     */
-    public String[] splitString(String source) {
-        if (source == null)
-            return new String[0];
-
-        List result = new ArrayList();
-        StringTokenizer st = new StringTokenizer(source, " ");
-        StringBuffer part = new StringBuffer();
-        while (st.hasMoreTokens()) {
-            part.setLength(0);
-
-            // tack together tokens joined by backslash
-            while (true) {
-                part.append(st.nextToken());
-
-                if (st.hasMoreTokens() && part.charAt(part.length()-1) == '\\')
-                    part.setCharAt(part.length()-1, ' '); // join with the space
-                else
-                    break; // bizarre while format gets \ at end of string right (no extra space added at end)
-            } 
-
-            // delete \ quote chars
-            for (int i = part.length(); i-- > 0;) // sweet syntax for reverse loop
-                if (part.charAt(i) == '\\')
-                    part.deleteCharAt(i--); // and skip previous char so \\ becomes \
-
-            result.add( part.toString() );
-        }
-
-        return (String[]) result.toArray(new String[result.size()] );
-    }
-
-    /**
-     * Returns the Locale object(s) from a node's locale attribute.
-     *
-     * @param node the node with a locale attribute
-     */
-    public Locale[] getLocales(Node node) {
-        List locales = new ArrayList();
-        String localeParts[] = 
-            splitString(getAttribute(node, "locale", ""));
-
-        for (int i=0; i < localeParts.length; i++) {
-            Locale l = getLocale( localeParts[i] );
-            if (l != null)
-                locales.add(l);
-        }
-
-        return (Locale[]) locales.toArray(new Locale[locales.size()] );
-    }
-
-    /**
-     * Returns a Locale from a single locale.
-     *
-     * @param locale the locale string
-     */
-    public Locale getLocale(String localeStr) {
-        if (localeStr.length() < 2)
-            return null;
-
-        String language = localeStr.substring(0, 2);
-        String country = (localeStr.length()<5) ? "" : localeStr.substring(3, 5);
-        String variant = (localeStr.length()<7) ? "" : localeStr.substring(6, 8);
-
-        // null is not allowed n locale but "" is
-        return new Locale(language, country, variant);
-    }
-
-
-
-    // XML junk
-
-    /**
-     * Returns the implied text under a node, for example "text" in
-     * "<description>text</description>".
-     *
-     * @param node the node with text under it
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public String getSpanText(Node node) throws ParseException {
-        if (node == null)
-            return null;
-
-        // NANO
-        return node.getNodeValue();
-
-        /* TINY
-        Node child = node.getFirstChild();
-
-        if (child == null) {
-            if (strict)
-                // not sure if this is an error or whether "" is proper
-                throw new ParseException("No text specified (node="+node.getNodeName()+")");
-            else
-                return "";
-        }
-
-        return child.getNodeValue();
-        */
-    }
-
-    /**
-     * Returns the first child node with the specified name.
-     */
-    public static Node getChildNode(Node node, String name) {
-        Node[] result = getChildNodes(node, name);
-        if (result.length == 0)
-            return null;
-        else
-            return result[0];
-    }
-
-    /**
-     * Returns all child nodes with the specified name.
-     */
-    public static Node[] getChildNodes(Node node, String name) {
-        List result = new ArrayList();
-
-        Node child = node.getFirstChild();
-        while (child != null) {
-            if (child.getNodeName().equals(name))
-                result.add(child);
-            child = child.getNextSibling();
-        }
-
-        return (Node[]) result.toArray( new Node[result.size()] );
-    }
-
-
-    /**
-     * Returns a URL with a trailing / appended to it if there is no
-     * trailing slash on the specifed URL.
-     */
-    private URL addSlash(URL source) {
-        if (source == null)
-            return null;
-
-        if (!source.toString().endsWith("/")) {
-            try { 
-                source = new URL(source.toString()+"/"); 
-            }
-            catch (MalformedURLException ex) {
-            }
-        }
-
-        return source;
-    }
-
-
-    /**
-     * Returns the same result as getURL except that a
-     * ParseException is thrown if the attribute is null or empty.
-     *
-     * @param node the node
-     * @param name the attribute containing an href
-     * @param base the base URL
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public URL getRequiredURL(Node node, String name, URL base) throws ParseException {
-        // probably should change "" to null so that url is always
-        // required even if !strict
-        getRequiredAttribute(node, name, "");
-
-        return getURL(node, name, base);
-    }
-
-
-    /**
-     * Returns a URL object from a href string relative to the
-     * code base.  If the href denotes a relative URL, it must
-     * reference a location that is a subdirectory of the
-     * codebase.<p>
-     *
-     * @param node the node
-     * @param name the attribute containing an href
-     * @param base the base URL
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public URL getURL(Node node, String name, URL base) throws ParseException {
-        String href = getAttribute(node, name, null);
-        if (href == null)
-            return null; // so that code can throw an exception if attribute was required
-
-        try {
-            if (base == null)
-                return new URL(href);
-            else {
-                try {
-                    return new URL(href);
-                }
-                catch (MalformedURLException ex) {
-                    // is relative
-                }
-
-                URL result = new URL(base, href);
-
-                // check for going above the codebase
-                if (! result.toString().startsWith( base.toString()) )
-                    if (strict)
-                        throw new ParseException(R("PUrlNotInCodebase", node.getNodeName(), href, base));
-
-                return result;
-            }
-
-        }
-        catch (MalformedURLException ex) {
-            if (base == null)
-                throw new ParseException(R("PBadNonrelativeUrl", node.getNodeName(), href));
-            else
-                throw new ParseException(R("PBadRelativeUrl", node.getNodeName(), href, base));
-        }
-    }
-
-    /**
-     * Returns a Version from the specified attribute and default
-     * value.
-     *
-     * @param node the node
-     * @param name the attribute
-     * @param defaultValue default if no such attribute
-     * @return a Version, or null if no such attribute and default is null
-     */
-    public Version getVersion(Node node, String name, String defaultValue) {
-        String version = getAttribute(node, name, defaultValue);
-        if (version == null)
-            return null;
-        else
-            return new Version(version);
-    }
-
-    /**
-     * Returns the same result as getAttribute except that if strict
-     * mode is enabled or the default value is null a parse
-     * exception is thrown instead of returning the default value.
-     *
-     * @param node the node
-     * @param name the attribute
-     * @param defaultValue default value
-     * @throws ParseException if the attribute does not exist or is empty
-     */
-    public String getRequiredAttribute(Node node, String name, String defaultValue) throws ParseException {
-        String result = getAttribute(node, name, null);
-
-        if (result == null || result.length() == 0)
-            if (strict || defaultValue == null)
-                throw new ParseException(R("PNeedsAttribute", node.getNodeName(), name));
-
-        if (result == null)
-            return defaultValue;
-        else
-            return result;
-    }
-
-    /**
-     * Retuns an attribute or the specified defaultValue if there is
-     * no such attribute.
-     *
-     * @param node the node
-     * @param name the attribute
-     * @param defaultValue default if no such attribute
-     */
-    public String getAttribute(Node node, String name, String defaultValue) {
-        // SAX
-        // String result = ((Element) node).getAttribute(name);
-        String result = node.getAttribute(name);
-
-        if (result == null || result.length()==0) 
-            return defaultValue;
-
-        return result;
-    }
-
-    /**
-     * Return the root node from the XML document in the specified
-     * input stream.
-     *
-     * @throws ParseException if the JNLP file is invalid
-     */
-    public static Node getRootNode(InputStream input) throws ParseException {
-        try {
-            /* SAX
-            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            factory.setValidating(false);
-            factory.setNamespaceAware(true);
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            builder.setErrorHandler(errorHandler);
-
-            Document doc = builder.parse(input);
-            return doc.getDocumentElement();
-            */
-
-            /* TINY
-            Node document = new Node(TinyParser.parseXML(input));
-            Node jnlpNode = getChildNode(document, "jnlp"); // skip comments
-            */
-
-            /* NANO */
-            final XMLElement xml = new XMLElement();
-            final PipedInputStream pin = new PipedInputStream();
-            final PipedOutputStream pout = new PipedOutputStream(pin);
-            final InputStreamReader isr = new InputStreamReader(input);
-            
-            // Clean the jnlp xml file of all comments before passing
-            // it to the parser.
-            new Thread(
-                new Runnable(){
-                    public void run(){
-                        (new XMLElement()).sanitizeInput(isr, pout);
-                        try {
-                            pout.close();
-                        } catch (IOException ioe) {
-                            ioe.printStackTrace();
-                        }
-                    }
-                }
-            ).start();
-            xml.parseFromReader(new InputStreamReader(pin));
-            Node jnlpNode = new Node(xml);
-            return jnlpNode;
-        }
-        catch(Exception ex) {
-            throw new ParseException(R("PBadXML"), ex);
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PluginBridge.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
- * Copyright 2007 Red Hat, Inc.
- * This file is part of IcedTea, http://icedtea.classpath.org
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package net.sourceforge.jnlp;
-
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.List;
-import java.util.ArrayList;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-
-public class PluginBridge extends JNLPFile
-{
-    Version specVersion = new Version("1.0");
-    Version fileVersion = new Version("1.1");
-
-    String name;
-    String[] jars = new String[0];
-    String[] cache_jars = new String[0];
-    String[] cache_ex_jars = new String[0];
-    Hashtable atts;
-
-    public PluginBridge(URL codebase, String cookieStr, URL documentBase, String jar, String main,
-                        int width, int height, Hashtable atts)
-    throws Exception
-    {
-        this.codeBase = codebase;
-        this.sourceLocation = documentBase;
-
-        // also, see if cache_archive is specified
-        if (atts.get("cache_archive") != null && ((String) atts.get("cache_archive")).length() > 0) {
-            
-            String[] versions = new String[0];
-            
-            // are there accompanying versions?
-            if (atts.get("cache_version") != null) {
-                versions = ((String) atts.get("cache_version")).split(",");
-            }
-            
-            String[] jars = ((String) atts.get("cache_archive")).split(",");
-            cache_jars = new String[jars.length];
-            
-            for (int i=0; i < jars.length; i++) {
-                
-                cache_jars[i] = jars[i].trim();
-
-                if (versions.length > 0) {
-                    cache_jars[i] += ";" + versions[i].trim(); 
-                }
-            }
-        }
-        
-        if (atts.get("cache_archive_ex") != null && ((String) atts.get("cache_archive_ex")).length() > 0) {
-            cache_ex_jars = ((String) atts.get("cache_archive_ex")).split(",");
-        }
-
-        if (jar != null && jar.length() > 0) {
-            this.jars = jar.split(",");
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Jar string: " + jar);
-                System.err.println("jars length: " + jars.length);
-            }
-        }
-        this.atts = atts;
-
-        name = (String) atts.get("name");
-        if (name == null)
-            name = "Applet";
-        else
-            name = name + " applet";
-
-        if (main.endsWith(".class"))
-            main = main.substring(0, main.length() - 6);
-
-        launchType = new AppletDesc(name, main, documentBase, width,
-                                    height, atts);
-
-        if (main.endsWith(".class")) //single class file only
-            security = new SecurityDesc(this, SecurityDesc.SANDBOX_PERMISSIONS,
-                                        codebase.getHost());
-        else
-            security = null;
-        
-        this.cookieStr = cookieStr;
-    }
-
-    public String getTitle()
-    {
-        return name;
-    }
-
-    public InformationDesc getInformation(final Locale locale)
-    {
-        return new InformationDesc(this, new Locale[] {locale}) {
-            protected List getItems(Object key)
-            {
-                // Should we populate this list with applet attribute tags?
-                List result = new ArrayList();
-                return result;
-            }
-        };
-    }
-
-    public ResourcesDesc getResources(final Locale locale, final String os,
-                                      final String arch)
-    {
-        return new ResourcesDesc(this, new Locale[] {locale}, new String[] {os},
-        new String[] {arch}) {
-            public List getResources(Class launchType)
-            {
-                List result = new ArrayList();
-                result.addAll(sharedResources.getResources(launchType));
-
-                // Need to add the JAR manually...
-                //should this be done to sharedResources on init?
-                try
-                {
-                    if (launchType.equals(JARDesc.class))
-                    {
-                        for (int i = 0; i < jars.length; i++)
-                            if (jars[i].length() > 0)
-                                result.add(new JARDesc(new URL(codeBase, jars[i]),
-                                        null, null, false, true, false, true));
-                        
-                        boolean cacheable = true;
-
-                        if (atts.get("cache_option") != null && 
-                                ((String) atts.get("cache_option")).equalsIgnoreCase("no"))
-                            cacheable = false;
-
-                        for (int i = 0; i < cache_jars.length; i++) {
-                            
-                            String[] jar_and_ver = cache_jars[i].split(";");
-                            
-                            String jar = jar_and_ver[0];
-                            Version version = null;
-                            
-                            if (jar.length() == 0)
-                                continue;
-                            
-                            if (jar_and_ver.length > 1) {
-                                version = new Version(jar_and_ver[1]);
-                            }
-
-                            result.add(new JARDesc(new URL(codeBase, jar),
-                                    version, null, false, true, false, cacheable));
-                        }
-                        
-                        for (int i = 0; i < cache_ex_jars.length; i++) {
-
-                            if (cache_ex_jars[i].length() == 0)
-                                continue;
-                            
-                            String[] jar_info = cache_ex_jars[i].split(";");
-                            
-                            String jar = jar_info[0].trim();
-                            Version version = null;
-                            boolean lazy = true;
-                            
-                            if (jar_info.length > 1) {
-                                
-                                // format is name[[;preload];version]
-
-                                if (jar_info[1].equals("preload")) {
-                                    lazy = false;
-                                } else {
-                                    version = new Version(jar_info[1].trim());
-                                }
-                                
-                                if (jar_info.length > 2) {
-                                    lazy = false;
-                                    version = new Version(jar_info[2].trim());
-                                }
-                            }
-
-                            result.add(new JARDesc(new URL(codeBase, jar),
-                                    version, null, lazy, true, false, false));
-                        }
-                    }
-                }
-                catch (MalformedURLException ex)
-                    { }
-                return result;
-            }
-
-            public JARDesc[] getJARs() {
-                List resources = getResources(JARDesc.class);
-                ArrayList<JARDesc> jars = new ArrayList<JARDesc>();
-
-                //Only get the JARDescs
-                for (int i = 0; i < resources.size(); i++) {
-                    Object resource = resources.get(i);
-                    if (resource instanceof JARDesc)
-                        jars.add((JARDesc) resource);
-                }
-
-                Object[] objectArray = jars.toArray();
-                JARDesc[] jarArray = new JARDesc[objectArray.length];
-
-                for (int i = 0; i < objectArray.length; i++)
-                    jarArray[i] = (JARDesc) objectArray[i];
-
-                return jarArray;  
-            }
-            
-            public void addResource(Object resource)
-            {
-                // todo: honor the current locale, os, arch values
-                sharedResources.addResource(resource);
-            }
-
-        };
-    }
-
-    public boolean isApplet() {
-        return true;
-    }
-    public boolean isApplication() {
-        return false;
-    }
-    public boolean isComponent() {
-        return false;
-    }
-    public boolean isInstaller() {
-        return false;
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/PropertyDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/** 
- * The property element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $
- */
-public class PropertyDesc {
-
-    /** the key name */
-    private String key;
-
-    /** the value */
-    private String value;
-
-
-    /**
-     * Creates a property descriptor.
-     *
-     * @param key the key name
-     * @param value the value
-     */
-    public PropertyDesc(String key, String value) {
-        this.key = key;
-        this.value = value;
-    }
-
-    /**
-     * Returns the property's key 
-     */
-    public String getKey() {
-        return key;
-    }
-
-    /**
-     * Returns the property's value 
-     */
-    public String getValue() {
-        return value;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/ResourcesDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.awt.Dimension;
-import java.net.*;
-import java.util.*;
-
-/**
- * The resources element.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $
- */
-public class ResourcesDesc {
-
-    /** the locales of these resources */
-    private Locale locales[];
-
-    /** the OS for these resources */
-    private String os[];
-
-    /** the arch for these resources */
-    private String arch[];
-
-    /** the JNLPFile this information is for */
-    private JNLPFile jnlpFile;
-
-    /** list of jars, packages, properties, and extensions */
-    private List resources = new ArrayList(); // mixed list makes easier for lookup code
-
-
-    /**
-     * Create a representation of one information section of the
-     * JNLP File.
-     *
-     * @param jnlpFile JNLP file the resources are for
-     * @param locales the locales of these resources
-     * @param os the os of these resources
-     * @param arch the arch of these resources
-     */
-    public ResourcesDesc(JNLPFile jnlpFile, Locale locales[], String os[], String arch[]) {
-        this.jnlpFile = jnlpFile;
-        this.locales = locales;
-        this.os = os;
-        this.arch = arch;
-    }
-
-    /**
-     * Returns the JVMs.
-     */
-    public JREDesc[] getJREs() {
-        List resources = getResources(JREDesc.class);
-        return (JREDesc[]) resources.toArray( new JREDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the main JAR for these resources.  There first JAR
-     * is returned if no JARs are specified as the main JAR, and if
-     * there are no JARs defined then null is returned.
-     */
-    public JARDesc getMainJAR() {
-        JARDesc jars[] = getJARs();
-
-        for (int i=0; i < jars.length; i++)
-            if (jars[i].isMain())
-                return jars[i];
-
-        if (jars.length > 0)
-            return jars[0];
-        else 
-            return null;
-    }
-
-    /**
-     * Returns all of the JARs. 
-     */
-    public JARDesc[] getJARs() {
-        List resources = getResources(JARDesc.class);
-        return (JARDesc[]) resources.toArray( new JARDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the JARs with the specified part name. 
-     *
-     * @param partName the part name, null and "" equivalent
-     */
-    public JARDesc[] getJARs(String partName) {
-        List resources = getResources(JARDesc.class);
-
-        for (int i = resources.size(); i-- > 0;) {
-            JARDesc jar = (JARDesc) resources.get(i);
-
-            if (!(""+jar.getPart()).equals(""+partName))
-                resources.remove(i);
-        }
-
-        return (JARDesc[]) resources.toArray( new JARDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the Extensions.
-     */
-    public ExtensionDesc[] getExtensions() {
-        List resources = getResources(ExtensionDesc.class);
-        return (ExtensionDesc[]) resources.toArray( new ExtensionDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the Packages.
-     */
-    public PackageDesc[] getPackages() {
-        List resources = getResources(PackageDesc.class);
-        return (PackageDesc[]) resources.toArray( new PackageDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the Packages that match the specified class name.
-     *
-     * @param className the fully qualified class name
-     * @return the PackageDesc objects matching the class name
-     */
-    public PackageDesc[] getPackages(String className) {
-        List resources = getResources(PackageDesc.class);
-
-        for (int i = resources.size(); i-- > 0;) {
-            PackageDesc pk = (PackageDesc) resources.get(i);
-
-            if (!pk.matches(className))
-                resources.remove(i);
-        }
-
-        return (PackageDesc[]) resources.toArray( new PackageDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the Properties as a list.
-     */
-    public PropertyDesc[] getProperties() {
-        List resources = getResources(PropertyDesc.class);
-        return (PropertyDesc[]) resources.toArray( new PropertyDesc[resources.size()] );
-    }
-
-    /**
-     * Returns the properties as a map.
-     */
-    public Map getPropertiesMap() {
-        Properties properties = new Properties();
-        List resources = getResources(PropertyDesc.class);
-        for (int i=0; i < resources.size(); i++) {
-            PropertyDesc prop = (PropertyDesc) resources.get(i);
-            properties.put( prop.getKey(), prop.getValue() );
-        }
-
-        return properties;
-    }
-
-    /**
-     * Returns the os required by these resources, or null if no
-     * locale was specified in the JNLP file.
-     */
-    public String[] getOS() {
-        return os;
-    }
-
-    /**
-     * Returns the architecture required by these resources, or null
-     * if no locale was specified in the JNLP file.
-     */
-    public String[] getArch() {
-        return arch;
-    }
-
-    /**
-     * Returns the locale required by these resources, or null if no
-     * locale was specified in the JNLP file.
-     */
-    public Locale[] getLocales() {
-        return locales;
-    }
-
-    /**
-     * Returns the JNLPFile the resources are for.
-     */
-    public JNLPFile getJNLPFile() {
-        return jnlpFile;
-    }
-
-    /**
-     * Returns all resources of the specified type.
-     */
-    public List getResources(Class type) {
-        List result = new ArrayList();
-
-        for (int i=0; i < resources.size(); i++)
-            if ( type.isAssignableFrom(resources.get(i).getClass()) )
-                result.add(resources.get(i));
-
-        return result;
-    }
-
-    /**
-     * Add a resource.
-     */
-    public void addResource(Object resource) {
-        // if this is going to stay public it should probably take an
-        // interface instead of an Object
-        if (resource == null)
-            throw new IllegalArgumentException("null resource");
-
-        resources.add(resource);
-    }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/SecurityDesc.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.security.*;
-import java.awt.AWTPermission;
-
-/**
- * The security element.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $
- */
-public class SecurityDesc {
-
-    // todo: make sure classloader's native code support checks
-    // the security permissions
-
-    // shouldn't need to verify that native code only runs in
-    // trusted environment because the parser and/or classloader
-    // should kick it.
-
-    /** All permissions. */
-    public static final Object ALL_PERMISSIONS = "All";
-
-    /** Applet permissions. */
-    public static final Object SANDBOX_PERMISSIONS = "Sandbox";
-
-    /** J2EE permissions. */
-    public static final Object J2EE_PERMISSIONS = "J2SE";
-
-    /** permissions type */
-    private Object type;
-
-    /** the download host */
-    private String downloadHost;
-
-    /** the JNLP file */
-    private JNLPFile file;
-
-
-    /** basic permissions for restricted mode */
-    private static Permission j2eePermissions[] = {
-        new AWTPermission("accessClipboard"),
-        // disabled because we can't at this time prevent an
-        // application from accessing other applications' event
-        // queues, or even prevent access to security dialog queues.
-        //
-        // new AWTPermission("accessEventQueue"),
-        new AWTPermission("showWindowWithoutWarningBanner"),
-        new RuntimePermission("exitVM"),
-        new RuntimePermission("loadLibrary"),
-        new RuntimePermission("queuePrintJob"),
-        new SocketPermission("*", "connect"),
-        new SocketPermission("localhost:1024-", "accept, listen"),
-        new FilePermission("*", "read, write"),
-        new PropertyPermission("*", "read"),
-    };
-
-    /** basic permissions for restricted mode */
-    private static Permission sandboxPermissions[] = {
-        new SocketPermission("localhost:1024-", "listen"),
-        // new SocketPermission("<DownloadHost>", "connect, accept"), // added by code
-        new PropertyPermission("java.version", "read"),
-        new PropertyPermission("java.vendor", "read"),
-        new PropertyPermission("java.vendor.url", "read"),
-        new PropertyPermission("java.class.version", "read"),
-        new PropertyPermission("os.name", "read"),
-        new PropertyPermission("os.version", "read"),
-        new PropertyPermission("os.arch", "read"),
-        new PropertyPermission("file.separator", "read"),
-        new PropertyPermission("path.separator", "read"),
-        new PropertyPermission("line.separator", "read"),
-        new PropertyPermission("java.specification.version", "read"),
-        new PropertyPermission("java.specification.vendor", "read"),
-        new PropertyPermission("java.specification.name", "read"),
-        new PropertyPermission("java.vm.specification.vendor", "read"),
-        new PropertyPermission("java.vm.specification.name", "read"),
-        new PropertyPermission("java.vm.version", "read"),
-        new PropertyPermission("java.vm.vendor", "read"),
-        new PropertyPermission("java.vm.name", "read"),
-        new RuntimePermission("exitVM"),
-        new RuntimePermission("stopThread"),
-        new AWTPermission("showWindowWithoutWarningBanner"),
-        // disabled because we can't at this time prevent an
-        // application from accessing other applications' event
-        // queues, or even prevent access to security dialog queues.
-        //
-        // new AWTPermission("accessEventQueue"),
-    };
-
-
-    /**
-     * Create a security descriptor.
-     *
-     * @param file the JNLP file
-     * @param type the type of security
-     * @param downloadHost the download host (can always connect to)
-     */
-    public SecurityDesc(JNLPFile file, Object type, String downloadHost) {
-        this.file = file;
-        this.type = type;
-        this.downloadHost = downloadHost;
-    }
-
-    /**
-     * Returns the permissions type, one of: ALL_PERMISSIONS,
-     * SANDBOX_PERMISSIONS, J2EE_PERMISSIONS.
-     */
-    public Object getSecurityType() {
-        return type;
-    }
-
-    /**
-     * Returns a PermissionCollection containing the basic
-     * permissions granted depending on the security type.
-     */
-    public PermissionCollection getPermissions() {
-        Permissions permissions = new Permissions();
-
-        // all
-        if (type == ALL_PERMISSIONS) {
-            permissions.add(new AllPermission());
-            return permissions;
-        }
-
-        // restricted
-        if (type == SANDBOX_PERMISSIONS) {
-            for (int i=0; i < sandboxPermissions.length; i++)
-                permissions.add(sandboxPermissions[i]);
-
-            if (downloadHost != null)
-                permissions.add(new SocketPermission(downloadHost,
-                                                     "connect, accept"));
-        }
-
-        // j2ee
-        if (type == J2EE_PERMISSIONS)
-            for (int i=0; i < j2eePermissions.length; i++)
-                permissions.add(j2eePermissions[i]);
-
-        // properties
-        PropertyDesc props[] = file.getResources().getProperties();
-        for (int i=0; i < props.length; i++) {
-            // should only allow jnlp.* properties if in sandbox?
-            permissions.add(new PropertyPermission(props[i].getKey(), "read,write"));
-        }
-
-        return permissions;
-    }
-
-}
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/Version.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * A JNLP Version string in the form "1.2-3_abc" followed by an
- * optional + (includes all later versions) or * (matches any
- * suffixes on versions).  More than one version can be included
- * in a string by separating them with spaces.<p>
- *
- * Version strings are divided by "._-" charecters into parts.
- * These parts are compared numerically if they can be parsed as
- * integers or lexographically as strings otherwise.  If the
- * number of parts is different between two version strings then
- * the smaller one is padded with zero or the empty string.  Note
- * that the padding in this version means that 1.2+ matches
- * 1.4.0-beta1, but may not in future versions.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $ 
- */
-public class Version {
-
-    // to do: web start does not match versions with a "-" like
-    // "1.4-beta1" using the + modifier, change to mimic that
-    // behavior.
-
-    // also refactor into Version and VersionID classes so that
-    // individual version ids can be easily modified to add/remove
-    // "*" and "+" modifiers.
-
-    /** separates parts of a version string */
-    private static String seperators = ".-_";
-
-    /** magic key for whether a version part was created due to normalization */
-    private static String emptyString = new String("<EMPTY>"); // not intern'ed
-
-    /** contains all the versions matched */
-    private String versionString;
-
-
-    /**
-     * Create a Version object based on a version string (ie, 
-     * "1.2.3+ 4.56*").
-     */
-    public Version(String versions) {
-        versionString = versions;
-    }
-
-    /**
-     * Returns true if the version represents a <i>version-id</i> (a
-     * single version number such as 1.2) and false otherwise.
-     */
-    public boolean isVersionId() {
-        if (-1 != versionString.indexOf(" "))
-            return false;
-
-        return true;
-    }
-
-    /**
-     * Returns true if all of this version's version-ids match one
-     * or more of the specifed version's version-id.
-     *
-     * @param version a version string
-     */
-    public boolean matches(String version) {
-        return matches(new Version(version));
-    }
-
-    /**
-     * Returns true if all of this version's version-ids match one
-     * or more of the specifed version's version-id.
-     *
-     * @param version a Version object
-     */
-    public boolean matches(Version version) {
-        List versionStrings = version.getVersionStrings();
-
-        for (int i=0; i < versionStrings.size(); i++) {
-            if (!this.matchesSingle( (String)versionStrings.get(i) ))
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns true if any of this version's version-ids match one
-     * or more of the specifed version's version-id.
-     *
-     * @param version a version string
-     */
-    public boolean matchesAny(String version) {
-        return matches(new Version(version));
-    }
-
-
-    /**
-     * Returns true if any of this version's version-ids match one
-     * or more of the specifed version's version-id.
-     *
-     * @param version a Version object
-     */
-    public boolean matchesAny(Version version) {
-        List versionStrings = version.getVersionStrings();
-
-        for (int i=0; i < versionStrings.size(); i++) {
-            if (this.matchesSingle( (String)versionStrings.get(i) ))
-                return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns whether a single version string is supported by this
-     * Version.
-     *
-     * @param version a non-compound version of the form "1.2.3[+*]"
-     */
-    private boolean matchesSingle(String version) {
-        List versionStrings = this.getVersionStrings();
-        for (int i=0; i < versionStrings.size(); i++) {
-            if ( matches(version, (String)versionStrings.get(i)) )
-                return true;
-        }
-        return false;
-    }
-
-
-    /**
-     * Returns whether a single version string is supported by
-     * another single version string.
-     *
-     * @param subversion a non-compound version without "+" or "*"
-     * @param version a non-compound version optionally with "+" or "*"
-     */
-    private boolean matches(String subversion, String version) {
-        List subparts = getParts(subversion);
-        List parts = getParts(version);
-
-        int maxLength = Math.max(subversion.length(), version.length());
-        if (version.endsWith("*")) // star means rest of parts irrelevant: truncate them
-            maxLength = parts.size();
-
-        normalize(new List[] {subparts, parts}, maxLength);
-
-        if (equal(subparts, parts))
-            return true;
-
-        if (version.endsWith("+") && greater(subparts, parts))
-            return true;
-
-        return false;
-    }
-
-    /**
-     * Returns whether the parts of one version are equal to the
-     * parts of another version.
-     *
-     * @param parts1 normalized version parts 
-     * @param parts2 normalized version parts
-     */
-    protected boolean equal(List parts1, List parts2) {
-        for (int i=0; i < parts1.size(); i++) {
-            if ( 0 != compare((String)parts1.get(i), (String)parts2.get(i)) )
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns whether the parts of one version are greater than 
-     * the parts of another version.
-     *
-     * @param parts1 normalized version parts 
-     * @param parts2 normalized version parts
-     */
-    protected boolean greater(List parts1, List parts2) {
-        //if (true) return false;
-
-        for (int i=0; i < parts1.size(); i++) {
-            // if part1 > part2 then it's a later version, so return true
-            if (compare((String)parts1.get(i), (String)parts2.get(i)) > 0)
-                return true;
-
-            // if part1 < part2 then it's a ealier version, so return false
-            if (compare((String)parts1.get(i), (String)parts2.get(i)) < 0)
-                return false;
-
-            // if equal go to next part
-        }
-
-        // all parts were equal
-        return false; // not greater than
-    }
-
-    /**
-     * Compares two parts of a version string, by value if both can
-     * be interpreted as integers or lexically otherwise.  If a part
-     * is the result of normalization then it can be the Integer
-     * zero or an empty string.
-     *
-     * Returns a value equivalent to part1.compareTo(part2);
-     *
-     * @param part1 a part of a version string
-     * @param part2 a part of a version string
-     * @return comparison of the two parts
-     */
-    protected int compare(String part1, String part2) {
-        Integer number1 = new Integer(0);
-        Integer number2 = new Integer(0);
-
-        // compare as integers
-        try {
-            if (!(part1 == emptyString)) // compare to magic normalization key
-                number1 = Integer.valueOf(part1);
-
-            if (!(part2 == emptyString)) // compare to magic normalization key
-                number2 = Integer.valueOf(part2);
-
-            return number1.compareTo(number2);
-        }
-        catch (NumberFormatException ex) {
-            // means to compare as strings
-        }
-
-        if (part1 == emptyString)
-            part1 = "";
-        if (part2 == emptyString)
-            part2 = "";
-
-        return part1.compareTo(part2);
-    }
-
-    /**
-     * Normalize version strings so that they contain the same
-     * number of constituent parts.
-     *
-     * @param versions list array of parts of a version string
-     * @param maxLength truncate lists to this maximum length
-     */
-    protected void normalize(List versions[], int maxLength) {
-        int length = 0;
-        for (int i=0; i < versions.length; i++)
-            length = Math.max(length, versions[i].size());
-
-        if (length > maxLength)
-            length = maxLength;
-
-        for (int i=0; i < versions.length; i++) {
-            // remove excess elements
-            while (versions[i].size() > length)
-                versions[i].remove( versions[i].size()-1 );
-
-            // add in empty pad elements
-            while (versions[i].size() < length)
-                versions[i].add( emptyString );
-        }
-    }
-
-    /**
-     * Return the individual version strings that make up a Version.
-     */
-    protected List getVersionStrings() {
-        ArrayList strings = new ArrayList();
-
-        StringTokenizer st = new StringTokenizer(versionString, " ");
-        while (st.hasMoreTokens())
-            strings.add( st.nextToken() );
-
-        return strings;
-    }
-
-    /**
-     * Return the constituent parts of a version string.
-     *
-     * @param oneVersion a single version id string (not compound)
-     */
-    protected List getParts(String oneVersion) {
-        ArrayList strings = new ArrayList();
-
-        StringTokenizer st = new StringTokenizer(oneVersion, seperators+"+*");
-        while (st.hasMoreTokens()) {
-            strings.add( st.nextToken() );
-        }
-
-        return strings;
-    }
-
-    public String toString() {
-        return versionString;
-    }
-
-    /**
-     * Test.
-     */
-    /*
-    public static void main(String args[]) {
-        Version jvms[] = {
-            new Version("1.1* 1.3*"),
-            new Version("1.2+"),
-        };
-
-        Version versions[] = {
-            new Version("1.1"),
-            new Version("1.1.8"),
-            new Version("1.2"),
-            new Version("1.3"),
-            new Version("2.0"),
-            new Version("1.3.1"),
-            new Version("1.2.1"),
-            new Version("1.3.1-beta"),
-            new Version("1.1 1.2"),
-            new Version("1.2 1.3"),
-        };
-
-        for (int j = 0; j < jvms.length; j++) {
-            for (int v = 0; v < versions.length; v++) {
-                System.out.print( jvms[j].toString() + " " );
-                if (!jvms[j].matches(versions[v]))
-                    System.out.print( "!" );
-                System.out.println( "matches " + versions[v].toString() );
-            }
-        }
-
-        System.out.println("Test completed");
-    }
-    */
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheEntry.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.reflect.*;
-import java.security.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * Describes an entry in the cache.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.10 $ 
- */
-public class CacheEntry {
-
-    /** the remote resource location */
-    private URL location;
-
-    /** the requested version */
-    private Version version;
-
-    /** info about the cached file */
-    private PropertiesFile properties;
-
-
-    /**
-     * Create a CacheEntry for the resources specified as a remote
-     * URL.
-     *
-     * @param location the remote resource location
-     * @param version the version of the resource
-     */
-    public CacheEntry(URL location, Version version) {
-        this.location = location;
-        this.version = version;
-
-        File infoFile = CacheUtil.getCacheFile(location, version);
-        infoFile = new File(infoFile.getPath()+".info"); // replace with something that can't be clobbered
-
-        properties = new PropertiesFile(infoFile, JNLPRuntime.getMessage("CAutoGen"));
-    }
-
-    /**
-     * Initialize the cache entry data from a connection to the
-     * remote resource (does not store data).
-     */
-    void initialize(URLConnection connection) {
-        long modified = connection.getLastModified();
-        long length = connection.getContentLength(); // an int
-
-        properties.setProperty("content-length", Long.toString(length));
-        properties.setProperty("last-modified", Long.toString(modified));
-    }
-
-    /**
-     * Returns the remote location this entry caches.
-     */
-    public URL getLocation() {
-        return location;
-    }
-
-    /**
-     * Returns the time in the local system clock that the file was
-     * most recently checked for an update.
-     */
-    public long getLastUpdated() {
-        try {
-            return Long.parseLong(properties.getProperty("last-updated"));
-        }
-        catch (Exception ex) {
-            return 0;
-        }
-    }
-
-    /**
-     * Sets the time in the local system clock that the file was
-     * most recently checked for an update.
-     */
-    public void setLastUpdated(long updatedTime) {
-        properties.setProperty("last-updated", Long.toString(updatedTime));
-    }
-
-    /**
-     * Returns whether there is a version of the URL contents in
-     * the cache and it is up to date.  This method may not return
-     * immediately.
-     *
-     * @param connection a connection to the remote URL
-     * @return whether the cache contains the version
-     */
-    public boolean isCurrent(URLConnection connection) {
-        boolean cached = isCached();
-
-        if (!cached)
-            return false;
-
-        try {
-            long remoteModified = connection.getLastModified();
-            long cachedModified = Long.parseLong(properties.getProperty("last-modified"));
-
-            if (remoteModified > 0 && remoteModified <= cachedModified)
-                return true;
-            else
-                return false;
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            return cached; // if can't connect return whether already in cache
-        }
-    }
-
-    /**
-     * Returns true if the cache has a local copy of the contents
-     * of the URL matching the specified version string.
-     *
-     * @return true if the resource is in the cache
-     */
-    public boolean isCached() {
-        File localFile = CacheUtil.getCacheFile(location, version);
-        if (!localFile.exists())
-            return false;
-
-        try {
-            long cachedLength = localFile.length();
-            long remoteLength = Long.parseLong(properties.getProperty("content-length", "-1"));
-
-            if (remoteLength >= 0 && cachedLength != remoteLength)
-                return false;
-            else
-                return true;
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            return false; // should throw?
-        }
-    }
-
-    /**
-     * Save the current information for the cache entry.
-     */
-    protected void store() {
-        properties.store();
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/CacheUtil.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,394 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.reflect.*;
-import java.security.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * Provides static methods to interact with the cache, download
- * indicator, and other utility methods.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.17 $
- */
-public class CacheUtil {
-
-    private static String R(String key, Object param) { 
-        return JNLPRuntime.getMessage(key, new Object[] {param}); 
-    }
-
-    /**
-     * Compares a URL using string compare of its protocol, host,
-     * port, path, query, and anchor.  This method avoids the host
-     * name lookup that URL.equals does for http: protocol URLs.
-     * It may not return the same value as the URL.equals method
-     * (different hostnames that resolve to the same IP address,
-     * ie sourceforge.net and www.sourceforge.net).
-     */
-    public static boolean urlEquals(URL u1, URL u2) {
-        if (u1==u2)
-            return true;
-        if (u1==null || u2==null)
-            return false;
-
-        if (!compare(u1.getProtocol(), u2.getProtocol(), true) ||
-            !compare(u1.getHost(), u2.getHost(), true) ||
-            //u1.getDefaultPort() != u2.getDefaultPort() || // only in 1.4
-            !compare(u1.getPath(), u2.getPath(), false) ||
-            !compare(u1.getQuery(), u2.getQuery(), false) ||
-            !compare(u1.getRef(), u2.getRef(), false))
-            return false;
-        else
-            return true;
-    }
-
-    /**
-     * Caches a resource and returns a URL for it in the cache;
-     * blocks until resource is cached.  If the resource location is
-     * not cacheable (points to a local file, etc) then the original
-     * URL is returned.<p>
-     *
-     * @param location location of the resource
-     * @param version the version, or null
-     * @return either the location in the cache or the original location
-     */
-    public static URL getCachedResource(URL location, String cookieStr, Version version, UpdatePolicy policy) {
-        ResourceTracker rt = new ResourceTracker();
-        rt.addResource(location, cookieStr, version, policy);
-        try {
-            File f = rt.getCacheFile(location);
-            return f.toURL();
-        }
-        catch (MalformedURLException ex) {
-            return location;
-        }
-    }
-
-    /**
-     * Compare strings that can be null.
-     */
-    private static boolean compare(String s1, String s2, boolean ignore) {
-        if (s1==s2)
-            return true;
-        if (s1==null || s2==null)
-            return false;
-
-        if (ignore)
-            return s1.equalsIgnoreCase(s2);
-        else
-            return s1.equals(s2);
-    }
-
-    /**
-     * Returns the Permission object necessary to access the
-     * resource, or null if no permission is needed.
-     */
-    public static Permission getReadPermission(URL location, Version version) {
-        if (CacheUtil.isCacheable(location, version)) {
-            File file = CacheUtil.getCacheFile(location, version);
-
-            return new FilePermission(file.getPath(), "read");
-        }
-        else {
-            try {
-                // this is what URLClassLoader does
-                return location.openConnection().getPermission();
-            }
-            catch (java.io.IOException ioe) {
-                // should try to figure out the permission
-            	if (JNLPRuntime.isDebug())
-            		ioe.printStackTrace();
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Returns whether there is a version of the URL contents in the
-     * cache and it is up to date.  This method may not return
-     * immediately.
-     *
-     * @param source the source URL
-     * @param version the versions to check for
-     * @param connection a connection to the URL, or null
-     * @return whether the cache contains the version
-     * @throws IllegalArgumentException if the source is not cacheable
-     */
-    public static boolean isCurrent(URL source, Version version, URLConnection connection) {
-
-        if (!isCacheable(source, version))
-            throw new IllegalArgumentException(R("CNotCacheable", source));
-
-        try {
-            if (connection == null)
-                connection = source.openConnection();
-
-            connection.connect();
-
-            CacheEntry entry = new CacheEntry(source, version); // could pool this
-            boolean result = entry.isCurrent(connection);
-
-            if (JNLPRuntime.isDebug())
-                System.out.println("isCurrent: "+source+" = "+result);
-
-            return result;
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            return isCached(source, version); // if can't connect return whether already in cache
-        }
-    }
-
-    /**
-     * Returns true if the cache has a local copy of the contents of
-     * the URL matching the specified version string.
-     *
-     * @param source the source URL
-     * @param version the versions to check for
-     * @return true if the source is in the cache
-     * @throws IllegalArgumentException if the source is not cacheable
-     */
-    public static boolean isCached(URL source, Version version) {
-        if (!isCacheable(source, version))
-            throw new IllegalArgumentException(R("CNotCacheable", source));
-
-        CacheEntry entry = new CacheEntry(source, version); // could pool this
-        boolean result = entry.isCached();
-
-        if (JNLPRuntime.isDebug())
-            System.out.println("isCached: "+source+" = "+result);
-
-        return result;
-    }
-
-    /**
-     * Returns whether the resource can be cached as a local file;
-     * if not, then URLConnection.openStream can be used to obtain
-     * the contents.
-     */
-    public static boolean isCacheable(URL source, Version version) {
-        if (source == null)
-            return false;
-
-        if (source.getProtocol().equals("file"))
-            return false;
-
-        if (source.getProtocol().equals("jar"))
-            return false;
-
-        return true;
-    }
-
-    /**
-     * Returns the file for the locally cached contents of the
-     * source.  This method returns the file location only and does
-     * not download the resource.  The latest version of the
-     * resource that matches the specified version will be returned.
-     *
-     * @param source the source URL
-     * @param version the version id of the local file
-     * @return the file location in the cache, or null if no versions cached
-     * @throws IllegalArgumentException if the source is not cacheable
-     */
-    public static File getCacheFile(URL source, Version version) {
-        // ensure that version is an version id not version string
-
-        if (!isCacheable(source, version))
-            throw new IllegalArgumentException(R("CNotCacheable", source));
-
-        try {
-            File localFile = urlToPath(source, "cache");
-            localFile.getParentFile().mkdirs();
-
-            return localFile;
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            return null;
-        }
-    }
-
-    /**
-     * Returns a buffered output stream open for writing to the
-     * cache file.
-     *
-     * @param source the remote location
-     * @param version the file version to write to
-     */
-    public static OutputStream getOutputStream(URL source, Version version) throws IOException {
-        File localFile = getCacheFile(source, version);
-        OutputStream out = new FileOutputStream(localFile);
-
-        return new BufferedOutputStream(out);
-    }
-
-    /**
-     * Copies from an input stream to an output stream.  On
-     * completion, both streams will be closed.  Streams are
-     * buffered automatically.
-     */
-    public static void streamCopy(InputStream is, OutputStream os) throws IOException {
-        if (!(is instanceof BufferedInputStream))
-            is = new BufferedInputStream(is);
-
-        if (!(os instanceof BufferedOutputStream))
-            os = new BufferedOutputStream(os);
-
-        try {
-            byte b[] = new byte[4096];
-            while (true) {
-                int c = is.read(b, 0, b.length);
-                if (c == -1)
-                    break;
-
-                os.write(b, 0, c);
-            }
-        }
-        finally {
-            is.close();
-            os.close();
-        }
-    }
-
-    /**
-     * Converts a URL into a local path string within the runtime's
-     * base directory.
-     *
-     * @param location the url
-     * @param subdir subdirectory under the base directory
-     * @return the file
-     */
-    public static File urlToPath(URL location, String subdir) {
-        StringBuffer path = new StringBuffer();
-
-        if (subdir != null) {
-            path.append(subdir);
-            path.append(File.separatorChar);
-        }
-
-        path.append(location.getProtocol());
-        path.append(File.separatorChar);
-        path.append(location.getHost());
-        path.append(File.separatorChar);
-        path.append(location.getPath().replace('/', File.separatorChar));
-
-        return new File(JNLPRuntime.getBaseDir(), fixPath(path.toString()));
-    }
-
-    /**
-     * Clean up a string by removing characters that can't appear in
-     * a local file name.
-     */
-    private static String fixPath(String path) {
-        char badChars[] = { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
-
-        for (int i=0; i < badChars.length; i++)
-            if (badChars[i] != File.separatorChar)
-                if (-1 != path.indexOf(badChars[i]))
-                    path = path.replace(badChars[i], 'X');
-
-        return path;
-    }
-
-    /**
-     * Waits until the resources are downloaded, while showing a
-     * progress indicator.
-     *
-     * @param tracker the resource tracker
-     * @param resources the resources to wait for
-     * @param title name of the download
-     */
-    public static void waitForResources(ApplicationInstance app, ResourceTracker tracker, URL resources[], String title) {
-        DownloadIndicator indicator = JNLPRuntime.getDefaultDownloadIndicator();
-        DownloadServiceListener listener = null;
-
-        try {
-            if (indicator == null) {
-                tracker.waitForResources(resources, 0);
-                return;
-            }
-
-            // see if resources can be downloaded very quickly; avoids
-            // overhead of creating display components for the resources
-            if (tracker.waitForResources(resources, indicator.getInitialDelay())) 
-                return;
-
-            // only resources not starting out downloaded are displayed
-            List urlList = new ArrayList();
-            for (int i=0; i < resources.length; i++) {
-                if (!tracker.checkResource(resources[i]))
-                    urlList.add(resources[i]);
-            }
-            URL undownloaded[] = (URL[]) urlList.toArray( new URL[urlList.size()] );
-
-            listener = indicator.getListener(app, title, undownloaded);
-
-            do {
-                long read = 0;
-                long total = 0;
-
-                for (int i=0; i < undownloaded.length; i++) {
-                    // add in any -1's; they're insignificant
-                    total += tracker.getTotalSize(undownloaded[i]);
-                    read += tracker.getAmountRead(undownloaded[i]);
-                }
-
-                int percent = (int)( (100*read)/Math.max(1,total) );
-
-                for (int i=0; i < undownloaded.length; i++)
-                    listener.progress(undownloaded[i], "version",
-                                      tracker.getAmountRead(undownloaded[i]),
-                                      tracker.getTotalSize(undownloaded[i]),
-                                      percent);
-            }
-            while (!tracker.waitForResources(resources, indicator.getUpdateRate()));
-
-            // make sure they read 100% until indicator closes
-            for (int i=0; i < undownloaded.length; i++)
-                listener.progress(undownloaded[i], "version",
-                                  tracker.getTotalSize(undownloaded[i]),
-                                  tracker.getTotalSize(undownloaded[i]),
-                                  100);
-
-        }
-        catch (InterruptedException ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-        }
-        finally {
-            if (listener != null)
-                indicator.disposeListener(listener);
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,321 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.net.*;
-import java.util.*;
-import java.util.List;
-import javax.swing.*;
-import javax.swing.Timer;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * Show the progress of downloads.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.3 $ 
- */
-public class DefaultDownloadIndicator implements DownloadIndicator {
-
-    // todo: rewrite this to cut down on size/complexity; smarter
-    // panels (JList, renderer) understand resources instead of
-    // nested panels and grid-bag mess.
-
-    // todo: fix bug where user closes download box and it
-    // never(?) reappears.
-
-    // todo: UI for user to cancel/restart download
-
-    // todo: this should be synchronized at some point but conflicts
-    // aren't very likely.
-
-    private static String downloading = JNLPRuntime.getMessage("CDownloading");
-    private static String complete = JNLPRuntime.getMessage("CComplete");
-
-    /** time to wait after completing but before window closes */
-    private static final int CLOSE_DELAY = 750;
-
-    /** the display window */
-    private static JFrame frame; 
-
-    /** shared constraint */
-    static GridBagConstraints vertical;
-    static GridBagConstraints verticalIndent;
-    static { 
-        vertical = new GridBagConstraints();
-        vertical.gridwidth = GridBagConstraints.REMAINDER;
-        vertical.weightx = 1.0;
-        vertical.fill = GridBagConstraints.HORIZONTAL;
-        vertical.anchor = GridBagConstraints.WEST;
-
-        verticalIndent = (GridBagConstraints) vertical.clone();
-        verticalIndent.insets = new Insets(0, 10, 3, 0);
-    }
-
-    /**
-     * Return the update rate.
-     */
-    public int getUpdateRate() {
-        return 150; //ms
-    }
-
-    /**
-     * Return the initial delay before obtaining a listener.
-     */
-    public int getInitialDelay() {
-        return 300; //ms
-    }
-
-    /**
-     * Return a download service listener that displays the progress
-     * in a shared download info window.
-     *
-     * @param app the downloading application, or null if N/A
-     * @param downloadName name identifying the download to the user
-     * @param resources initial urls to display (not required)
-     */
-    public DownloadServiceListener getListener(ApplicationInstance app, String downloadName, URL resources[]) {
-        DownloadPanel result = new DownloadPanel(downloadName);
-
-        if (frame == null) {
-            frame = new JFrame(downloading+"...");
-            frame.getContentPane().setLayout(new GridBagLayout());
-        }
-
-        if (resources != null)
-            for (int i=0; i < resources.length; i++)
-                result.addProgressPanel(resources[i], null);
-
-        frame.getContentPane().add(result, vertical);
-        frame.pack();
-
-        if (!frame.isVisible()) {
-            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
-            Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(frame.getGraphicsConfiguration());
-            Dimension screen = new Dimension(screenSize.width - insets.left , 
-                    screenSize.height - insets.top);
-            frame.setLocation(screen.width-frame.getWidth(),
-                              screen.height-frame.getHeight());
-        }
-
-        frame.show();
-
-        return result;
-    }
-
-    /**
-     * Remove a download service listener that was obtained by
-     * calling the getDownloadListener method from the shared
-     * download info window.
-     */
-    public void disposeListener(final DownloadServiceListener listener) {
-        if (!(listener instanceof DownloadPanel))
-            return;
-
-        ActionListener hider = new ActionListener() {
-            public void actionPerformed(ActionEvent evt) {
-                if (frame.getContentPane().getComponentCount() == 1)
-                    frame.hide();
-
-                frame.getContentPane().remove((DownloadPanel) listener);
-                frame.pack();
-            }
-        };
-
-        Timer timer = new Timer(CLOSE_DELAY, hider);
-        timer.setRepeats(false);
-        timer.start();
-    }
-
-
-
-    /**
-     * Groups the url progress in a panel.
-     */
-    static class DownloadPanel extends JPanel implements DownloadServiceListener {
-
-        /** the download name */
-        private String downloadName;
-
-        /** Downloading part: */
-        private JLabel header = new JLabel();
-
-        /** list of URLs being downloaded */
-        private List urls = new ArrayList();
-
-        /** list of ProgressPanels */
-        private List panels = new ArrayList();
-
-
-        /**
-         * Create a new download panel for with the specified download
-         * name.
-         */
-        protected DownloadPanel(String downloadName) {
-            setLayout(new GridBagLayout());
-
-            this.downloadName = downloadName;
-            this.add(header, vertical);
-            header.setFont(header.getFont().deriveFont(Font.BOLD));
-
-            setOverallPercent(0);
-        }
-
-        /**
-         * Add a ProgressPanel for a URL.
-         */
-        protected void addProgressPanel(URL url, String version) {
-            if (!urls.contains(url)) {
-                ProgressPanel panel = new ProgressPanel(url, version);
-
-                add(panel, verticalIndent);
-                frame.pack();
-
-                urls.add(url);
-                panels.add(panel);
-            }
-        }
-
-        /**
-         * Update the download progress of a url.
-         */
-        protected void update(final URL url, final String version, final long readSoFar, final long total, final int overallPercent) {
-            Runnable r = new Runnable() {
-                public void run() {
-                    if (!urls.contains(url))
-                        addProgressPanel(url, version);
-
-                    setOverallPercent(overallPercent);
-
-                    ProgressPanel panel = (ProgressPanel) panels.get(urls.indexOf(url));
-                    panel.setProgress(readSoFar, total);
-                    panel.repaint();
-                }
-            };
-            SwingUtilities.invokeLater(r);
-        }
-
-        /**
-         * Sets the overall percent completed.
-         */
-        public void setOverallPercent(int percent) {
-            // don't get whole string from resource and sub in
-            // values because it'll be doing a MessageFormat for
-            // each update.
-            header.setText(downloading+" "+downloadName+": "+percent+"% "+complete+".");
-        }
-
-        /**
-         * Called when a download failed.
-         */
-        public void downloadFailed(URL url, String version) {
-            update(url, version, -1, -1, -1);
-        }
-
-        /**
-         * Called when a download has progressed.
-         */
-        public void progress(URL url, String version, long readSoFar, long total, int overallPercent) {
-            update(url, version, readSoFar, total, overallPercent);
-        }
-
-        /**
-         * Called when an archive is patched.
-         */
-        public void upgradingArchive(URL url, String version, int patchPercent, int overallPercent) {
-            update(url, version, patchPercent, 100, overallPercent);
-        }
-
-        /**
-         * Called when a download is being validated.
-         */
-        public void validating(URL url, String version, long entry, long total, int overallPercent) {
-            update(url, version, entry, total, overallPercent);
-        }
-
-    };
-
-
-
-    /**
-     * A progress bar with the URL next to it.
-     */
-    static class ProgressPanel extends JPanel {
-        private JPanel bar = new JPanel();
-
-        private long total;
-        private long readSoFar;
-
-        ProgressPanel(URL url, String version) {
-            JLabel location = new JLabel(" "+url.getHost()+"/"+url.getFile());
-
-            bar.setMinimumSize(new Dimension(80,15));
-            bar.setPreferredSize(new Dimension(80,15));
-            bar.setOpaque(false);
-
-            setLayout(new GridBagLayout());
-
-            GridBagConstraints gbc = new GridBagConstraints();
-            gbc.weightx = 0.0;
-            gbc.fill = GridBagConstraints.NONE;
-            gbc.gridwidth = GridBagConstraints.RELATIVE;
-            add(bar, gbc);
-
-            gbc.insets = new Insets(0, 3, 0, 0);
-            gbc.weightx = 1.0;
-            gbc.fill = GridBagConstraints.HORIZONTAL;
-            gbc.gridwidth = GridBagConstraints.REMAINDER;
-            gbc.anchor = GridBagConstraints.WEST;
-            add(location, gbc);
-        }
-
-        public void setProgress(long readSoFar, long total) {
-            this.readSoFar = readSoFar;
-            this.total = total;
-        }
-
-        public void paintComponent(Graphics g) {
-            super.paintComponent(g);
-
-            int x = bar.getX();
-            int y = bar.getY();
-            int h = bar.getHeight();
-            int w = bar.getWidth();
-
-            if (readSoFar <= 0 || total <= 0) {
-                // make barber pole
-            }
-            else {
-                double progress = (double)readSoFar / (double)total;
-                int divide = (int)(w * progress);
-
-                g.setColor(Color.white);
-                g.fillRect(x, y, w, h);
-                g.setColor(Color.blue);
-                g.fillRect(x+1, y+1, divide-1, h-1);
-            }
-        }
-    };
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/DownloadIndicator.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.net.*;
-import java.util.*;
-import java.util.List;
-import javax.swing.*;
-import javax.swing.Timer;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * A DownloadIndicator creates DownloadServiceListeners that are
- * notified of resources being transferred and their progress.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.8 $ 
- */
-public interface DownloadIndicator {
-
-    /**
-     * Return a download service listener that displays the progress
-     * of downloading resources.  Update messages may be reported
-     * for URLs that are not included initially.<p>
-     *
-     * Progress messages are sent as if the DownloadServiceListener
-     * were listening to a DownloadService request.  The listener
-     * will receive progress messages from time to time during the
-     * download. <p>
-     *
-     * @param app JNLP application downloading the files, or null if not applicable
-     * @param downloadName name identifying the download to the user
-     * @param resources initial urls to display, empty if none known at start
-     */
-    public DownloadServiceListener getListener(ApplicationInstance app,
-                                               String downloadName, 
-                                               URL resources[]);
-
-    /**
-     * Indicates that a download service listener that was obtained
-     * from the getDownloadListener method will no longer be used.
-     * This method can be used to ensure that progress dialogs are
-     * properly removed once a particular download is finished.
-     *
-     * @param listener the listener that is no longer in use
-     */
-    public void disposeListener(DownloadServiceListener listener);
-
-    /**
-     * Return the desired time in milliseconds between updates.
-     * Updates are not guarenteed to occur based on this value; for
-     * example, they may occur based on the download percent or some
-     * other factor.
-     *
-     * @return rate in milliseconds, must be &gt;= 0
-     */
-    public int getUpdateRate();
-
-    /**
-     * Return a time in milliseconds to wait for a download to
-     * complete before obtaining a listener for the download.  This
-     * value can be used to skip lengthy operations, such as
-     * initializing a GUI, for downloads that complete quickly.  The
-     * getListener method is not called if the download completes
-     * in less time than the returned delay.
-     *
-     * @return delay in milliseconds, must be &gt;= 0
-     */
-    public int getInitialDelay();
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/Resource.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * Information about a single resource to download.
- * This class tracks the downloading of various resources of a
- * JNLP file to local files.  It can be used to download icons,
- * jnlp and extension files, jars, and jardiff files using the
- * version based protocol or any file using the basic download
- * protocol.<p>
- *
- * Resources can be put into download groups by specifying a part
- * name for the resource.  The resource tracker can also be
- * configured to prefetch resources, which are downloaded in the
- * order added to the media tracker.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.9 $ 
- */
-public class Resource {
-
-    // todo: fix resources to handle different versions
-
-    // todo: IIRC, any resource is checked for being up-to-date
-    // only once, regardless of UpdatePolicy.  verify and fix.
-
-    /** status bits */
-    public static final int UNINITIALIZED = 0;
-    public static final int CONNECT = 1;
-    public static final int CONNECTING = 2;
-    public static final int CONNECTED = 4;
-    public static final int DOWNLOAD = 8;
-    public static final int DOWNLOADING = 16;
-    public static final int DOWNLOADED = 32;
-    public static final int ERROR = 64;
-    public static final int STARTED = 128; // enqueued or being worked on
-
-    /** list of weak references of resources currently in use */
-    private static WeakList resources = new WeakList();
-
-    /** weak list of trackers monitoring this resource */
-    private WeakList trackers = new WeakList();
-
-    /** the remote location of the resource */
-    URL location;
-    
-    /** cookie string to send with the resource request */
-    String cookieStr;
-
-    /** the local file downloaded to */
-    File localFile;
-
-    /** the requested version */
-    Version requestVersion;
-
-    /** the version downloaded from server */
-    Version downloadVersion;
-
-    /** connection to resource */
-    URLConnection connection;
-
-    /** amount in bytes transferred */
-    long transferred = 0;
-
-    /** total size of the resource, or -1 if unknown */
-    long size = -1;
-
-    /** the status of the resource */
-    int status = UNINITIALIZED;
-    
-    /** Update policy for this resource */
-    UpdatePolicy updatePolicy;
-
-    /**
-     * Create a resource.
-     */
-    private Resource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
-        this.location = location;
-        this.requestVersion = requestVersion;
-        this.updatePolicy = updatePolicy;
-        this.cookieStr = cookieStr;
-    }
-
-    /**
-     * Return a shared Resource object representing the given
-     * location and version.
-     */
-    public static Resource getResource(URL location, String cookieStr, UpdatePolicy updatePolicy, Version requestVersion) {
-        synchronized (resources) {
-            Resource resource = new Resource(location, cookieStr, updatePolicy, requestVersion);
-
-            int index = resources.indexOf(resource);
-            if (index >= 0) { // return existing object
-                Resource result = (Resource) resources.get(index);
-                if (result != null)
-                    return result;
-            }
-
-            resources.add(resource);
-            resources.trimToSize();
-
-            return resource;
-        }
-    }
-
-    /**
-     * Returns the remote location of the resource.
-     */
-    public URL getLocation() {
-        return location;
-    }
-    
-    /**
-     * Returns the cookie string associated with this resource
-     */
-    public String getCookieStr() {
-        return cookieStr;
-    }
-
-    /**
-     * Returns the tracker that first created or monitored the
-     * resource, or null if no trackers are monitoring the resource.
-     */
-    ResourceTracker getTracker() {
-        synchronized (trackers) {
-            List t = trackers.hardList();
-            if (t.size() > 0)
-                return (ResourceTracker) t.get(0);
-
-            return null;
-        }
-    }
-
-    /**
-     * Returns true if any of the specified flags are set.
-     */
-    public boolean isSet(int flag) {
-        if (flag == UNINITIALIZED)
-            return status == UNINITIALIZED;
-        else
-            return (status & flag) != 0;
-    }
-
-    /**
-     * Returns the update policy for this resource
-     * 
-     * @return The update policy
-     */
-    public UpdatePolicy getUpdatePolicy() {
-        return this.updatePolicy;
-    }
-
-    /**
-     * Returns a human-readable status string.
-     */
-    private String getStatusString(int flag) {
-        StringBuffer result = new StringBuffer();
-
-        if (flag == 0) result.append("<> ");
-        if ((flag & CONNECT) != 0) result.append("CONNECT ");
-        if ((flag & CONNECTING) != 0) result.append("CONNECTING ");
-        if ((flag & CONNECTED) != 0) result.append("CONNECTED ");
-        if ((flag & DOWNLOAD) != 0) result.append("DOWNLOAD ");
-        if ((flag & DOWNLOADING) != 0) result.append("DOWNLOADING ");
-        if ((flag & DOWNLOADED) != 0) result.append("DOWNLOADED ");
-        if ((flag & ERROR) != 0) result.append("ERROR ");
-        if ((flag & STARTED) != 0) result.append("STARTED ");
-
-        return result.deleteCharAt(result.length()-1).toString();
-    }
-
-    /**
-     * Changes the status by clearing the flags in the first
-     * parameter and setting the flags in the second.  This method
-     * is synchronized on this resource.
-     */
-    public void changeStatus(int clear, int add) {
-        int orig = 0;
-
-        synchronized(this) {
-            orig = status;
-
-            this.status &= ~clear;
-            this.status |= add;
-        }
-
-        if (JNLPRuntime.isDebug())
-            if (status != orig) {
-                System.out.print("Status: "+getStatusString(status));
-                if ((status & ~orig) != 0) 
-                    System.out.print(" +("+getStatusString(status & ~orig)+")");
-                if ((~status & orig) != 0) 
-                    System.out.print(" -("+getStatusString(~status & orig)+")");
-                System.out.println(" @ "+location.getPath());
-            }
-    }
-
-    /**
-     * Removes the tracker to the list of trackers monitoring this
-     * resource.
-     */
-    public void removeTracker(ResourceTracker tracker) {
-        synchronized (trackers) {
-            trackers.remove(tracker);
-            trackers.trimToSize();
-        }
-    }
-
-    /**
-     * Adds the tracker to the list of trackers monitoring this
-     * resource.
-     */
-    public void addTracker(ResourceTracker tracker) {
-        synchronized (trackers) {
-            List t = trackers.hardList(); // prevent GC between contains and add
-            if (!t.contains(tracker))
-                trackers.add(tracker);
-
-            trackers.trimToSize();
-        }
-    }
-
-    /**
-     * Instructs the trackers monitoring this resource to fire a
-     * download event.
-     */
-    protected void fireDownloadEvent() {
-        List send;
-
-        synchronized (trackers) {
-            send = trackers.hardList();
-        }
-
-        for (int i=0; i < send.size(); i++) {
-            ResourceTracker rt = (ResourceTracker) send.get(i);
-            rt.fireDownloadEvent(this);
-        }
-    }
-
-    public boolean equals(Object other) {
-        if (other instanceof Resource) {
-            // this prevents the URL handler from looking up the IP
-            // address and doing name resolution; much faster so less
-            // time spent in synchronized addResource determining if
-            // Resource is already in a tracker, and better for offline
-            // mode on some OS.
-            return CacheUtil.urlEquals(location, ((Resource)other).location);
-        }
-        return false;
-    }
-
-    public String toString() {
-        return "location="+location.toString() + " state="+getStatusString(status);
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/ResourceTracker.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,973 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.event.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * This class tracks the downloading of various resources of a
- * JNLP file to local files in the cache.  It can be used to
- * download icons, jnlp and extension files, jars, and jardiff
- * files using the version based protocol or any file using the
- * basic download protocol (jardiff and version not implemented
- * yet).<p>
- *
- * The resource tracker can be configured to prefetch resources,
- * which are downloaded in the order added to the media
- * tracker.<p>
- *
- * Multiple threads are used to download and cache resources that
- * are actively being waited for (blocking a caller) or those that
- * have been started downloading by calling the startDownload
- * method.  Resources that are prefetched are downloaded one at a
- * time and only if no other trackers have requested downloads.
- * This allows the tracker to start downloading many items without
- * using many system resources, but still quickly download items
- * as needed.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.22 $ 
- */
-public class ResourceTracker {
-
-    // todo: use event listener arrays instead of lists
-
-    // todo: see if there is a way to set the socket options just
-    // for use by the tracker so checks for updates don't hang for
-    // a long time.
-
-    // todo: ability to restart/retry a hung download
-
-    // todo: move resource downloading/processing code into Resource
-    // class, threading stays in ResourceTracker
-
-    // todo: get status method? and some way to convey error status
-    // to the caller.
-
-    // todo: might make a tracker be able to download more than one
-    // version of a resource, but probably not very useful.
-
-
-    // defines 
-    //    ResourceTracker.Downloader (download threads)
-
-    // separately locks on (in order of aquire order, ie, sync on prefetch never syncs on lock):
-    //   lock, prefetch, this.resources, each resource, listeners
-
-    /** notified on initialization or download of a resource */
-    private static Object lock = new Integer(0); // used to lock static structures
-
-    // shortcuts
-    private static final int UNINITIALIZED = Resource.UNINITIALIZED;
-    private static final int CONNECT = Resource.CONNECT;
-    private static final int CONNECTING = Resource.CONNECTING;
-    private static final int CONNECTED = Resource.CONNECTED;
-    private static final int DOWNLOAD = Resource.DOWNLOAD;
-    private static final int DOWNLOADING = Resource.DOWNLOADING;
-    private static final int DOWNLOADED = Resource.DOWNLOADED;
-    private static final int ERROR = Resource.ERROR;
-    private static final int STARTED = Resource.STARTED;
-
-    /** max threads */
-    private static final int maxThreads = 5;
-
-    /** running threads */
-    private static int threads = 0;
-
-    /** weak list of resource trackers with resources to prefetch */
-    private static WeakList prefetchTrackers = new WeakList();
-
-    /** resources requested to be downloaded */
-    private static ArrayList queue = new ArrayList();
-
-    /** resource trackers threads are working for (used for load balancing across multi-tracker downloads) */
-    private static ArrayList active = new ArrayList(); // 
-
-    /** the resources known about by this resource tracker */
-    private List resources = new ArrayList();
-
-    /** download listeners for this tracker */
-    private List listeners = new ArrayList();
-
-    /** whether to download parts before requested */ 
-    private boolean prefetch;
-
-
-    /**
-     * Creates a resource tracker that does not prefetch resources.
-     */
-    public ResourceTracker() {
-        this(false);
-    }
-
-    /**
-     * Creates a resource tracker.
-     *
-     * @param prefetch whether to download resources before requested. 
-     */
-    public ResourceTracker(boolean prefetch) {
-        this.prefetch = prefetch;
-
-        if (prefetch) {
-            synchronized (prefetchTrackers) {
-                prefetchTrackers.add(this);
-                prefetchTrackers.trimToSize();
-            }
-        }
-    }
-
-    /**
-     * Add a resource identified by the specified location and
-     * version.  The tracker only downloads one version of a given
-     * resource per instance (ie cannot download both versions 1 and
-     * 2 of a resource in the same tracker).
-     *
-     * @param location the location of the resource
-     * @param version the resource version
-     * @param updatePolicy whether to check for updates if already in cache
-     */
-    public void addResource(URL location, String cookieStr, Version version, UpdatePolicy updatePolicy) {
-        if (location == null)
-            throw new IllegalArgumentException("location==null");
-
-        Resource resource = Resource.getResource(location, cookieStr, updatePolicy, version);
-        boolean downloaded = false;
-
-        synchronized (resources) {
-            if (resources.contains(resource))
-                return;
-            resource.addTracker(this);
-            resources.add(resource);
-        }
-
-        // checkCache may take a while (loads properties file).  this
-        // should really be synchronized on resources, but the worst
-        // case should be that the resource will be updated once even
-        // if unnecessary.
-        downloaded = checkCache(resource, updatePolicy);
-
-        synchronized (lock) {
-            if (!downloaded)
-                if (prefetch && threads == 0) // existing threads do pre-fetch when queue empty
-                    startThread();
-        }
-    }
-
-    /**
-     * Removes a resource from the tracker.  This method is useful
-     * to allow memory to be reclaimed, but calling this method is
-     * not required as resources are reclaimed when the tracker is
-     * collected.
-     *
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public void removeResource(URL location) {
-        synchronized (resources) {
-            Resource resource = getResource(location);
-
-            if (resource != null) {
-                resources.remove(resource);
-                resource.removeTracker(this);
-            }
-
-            // should remove from queue? probably doesn't matter
-        }
-    }
-
-    /**
-     * Check the cache for a resource, and initialize the resource
-     * as already downloaded if found. <p>
-     *
-     * @param updatePolicy whether to check for updates if already in cache
-     * @return whether the resource are already downloaded 
-     */
-    private boolean checkCache(Resource resource, UpdatePolicy updatePolicy) {
-        if (!CacheUtil.isCacheable(resource.location, resource.downloadVersion)) {
-            // pretend that they are already downloaded; essentially
-            // they will just 'pass through' the tracker as if they were
-            // never added (for example, not affecting the total download size).
-            synchronized (resource) {
-                resource.changeStatus(0, DOWNLOADED|CONNECTED|STARTED);
-            }
-            fireDownloadEvent(resource);
-            return true;
-        }
-
-        if (updatePolicy != UpdatePolicy.ALWAYS && updatePolicy != UpdatePolicy.FORCE) { // save loading entry props file
-            CacheEntry entry = new CacheEntry(resource.location, resource.downloadVersion);
-
-            if (entry.isCached() && !updatePolicy.shouldUpdate(entry)) {
-                if (JNLPRuntime.isDebug())
-                    System.out.println("not updating: "+resource.location);
-
-                synchronized (resource) {
-                    resource.localFile = CacheUtil.getCacheFile(resource.location, resource.downloadVersion);
-                    resource.size = resource.localFile.length();
-                    resource.transferred = resource.localFile.length();
-                    resource.changeStatus(0, DOWNLOADED|CONNECTED|STARTED);
-                }
-                fireDownloadEvent(resource);
-                return true;
-            }
-        }
-        
-        if (updatePolicy == UpdatePolicy.FORCE) { // ALWAYS update
-            // When we are "always" updating, we update for each instance. Reset resource status.
-            resource.changeStatus(Integer.MAX_VALUE, 0);
-        }
-
-        // may or may not be cached, but check update when connection
-        // is open to possibly save network communication time if it
-        // has to be downloaded, and allow this call to return quickly
-        return false;
-    }
-
-    /**
-     * Adds the listener to the list of objects interested in
-     * receivind DownloadEvents.<p>
-     *
-     * @param location the resource to add a callback for
-     * @param runnable the runnable to call when resource is completed
-     */
-    public void addDownloadListener(DownloadListener listener) {
-        synchronized (listeners) {
-            if (!listeners.contains(listener))
-                listeners.add(listener);
-        }
-    }
-
-    /**
-     * Removes a download listener.
-     */
-    public void removeDownloadListener(DownloadListener listener) {
-        synchronized (listeners) {
-            listeners.remove(listener);
-        }
-    }
-
-    /**
-     * Fires the download event corresponding to the resource's
-     * state.  This method is typicall called by the Resource itself
-     * on each tracker that is monitoring the resource.  Do not call
-     * this method with any locks because the listeners may call
-     * back to this ResourceTracker.
-     */
-    protected void fireDownloadEvent(Resource resource) {
-        DownloadListener l[] = null;
-        synchronized (listeners) {
-            l = (DownloadListener[]) listeners.toArray(new DownloadListener[0]);
-        }
-
-        int status;
-        synchronized (resource) {
-            status = resource.status;
-        }
-
-        DownloadEvent event = new DownloadEvent(this, resource);
-        for (int i=0; i < l.length; i++) {
-            if (0 != ((ERROR|DOWNLOADED) & status))
-                l[i].downloadCompleted(event);
-            else if (0 != (DOWNLOADING & status))
-                l[i].downloadStarted(event);
-            else if (0 != (CONNECTING & status))
-                l[i].updateStarted(event);
-        }
-    }
-
-    /**
-     * Returns a URL pointing to the cached location of the
-     * resource, or the resource itself if it is a non-cacheable
-     * resource.<p>
-     *
-     * If the resource has not downloaded yet, the method will block
-     * until it has been transferred to the cache.<p>
-     *
-     * @param location the resource location
-     * @return the resource, or null if it could not be downloaded
-     * @throws IllegalArgumentException if the resource is not being tracked
-     * @see CacheUtil#isCacheable
-     */
-    public URL getCacheURL(URL location) {
-        try {
-            File f = getCacheFile(location);
-            if (f != null)
-                return f.toURL();
-        }
-        catch (MalformedURLException ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-        }
-
-        return location;
-    }
-
-    /**
-     * Returns a file containing the downloaded resource.  If the
-     * resource is non-cacheable then null is returned unless the
-     * resource is a local file (the original file is returned).<p>
-     *
-     * If the resource has not downloaded yet, the method will block
-     * until it has been transferred to the cache.<p>
-     *
-     * @param location the resource location
-     * @return a local file containing the resource, or null
-     * @throws IllegalArgumentException if the resource is not being tracked
-     * @see CacheUtil#isCacheable
-     */
-    public File getCacheFile(URL location) {
-        try {
-            Resource resource = getResource(location);
-            if (!resource.isSet(DOWNLOADED|ERROR))
-                waitForResource(location, 0);
-
-            if (resource.isSet(ERROR))
-                return null;
-
-            if (resource.localFile != null)
-                return resource.localFile;
-
-            if (location.getProtocol().equalsIgnoreCase("file")) {
-                File file = new File(location.getFile());
-                if (file.exists())
-                    return file;
-            }
-
-            return null;
-        }
-        catch (InterruptedException ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            return null; // need an error exception to throw
-        }
-    }
-
-    /**
-     * Returns an input stream that reads the contents of the
-     * resource.  For non-cacheable resources, an InputStream that
-     * reads from the source location is returned.  Otherwise the
-     * InputStream reads the cached resource.<p>
-     *
-     * This method will block while the resource is downloaded to
-     * the cache.
-     *
-     * @throws IOException if there was an error opening the stream
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public InputStream getInputStream(URL location) throws IOException {
-        try {
-            Resource resource = getResource(location);
-            if (!resource.isSet(DOWNLOADED|ERROR))
-                waitForResource(location, 0);
-
-            if (resource.localFile != null)
-                return new FileInputStream(resource.localFile);
-
-            return resource.location.openStream();
-        }
-        catch (InterruptedException ex) {
-            throw new IOException("wait was interrupted");
-        }
-    }
-
-    /**
-     * Wait for a group of resources to be downloaded and made
-     * available locally.
-     *
-     * @param urls the resources to wait for
-     * @param timeout the time in ms to wait before returning, 0 for no timeout
-     * @return whether the resources downloaded before the timeout
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public boolean waitForResources(URL urls[], long timeout) throws InterruptedException {
-        Resource resources[] = new Resource[ urls.length ];
-
-        synchronized(resources) { 
-            // keep the lock so getResource doesn't have to aquire it each time
-            for (int i=0; i < urls.length; i++)
-                resources[i] = getResource(urls[i]);
-        }
-
-        if (resources.length > 0)
-            return wait(resources, timeout);
-
-        return true;
-    }
-
-    /**
-     * Wait for a particular resource to be downloaded and made
-     * available.
-     *
-     * @param location the resource to wait for
-     * @param timeout the timeout, or 0 to wait until completed
-     * @return whether the resource downloaded before the timeout
-     * @throws InterruptedException if another thread interrupted the wait
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public boolean waitForResource(URL location, long timeout) throws InterruptedException {
-        return wait(new Resource[] { getResource(location) }, timeout);
-    }
-
-    /**
-     * Returns the number of bytes downloaded for a resource.
-     *
-     * @param location the resource location
-     * @return the number of bytes transferred
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public long getAmountRead(URL location) {
-        // not atomic b/c transferred is a long, but so what (each
-        // byte atomic? so probably won't affect anything...)
-        return getResource(location).transferred;
-    }
-
-    /**
-     * Returns whether a resource is available for use (ie, can be
-     * accessed with the getCacheFile method).
-     *
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public boolean checkResource(URL location) {
-        return getResource(location).isSet(DOWNLOADED|ERROR); // isSet atomic
-    }
-
-    /**
-     * Starts loading the resource if it is not already being
-     * downloaded or already cached.  Resources started downloading
-     * using this method may download faster than those prefetched
-     * by the tracker because the tracker will only prefetch one
-     * resource at a time to conserve system resources.
-     *
-     * @return true if the resource is already downloaded (or an error occurred) 
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public boolean startResource(URL location) {
-        Resource resource = getResource(location);
-
-        return startResource(resource);
-    }
-
-    /**
-     * Sets the resource status to connect and download, and
-     * enqueues the resource if not already started.
-     *
-     * @return true if the resource is already downloaded (or an error occurred) 
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    private boolean startResource(Resource resource) {
-        boolean enqueue = false;
-
-        synchronized (resource) {
-            if (resource.isSet(ERROR))
-                return true;
-
-            enqueue = !resource.isSet(STARTED);
-
-            if (!resource.isSet(CONNECTED | CONNECTING))
-                resource.changeStatus(0, CONNECT|STARTED);
-            if (!resource.isSet(DOWNLOADED | DOWNLOADING))
-                resource.changeStatus(0, DOWNLOAD|STARTED);
-
-            if (!resource.isSet(DOWNLOAD|CONNECT))
-                enqueue = false;
-        }
-
-        if (enqueue)
-            queueResource(resource);
-
-        return !enqueue;
-    }
-
-    /**
-     * Returns the number of total size in bytes of a resource, or
-     * -1 it the size is not known.
-     *
-     * @param location the resource location
-     * @return the number of bytes, or -1
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    public long getTotalSize(URL location) {
-        return getResource(location).size; // atomic
-    }
-
-    /**
-     * Start a new download thread if there are not too many threads
-     * already running.<p>
-     *
-     * Calls to this method should be synchronized on lock.
-     */
-    protected void startThread() {
-        if (threads < maxThreads) {
-            threads++;
-
-            Thread thread = new Thread(new Downloader());
-            thread.start();
-        }
-    }
-
-    /**
-     * A thread is ending, called by the thread itself.<p>
-     *
-     * Calls to this method should be synchronized.
-     */
-    private void endThread() {
-        threads--;
-
-        if (threads < 0) {
-            // this should never happen but try to recover
-            threads = 0;
-
-            if (queue.size() > 0) // if any on queue make sure a thread is running
-                startThread(); // look into whether this could create a loop
-
-            throw new RuntimeException("tracker threads < 0");
-        }
-
-        if (threads == 0) {
-            synchronized (prefetchTrackers) { 
-                queue.trimToSize(); // these only accessed by threads so no sync needed
-                active.clear(); // no threads so no trackers actively downloading
-                active.trimToSize();
-                prefetchTrackers.trimToSize();
-            }
-        }
-    }
-
-    /**
-     * Add a resource to the queue and start a thread to download or
-     * initialize it.
-     */
-    private void queueResource(Resource resource) {
-        synchronized (lock) {
-            if (!resource.isSet(CONNECT|DOWNLOAD))
-                throw new IllegalArgumentException("Invalid resource state (resource: "+resource+")");
-
-            queue.add(resource);
-            startThread();
-        }
-    }
-
-    /**
-     * Process the resource by either downloading it or initializing
-     * it.
-     */
-    private void processResource(Resource resource) {
-        boolean doConnect = false;
-        boolean doDownload = false;
-
-        synchronized (resource) {
-            if (resource.isSet(CONNECTING))
-                doConnect = true;
-        }
-        if (doConnect)
-            initializeResource(resource);
-
-        synchronized (resource) {
-            // return to queue if we just initalized but it still needs
-            // to download (not cached locally / out of date)
-            if (resource.isSet(DOWNLOAD)) // would be DOWNLOADING if connected before this method
-                queueResource(resource);
-
-            if (resource.isSet(DOWNLOADING))
-                doDownload = true;
-        }
-        if (doDownload)
-            downloadResource(resource);
-    }
-
-    /**
-     * Downloads an resource to a file.
-     */
-    private void downloadResource(Resource resource) {
-        resource.fireDownloadEvent(); // fire DOWNLOADING
-
-        try {
-            // create out second in case in does not exist
-            URLConnection con = getVersionedResourceURL(resource).openConnection();
-            
-            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
-                con.setRequestProperty("Cookie", resource.getCookieStr());
-
-            InputStream in = new BufferedInputStream(con.getInputStream());
-            OutputStream out = CacheUtil.getOutputStream(resource.location, resource.downloadVersion);
-            byte buf[] = new byte[1024];
-            int rlen;
-
-            while (-1 != (rlen = in.read(buf))) {
-                resource.transferred += rlen;
-                out.write(buf, 0, rlen);
-            }
-
-            in.close();
-            out.close();
-
-            // explicitly close the URLConnection.
-            if (con instanceof HttpURLConnection)
-                ((HttpURLConnection)con).disconnect();
-
-            resource.changeStatus(DOWNLOADING, DOWNLOADED);
-            synchronized(lock) {
-                lock.notifyAll(); // wake up wait's to check for completion
-            }
-            resource.fireDownloadEvent(); // fire DOWNLOADED
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            resource.changeStatus(0, ERROR);
-            synchronized(lock) {
-                lock.notifyAll(); // wake up wait's to check for completion
-            }
-            resource.fireDownloadEvent(); // fire ERROR
-        }
-    }
-
-    /**
-     * Open a URL connection and get the content length and other
-     * fields.
-     */
-    private void initializeResource(Resource resource) {
-        resource.fireDownloadEvent(); // fire CONNECTING
-
-        try {
-            File localFile = CacheUtil.getCacheFile(resource.location, resource.downloadVersion);
-
-            // connect
-            URLConnection connection = getVersionedResourceURL(resource).openConnection(); // this won't change so should be okay unsynchronized
-            
-            if (resource.getCookieStr() != null && resource.getCookieStr().length() > 0)
-                connection.setRequestProperty("Cookie", resource.getCookieStr());
-
-            int size = connection.getContentLength();
-            boolean current = CacheUtil.isCurrent(resource.location, resource.requestVersion, connection) && resource.getUpdatePolicy() != UpdatePolicy.FORCE;
-
-            synchronized(resource) {
-                resource.localFile = localFile;
-                // resource.connection = connection;
-                resource.size = size;
-                resource.changeStatus(CONNECT|CONNECTING, CONNECTED);
-
-                // check if up-to-date; if so set as downloaded
-                if (current)
-                    resource.changeStatus(DOWNLOAD|DOWNLOADING, DOWNLOADED);
-            }
-
-            // update cache entry
-            CacheEntry entry = new CacheEntry(resource.location, resource.requestVersion);
-            if (!current)
-                entry.initialize(connection);
-
-            entry.setLastUpdated(System.currentTimeMillis());
-            entry.store();
-
-            synchronized(lock) {
-                lock.notifyAll(); // wake up wait's to check for completion
-            }
-            resource.fireDownloadEvent(); // fire CONNECTED
-
-            // explicitly close the URLConnection.
-			if (connection instanceof HttpURLConnection)
-                ((HttpURLConnection)connection).disconnect();
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            resource.changeStatus(0, ERROR);
-            synchronized(lock) {
-                lock.notifyAll(); // wake up wait's to check for completion
-            }
-            resource.fireDownloadEvent(); // fire ERROR
-        }
-    }
-
-    
- 
-    private URL getVersionedResourceURL(Resource resource) {
-        String actualLocation = resource.location.getProtocol() + "://"
-                + resource.location.getHost();
-        if (resource.location.getPort() != -1) {
-            actualLocation += ":" + resource.location.getPort();
-        }
-        actualLocation += resource.location.getPath();
-        if (resource.requestVersion != null
-                && resource.requestVersion.isVersionId()) {
-            actualLocation += "?version-id=" + resource.requestVersion;
-        }
-        URL versionedURL;
-        try {
-            versionedURL = new URL(actualLocation);
-        } catch (MalformedURLException e) {
-            return resource.location;
-        }
-        return versionedURL;
-    }
- 
-    
-    /**
-     * Pick the next resource to download or initialize.  If there
-     * are no more resources requested then one is taken from a
-     * resource tracker with prefetch enabled.<p>
-     *
-     * The resource state is advanced before it is returned
-     * (CONNECT-&gt;CONNECTING).<p>
-     *
-     * Calls to this method should be synchronized on lock.<p>
-     *
-     * @return the resource to initialize or download, or null
-     */
-    private static Resource selectNextResource() {
-        Resource result;
-
-        // pick from queue
-        result = selectByFlag(queue, CONNECT, ERROR); // connect but not error
-        if (result == null)
-            result = selectByFlag(queue, DOWNLOAD, ERROR|CONNECT|CONNECTING);
-
-        // remove from queue if found
-        if (result != null)
-            queue.remove(result);
-
-        // prefetch if nothing found so far and this is the last thread
-        if (result == null && threads == 1)
-            result = getPrefetch();
-
-        if (result == null)
-            return null;
-
-        synchronized (result) {
-            if (result.isSet(CONNECT)) {
-                result.changeStatus(CONNECT, CONNECTING);
-            }
-            else if (result.isSet(DOWNLOAD)) {
-                // only download if *not* connecting, when done connecting
-                // select next will pick up the download part.  This makes
-                // all requested connects happen before any downloads, so
-                // the size is known as early as possible.
-                result.changeStatus(DOWNLOAD, DOWNLOADING);
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Returns the next resource to be prefetched before
-     * requested.<p>
-     *
-     * Calls to this method should be synchronized on lock.<p>
-     */
-    private static Resource getPrefetch() {
-        Resource result = null;
-        Resource alternate = null;
-
-        // first find one to initialize 
-        synchronized (prefetchTrackers) {
-            for (int i=0; i < prefetchTrackers.size() && result == null; i++) {
-                ResourceTracker tracker = (ResourceTracker) prefetchTrackers.get(i);
-                if (tracker == null)
-                    continue;
-
-                synchronized (tracker.resources) {
-                    result = selectByFlag(tracker.resources, UNINITIALIZED, ERROR);
-
-                    if (result == null && alternate == null)
-                        alternate = selectByFlag(tracker.resources, CONNECTED, ERROR|DOWNLOADED|DOWNLOADING|DOWNLOAD);
-                }
-            }
-        }
-
-        // if none to initialize, switch to download
-        if (result == null)
-            result = alternate;
-
-        if (result == null)
-            return null;
-
-        synchronized (result) {
-            ResourceTracker tracker = result.getTracker();
-            if (tracker == null)
-                return null; // GC of tracker happened between above code and here
-
-            // prevents startResource from putting it on queue since
-            // we're going to return it.
-            result.changeStatus(0, STARTED);
-
-            tracker.startResource(result);
-        }
-
-        return result;
-    }
-
-    /**
-     * Selects a resource from the source list that has the
-     * specified flag set.<p>
-     *
-     * Calls to this method should be synchronized on lock and
-     * source list.<p>
-     */
-    private static Resource selectByFlag(List source, int flag, int notflag) {
-        Resource result = null;
-        int score = Integer.MAX_VALUE;
-
-        for (int i=0; i < source.size(); i++) {
-            Resource resource = (Resource) source.get(i);
-            boolean selectable = false;
-
-            synchronized (resource) {
-                if (resource.isSet(flag) && !resource.isSet(notflag))
-                    selectable = true;
-            }
-
-            if (selectable) {
-                int activeCount = 0;
-
-                for (int j=0; j < active.size(); j++)
-                    if ((ResourceTracker)active.get(j) == resource.getTracker())
-                        activeCount++;
-
-                // try to spread out the downloads so that a slow host
-                // won't monopolize the downloads
-                if (activeCount < score) {
-                    result = resource;
-                    score = activeCount;
-                }
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Return the resource matching the specified URL.
-     *
-     * @throws IllegalArgumentException if the resource is not being tracked
-     */
-    private Resource getResource(URL location) {
-        synchronized (resources) {
-            for (int i=0; i < resources.size(); i++) {
-                Resource resource = (Resource) resources.get(i);
-
-                if (CacheUtil.urlEquals(resource.location, location))
-                    return resource;
-            }
-        }
-
-        throw new IllegalArgumentException("Location does not specify a resource being tracked.");
-    }
-
-    /**
-     * Wait for some resources.
-     *
-     * @param resources the resources to wait for
-     * @param timeout the timeout, or 0 to wait until completed
-     * @returns true if the resources were downloaded or had errors,
-     * false if the timeout was reached
-     * @throws InterruptedException if another thread interrupted the wait
-     */
-    private boolean wait(Resource resources[], long timeout) throws InterruptedException {
-        long startTime = System.currentTimeMillis();
-
-        // start them downloading / connecting in background
-        for (int i=0; i < resources.length; i++)
-            startResource(resources[i]);
-
-        // wait for completion
-        while (true) {
-            boolean finished = true;
-
-            synchronized (lock) {
-                // check for completion 
-                for (int i=0; i < resources.length; i++) {
-                	//NetX Deadlocking may be solved by removing this 
-                	//synch block.
-                    synchronized (resources[i]) {
-                        if (!resources[i].isSet(DOWNLOADED | ERROR)) {
-                            finished = false;
-                            break;
-                        }
-                    }
-                }
-                if (finished)
-                    return true;
-
-                // wait
-                long waitTime = 0;
-
-                if (timeout > 0) {
-                    waitTime = timeout - (System.currentTimeMillis()-startTime);
-                    if (waitTime <= 0)
-                        return false;
-                }
-
-                lock.wait(waitTime);
-            }
-        }
-    }
-
-
-    // inner classes
-
-    /** 
-     * This class downloads and initializes the queued resources.
-     */
-    class Downloader implements Runnable {
-        Resource resource = null;
-
-        public void run() {
-            while (true) {
-                synchronized (lock) {
-                    // remove from active list, used for load balancing
-                    if (resource != null)
-                        active.remove(resource.getTracker());
-
-                    resource = selectNextResource();
-
-                    if (resource == null) {
-                        endThread();
-                        break;
-                    }
-
-                    // add to active list, used for load balancing
-                    active.add(resource.getTracker());
-                }
-
-                try {
-                    processResource(resource);
-                }
-                catch (Exception ex) {
-                    if (JNLPRuntime.isDebug())
-                        ex.printStackTrace();
-                }
-            }
-            // should have a finally in case some exception is thrown by
-            // selectNextResource();
-        }
-    };
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/UpdatePolicy.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-// Copyright (C) 2002 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.cache;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.reflect.*;
-import java.security.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-/**
- * A policy that determines when a resource should be checked for
- * an updated version.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.3 $ 
- */
-public class UpdatePolicy {
-
-    // todo: implement session updating
-
-    // todo: doesn't seem to work in the same JVM, probably because
-    // Resource is being held by a tracker so it isn't collected;
-    // then next time a tracker adds the resource even if
-    // shouldUpdate==true it's state is already marked
-    // CONNECTED|DOWNLOADED.  Let the resource be collected or reset
-    // to UNINITIALIZED.
-
-    public static UpdatePolicy ALWAYS = new UpdatePolicy(0);
-    public static UpdatePolicy SESSION = new UpdatePolicy(-1);
-    public static UpdatePolicy FORCE = new UpdatePolicy(Long.MIN_VALUE);
-    public static UpdatePolicy NEVER = new UpdatePolicy(Long.MAX_VALUE);
-
-    private long timeDiff = -1;
-
-
-    /**
-     * Create a new update policy; this policy always updates the
-     * entry unless the shouldUpdate method is overridden.
-     */
-    public UpdatePolicy() {
-    }
-
-    /**
-     * Create an update policy that only checks a file for being
-     * updated if it has not been checked for longer than the
-     * specified time.
-     *
-     * @param timeDiff how long in ms until update needed
-     */
-    public UpdatePolicy(long timeDiff) {
-        this.timeDiff = timeDiff;
-    }
-
-    /**
-     * Returns whether the resource should be checked for being
-     * up-to-date.
-     */
-    public boolean shouldUpdate(CacheEntry entry) {
-        long updated = entry.getLastUpdated();
-        long current = System.currentTimeMillis();
-
-        if (current - updated >= timeDiff)
-            return true;
-        else
-            return false;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/cache/package.html	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the JNLP cache.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationEvent.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-// Copyright (C) 2002 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp.event;
-
-import java.util.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * This event is sent when an application is terminated.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $ 
- */
-public class ApplicationEvent extends EventObject {
-
-    /** the application instance */
-    private ApplicationInstance application;
-
-
-    /**
-     * Creates a launch event for the specified application
-     * instance.
-     *
-     * @param source the application instance
-     */
-    public ApplicationEvent(ApplicationInstance source) {
-        super(source);
-
-        this.application = source;
-    }
-
-    /** 
-     * Returns the application instance.
-     */
-    public ApplicationInstance getApplication() {
-        return application;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/ApplicationListener.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (C) 2002 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.event;
-
-import java.util.*;
-
-
-/**
- * The listener that is notified when an application instance is
- * terminated.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $ 
- */
-public interface ApplicationListener extends EventListener {
-
-    /**
-     * Invoked when the application is destroyed.
-     */
-    public void applicationDestroyed(ApplicationEvent applicationEvent);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadEvent.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-// Copyright (C) 2002 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp.event;
-
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * This event is sent during the launch of an
- * application.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.3 $ 
- */
-public class DownloadEvent extends EventObject {
-
-    /** the tracker */
-    private ResourceTracker tracker;
-
-    /** the resource */
-    private Resource resource;
-
-
-    /**
-     * Creates a launch event for the specified application
-     * instance.
-     *
-     * @param source the resource tracker
-     * @param resource the resource
-     */
-    public DownloadEvent(ResourceTracker source, Resource resource) {
-        super(source);
-
-        this.tracker = source;
-        this.resource = resource;
-    }
-
-    /**
-     * Returns the tracker that owns the resource.
-     */
-    public ResourceTracker getTracker() {
-        return tracker;
-    }
-
-    /** 
-     * Returns the location of the resource being downloaded.
-     */
-    public URL getResourceLocation() {
-        return resource.getLocation();
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/DownloadListener.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (C) 2002 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.event;
-
-import java.util.*;
-
-
-/**
- * The listener that is notified of the state of resources being
- * downloaded by a ResourceTracker.  Events may be delivered on a
- * background thread, and the event methods should complete
- * quickly so that they do not slow down other downloading in
- * progress by tying up a thread.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.3 $ 
- */
-public interface DownloadListener extends EventListener {
-
-    /**
-     * Called when a resource is checked for being up-to-date.
-     */
-    public void updateStarted(DownloadEvent downloadEvent);
-
-    /**
-     * Called when a download starts.
-     */
-    public void downloadStarted(DownloadEvent downloadEvent);
-
-    /**
-     * Called when a download completed or there was an error.
-     */
-    public void downloadCompleted(DownloadEvent downloadEvent);
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/event/package.html	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the JNLP events.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/package.html	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the classes that represent the parts of a
-Java Network Launching Protocol (JNLP) file as objects, and a way
-to launch a JNLP file as an application, applet, or installer.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Manifest.mf	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-Manifest-Version: 1.0
-Created-By: jnlp.sourceforge.net
-Specification-Title: netx JNLP client
-Sealed: true
-Main-Class: net.sourceforge.jnlp.runtime.Boot13
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/Messages.properties	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-# Default (English) UI messages for netx
-# L=Launcher, B=Boot, P=Parser, C=cache S=security
-#
-# General
-NullParameter=Null parameter
-ButOk=OK
-ButCancel=\ Cancel\ 
-ButBrowse=Browse...
-
-# LS - Severity
-LSMinor=Minor
-LSFatal=Fatal
-
-# LC - Category 
-LCSystem=System Error
-LCExternalLaunch=External Launch Error
-LCFileFormat=File Format Error
-LCReadError=Read Error
-LCClient=Application Error
-LCLaunching=Launch Error
-LCNotSupported=Unsupported Feature
-LCInit=Initialization Error
- 
-LAllThreadGroup=All JNLP applications
-LNullUpdatePolicy=Update policy cannot be null.
- 
-LThreadInterrupted=Thread interrupted while waiting for file to launch.
-LThreadInterruptedInfo=
-LCouldNotLaunch=Could not launch JNLP file.
-LCouldNotLaunchInfo=
-LCantRead=Could not read or parse the JNLP file.
-LCantReadInfo=
-LNullLocation=Could not determine .jnlp file location.
-LNullLocationInfo=An attempt was made to launch a JNLP file in another JVM, but the file could not be located.  In order to launch in an external JVM, the runtime must be able to locate the .jnlp file either in the local filesystem or on a server.
-LNetxJarMissing=Could not determine location of netx.jar.
-LNetxJarMissingInfo=An attempt was made to lauch a JNLP file in another JVM, but the netx.jar could not be located.  In order to launch in an external JVM, the runtime must be able to locate the netx.jar file.
-LNotToSpec=JNLP file not strictly to spec.
-LNotToSpecInfo=The JNLP file contains data that is prohibited by the JNLP specification.  The runtime can attempt to ignore the invalid information and continue launching the file.
-LNotApplication=Not an application file.
-LNotApplicationInfo=An attempt was made to load a non-application file as an application.
-LNotApplet=Not an applet file.
-LNotAppletInfo=An attempt was made to load a non-applet file as an applet.
-LNoInstallers=Installers not supported.
-LNoInstallersInfo=JNLP installer files are not yet supported.
-LInitApplet=Could not initialize applet.
-LInitAppletInfo=
-LInitApplication=Could not initialize application.
-LInitApplicationInfo=
-LNotLaunchable=Not a launchable JNLP file.
-LNotLaunchableInfo=File must be a JNLP application, applet, or installer type.
-LCantDetermineMainClass=Unknown Main-Class.
-LCantDetermineMainClassInfo=Could not determine the main class for this application.
-
-JNotApplet=File is not an applet.
-JNotApplication=File is not an application.
-JNotComponent=File is not a component.
-JNotInstaller=File is not an installer.
-JInvalidExtensionDescriptor=Extension does not refer to a component or installer (name={1}, location={2}).
-
-LNotVerified=Jars not verified.
-LCancelOnUserRequest=Canceled on user request.
-LFatalVerification=A fatal error occurred while trying to verify jars.
-LFatalVerificationInfo=
-
-LNotVerifiedDialog=Not all jars could be verified.
-LAskToContinue=Would you still like to continue running this application?
-
-# Parser
-PInvalidRoot=Root node is not a jnlp node
-PSpecUnsupported=Spec version not supported (supports {0})
-PNoResources=No resources section defined
-PUntrustedNative=nativelib element cannot be specified unless a trusted environment is requested.
-PExtensionHasJ2SE=j2se element cannot be specified in a component extension file.
-PInnerJ2SE=j2se element cannot be specified within a j2se element.
-PTwoMains=Duplicate main JAR defined in a resources element (there can be only one)
-PNativeHasMain=Cannot specify main attribute on native JARs.
-PNoInfoElement=No information section defined
-PTwoDescriptions=Duplicate description of kind {0}
-PSharing=Element "sharing-allowed" is illegal in a standard JNLP file
-PTwoSecurity=Only one security element allowed per JNLPFile.
-PEmptySecurity=Security element specified but does not contain a permissions element.
-PTwoDescriptors=Only one application descriptor element allowed per JNLPFile.
-PUnknownApplet=Unknown Applet
-PBadWidth=Invalid applet width.
-PBadHeight=Invalid applet height.
-PUrlNotInCodebase=Relative URL does not specify a subdirectory of the codebase. (node={0}, href={1}, base={2})
-PBadRelativeUrl=Invalid relative URL (node={0}, href={1}, base={2})
-PBadNonrelativeUrl=Invalid non-relative URL (node={0}, href={0}).
-PNeedsAttribute=The {0} element must specify a {1} attribute.
-PBadXML=Invalid XML document syntax.
-
-# Runtime
-BLaunchAbout=Launching about window...
-BNeedsFile=Must specify a .jnlp file
-BFileLoc=JNLP file location
-BArgNA=Arguments not used for this type of JNLP file (ignored).
-BParamNA=Parameters not used for this type of JNLP file (ignored).
-BBadProp=Incorrect property format {0} (should be key=value)
-BBadParam=Incorrect parameter format {0} (should be name=value)
-BNoDir=Directory {0} does not exist.
-BNoBase=No base directory (contains cache and other data)
-RNoResource=Missing Resource: {0}
-RShutdown=This exception to prevent shutdown of JVM, but the process has been terminated.
-RExitTaken=Exit class already set and caller is not exit class.
-RCantReplaceSM=Changing the SecurityManager is not allowed.
-RDenyStopped=Stopped applications have no permissions.
-RExitNoApp=Can not exit the JVM because the current application cannot be determined.
-
-# Boot options, message should be shorter than this ---------------->
-BOUsage=javaws [-run-options] <jnlp file>
-BOUsage2=javaws [-control-options]
-BOBasedir   = Directory where the cache is kept.
-BOJnlp      = Location of JNLP file to launch (url or file).
-BOArg       = Adds an application argument before launching.
-BOParam     = Adds an applet parameter before launching.
-BOProperty  = Sets a system property before launching.
-BOUpdate    = Update check if seconds since last checked.
-BOLicense   = Display the GPL license and exit.
-BOVerbose   = Enable verbose output.
-BOAbout     = Shows a sample application.
-BONosecurity= Disables the secure runtime environment.
-BONoupdate  = Disables checking for updates.
-BOHeadless  = Disables download window, other UIs.
-BOStrict    = Enables strict checking of JNLP file format.
-BOViewer    = Shows the trusted certificate viewer.
-BOUmask     = Sets the umask for files created by an application.
-BOHelp      = Print this message and exit.
-
-# Cache
-CAutoGen=automatically generated - do not edit
-CNotCacheable={0} is not a cacheable resource
-CDownloading=Downloading
-CComplete=Complete
-CChooseCache=Choose a cache directory...
-CChooseCacheInfo=Netx needs a location for storing cache files.
-CChooseCacheDir=Cache directory
-
-# Security
-SFileReadAccess=The application has requested read access to a file on the machine. Do you want to allow this action?
-SFileWriteAccess=The application has requested write access to a file on the machine. Do you want to allow this action?
-SSigUnverified=The application's digital signature cannot be verified. Do you want to run the application?
-SSigVerified=The application's digital signature has been verified. Do you want to run the application?
-SSignatureError=The application's digital signature has an error. Do you want to run the application?
-SUntrustedSource=The digital signature could not be verified by a trusted source. Only run if you trust the origin of the application.
-STrustedSource=The digital signature has been validated by a trusted source.
-SClipboardReadAccess=The application has requested read-only access to the system clipboard. Do you want to allow this action?
-SClipboardWriteAccess=The application has requested write-only access to the system clipboard. Do you want to allow this action?
-SPrinterAccess=The application has requested printer access. Do you want to allow this action?
-SNetworkAccess=The application has requested permission to establish connections to {0}. Do you want to allow this action?
-
-# Security - used for the More Information dialog
-SBadKeyUsage=Resources contain entries whose signer certificate's KeyUsage extension doesn't allow code signing.
-SBadExtendedKeyUsage=Resources contain entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing.
-SBadNetscapeCertType=Resources contain entries whose signer certificate's NetscapeCertType extension doesn't allow code signing.
-SHasUnsignedEntry=Resources contain unsigned entries which have not been integrity-checked.
-SHasExpiredCert=The digital signature has expired.
-SHasExpiringCert=Resources contain entries whose signer certificate will expire within six months.
-SNotYetValidCert=Resources contain entries whose signer certificate is not yet valid.
-SUntrustedCertificate=The digital signature was generated with an untrusted certificate.
-STrustedCertificate=The digital signature was generated with a trusted certificate.
-SRunWithoutRestrictions=This application will be run without the security restrictions normally provided by java.
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/about.jnlp	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<jnlp spec="1.0" href="about.jnlp" codebase="http://icedtea.classpath.org/netx/">
-  <information>
-    <title>About window for NetX</title>
-    <vendor>NetX</vendor>
-    <homepage href="http://jnlp.sourceforge.net/netx/"/>
-    <description>Displays information about NetX</description>
-    <offline/>
-  </information>
-  <resources>
-    <j2se version="1.4+"/>
-    <jar href="about.jar"/>
-  </resources>
-  <security>
-    <all-permissions/>
-  </security>
-  <application-desc main-class="net.sourceforge.jnlp.about.Main">
-  </application-desc>
-</jnlp>
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/default.jnlp	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<jnlp spec="1.0" href="default.jnlp" codebase="http://icedtea.classpath.org/netx/">
-  <information>
-    <title>About window for NetX</title>
-    <vendor>NetX</vendor>
-    <homepage href="http://jnlp.sourceforge.net/netx/"/>
-    <description>Displays information about NetX</description>
-    <offline/>
-  </information>
-  <resources>
-    <j2se version="1.4+"/>
-    <jar href="default.jar"/>
-  </resources>
-  <security>
-    <all-permissions/>
-  </security>
-  <application-desc main-class="net.sourceforge.jnlp.about.Main">
-  </application-desc>
-</jnlp>
-
Binary file overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/info-small.png has changed
Binary file overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/install.png has changed
Binary file overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/netx-icon.png has changed
Binary file overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/warning-small.png has changed
Binary file overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/resources/warning.png has changed
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppThreadGroup.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.awt.*;
-
-/**
- * Thread group for a JNLP application.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $ 
- */
-public class AppThreadGroup extends ThreadGroup {
-
-    /** the app */
-    private ApplicationInstance app = null;
-
-
-    /**
-     * Creates new JavaAppThreadGroup
-     *
-     * @param name of the App
-     */
-    public AppThreadGroup(ThreadGroup parent, String name) {
-        super(parent, name);
-    }
-
-    /**
-     * Sets the JNLP app this group is for; can only be called once.
-     */
-    public void setApplication(ApplicationInstance app) {
-        if (this.app != null)
-            throw new IllegalStateException("Application can only be set once");
-
-        this.app = app;
-    }
-
-    /**
-     * Returns the JNLP app for this thread group.
-     */
-    public ApplicationInstance getApplication() {
-        return app;
-    }
-
-    /**
-     * Handle uncaught exceptions for the app.
-     */
-    public void uncaughtException(Thread t, Throwable e) {
-        super.uncaughtException(t, e);
-    }
-
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletAudioClip.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.net.*;
-import java.io.*;
-import java.applet.*;
-import javax.sound.sampled.*;
-
-// based on Deane Richan's AppletAudioClip
-
-/**
- * An applet audio clip using the javax.sound API.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.8 $ 
- */
-public class AppletAudioClip implements AudioClip {
-
-    /** the clip */
-    private Clip clip;
-
-
-    /** 
-     * Creates new AudioClip.  If the clip cannot be opened no
-     * exception is thrown, instead the methods of the AudioClip
-     * return without performing any operations.
-     *
-     * @param location the clip location
-     */
-    public AppletAudioClip(URL location) {
-        try {
-            AudioInputStream stream = AudioSystem.getAudioInputStream(location);
-
-            clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
-            clip.open(stream);
-        }
-        catch (Exception ex) {
-            System.err.println("Error loading sound:"+location.toString());
-            clip = null;
-        }
-    }
-
-    /**
-     * Plays the clip in a continuous loop until the stop method is
-     * called.
-     */
-    public void loop() {
-        if (clip == null)
-            return;
-
-        clip.loop(Clip.LOOP_CONTINUOUSLY);
-    }
-
-    /**
-     * Plays the clip from the beginning.
-     */
-    public void play() {
-        if (clip == null)
-            return;
-
-        // applet audio clip resets to beginning when played again
-        clip.stop();
-        clip.setFramePosition(0);
-        clip.start();
-    }
-
-    /**
-     * Stops playing the clip.
-     */
-    public void stop() {
-        if (clip == null)
-            return;
-
-        clip.stop();
-    }
-
-    /**
-     * Stops playing the clip and disposes it; the clip cannot be
-     * played after being disposed.
-     */
-    void dispose() {
-        if (clip != null) {
-            clip.stop();
-            clip.flush();
-            clip.close();
-        }
-
-        clip = null;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletEnvironment.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.applet.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import java.util.List;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-import java.io.*;
-import javax.swing.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * The applet environment including stub, context, and frame.  The
- * default environment puts the applet in a non-resiable frame;
- * this can be changed by obtaining the frame and setting it
- * resizable.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.12 $ 
- */
-public class AppletEnvironment implements AppletContext, AppletStub {
-
-    /** the JNLP file */
-    private JNLPFile file;
-
-    /** the applet instance */
-    private AppletInstance appletInstance;
-
-    /** the applet */
-    private Applet applet;
-
-    /** the parameters */
-    private Map parameters;
-
-    /** the applet container */
-    private Container cont;
-
-    /** weak references to the audio clips */
-    private WeakList weakClips = new WeakList();
-
-    /** whether the applet has been started / displayed */
-    private boolean appletStarted = false;
-
-    /** whether the applet has been destroyed */
-    private boolean destroyed = false;
-
-
-    /**
-     * Create a new applet environment for the applet specified by
-     * the JNLP file.
-     */
-    public AppletEnvironment(JNLPFile file, final AppletInstance appletInstance, Container cont) {
-        this.file = file;
-        this.appletInstance = appletInstance;
-        this.applet = appletInstance.getApplet();
-
-        parameters = file.getApplet().getParameters();
-        this.cont = cont;
-    }
-
-    /**
-     * Create a new applet environment for the applet specified by
-     * the JNLP file, in a new frame.
-     */
-    public AppletEnvironment(JNLPFile file, final AppletInstance appletInstance) {
-        this(file, appletInstance, null);
-
-        Frame frame = new Frame(file.getApplet().getName() + " - Applet");
-        frame.setResizable(false);
-
-        appletInstance.addWindow(frame);
-        // may not need this once security manager can close windows
-        // that do not have app code on the stack
-        WindowListener closer = new WindowAdapter() {
-            public void windowClosing(WindowEvent event) {
-                appletInstance.destroy();
-                System.exit(0);
-            }
-        };
-        frame.addWindowListener(closer);
-        this.cont = frame;
-    }
-
-    /**
-     * Checks whether the applet has been destroyed, and throws an
-     * IllegalStateException if the applet has been destroyed of.
-     *
-     * @throws IllegalStateException
-     */
-    private void checkDestroyed() {
-        if (destroyed)
-            throw new IllegalStateException("Illegal applet stub/context access: applet destroyed.");
-    }
-
-    /**
-     * Disposes the applet's resources and disables the applet
-     * environment from further use; after calling this method the
-     * applet stub and context methods throw IllegalStateExceptions.
-     */
-    public void destroy() {
-        destroyed = true;
-
-        List clips = weakClips.hardList();
-        for (int i = 0; i < clips.size(); i++) {
-            ((AppletAudioClip)clips.get(i)).dispose();
-        }
-    }
-
-    /**
-     * Returns the frame that contains the applet.  Disposing this
-     * frame will destroy the applet.
-     */
-    public Container getAppletFrame() {
-        // TODO: rename this method to getAppletContainer ?
-        return cont;
-    }
-
-    /**
-     * Initialize, start, and show the applet.
-     */
-    public void startApplet() {
-        checkDestroyed();
-
-        if (appletStarted)
-            return;
-
-        appletStarted = true;
-
-        try {
-            AppletDesc appletDesc = file.getApplet();
-
-            if (cont instanceof AppletStub)
-                applet.setStub((AppletStub)cont);
-            else
-                applet.setStub(this);
-
-            cont.setLayout(new BorderLayout());
-            cont.add("Center", applet);
-            cont.validate();
-
-            // This is only needed if the applet is in its own frame.
-            if (cont instanceof Frame) {
-                Frame frame = (Frame) cont;
-                frame.pack(); // cause insets to be calculated
-
-                Insets insets = frame.getInsets();
-                frame.setSize(appletDesc.getWidth() + insets.left + insets.right,
-                              appletDesc.getHeight() + insets.top + insets.bottom);
-            }
-    
-            try {
-            	SwingUtilities.invokeAndWait(new Runnable() {
-            		public void run() {
-            			// do first because some applets need to be displayed before
-            			// starting (they use Component.getImage or something)
-            			cont.setVisible(true);
-
-            			applet.init();
-            			applet.start();
-
-            			cont.invalidate(); // this should force the applet to
-            			cont.validate();   // the correct size and to repaint
-            			cont.repaint();
-            		}
-            	});
-            } catch (InterruptedException ie) {
-
-            } catch (InvocationTargetException ite) {
-
-            }
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            // should also kill the applet?
-        }
-    }
-
-    // applet context methods 
-
-    /**
-     * Returns the applet if the applet's name is specified,
-     * otherwise return null.
-     */
-    public Applet getApplet(String name) {
-        checkDestroyed();
-
-        if (name != null && name.equals(file.getApplet().getName()))
-            return applet;
-        else
-            return null;
-    }
-
-    /**
-     * Returns an enumeration that contains only the applet
-     * from the JNLP file.
-     */
-    public Enumeration getApplets() {
-        checkDestroyed();
-
-        return Collections.enumeration( Arrays.asList(new Applet[] { applet }) );
-    }
-
-    /**
-     * Returns an audio clip.
-     */
-    public AudioClip getAudioClip(URL location) {
-        checkDestroyed();
-
-        AppletAudioClip clip = new AppletAudioClip(location);
-
-        weakClips.add(clip);
-        weakClips.trimToSize();
-
-        return clip;
-    }
-
-    /**
-     * Return an image loaded from the specified location.
-     */
-    public Image getImage(URL location) {
-        checkDestroyed();
-
-        //return Toolkit.getDefaultToolkit().createImage(location);
-        Image image = (new ImageIcon(location)).getImage();
-
-        return image;
-    }
-
-    /**
-     * Not implemented yet.
-     */
-    public void showDocument(java.net.URL uRL) {
-        checkDestroyed();
-
-    }
-
-    /**
-     * Not implemented yet.
-     */
-    public void showDocument(java.net.URL uRL, java.lang.String str) {
-        checkDestroyed();
-
-    }
-
-    /**
-     * Not implemented yet.
-     */
-    public void showStatus(java.lang.String str) {
-        checkDestroyed();
-
-    }
-
-    /**
-     * Required for JRE1.4, but not implemented yet.
-     */
-    public void setStream(String key, InputStream stream) {
-        checkDestroyed();
-
-    }
-
-    /**
-     * Required for JRE1.4, but not implemented yet.
-     */
-    public InputStream getStream(String key) {
-        checkDestroyed();
-
-        return null;
-    }
-
-    /**
-     * Required for JRE1.4, but not implemented yet.
-     */
-    public Iterator getStreamKeys()  {
-        checkDestroyed();
-
-        return null;
-    }
-
-    // stub methods
-
-    public void appletResize(int width, int height) {
-        checkDestroyed();
-
-        if (cont instanceof Frame) {
-            Frame frame = (Frame) cont;
-            Insets insets = frame.getInsets();
-
-            frame.setSize(width + insets.left + insets.right,
-                          height + insets.top + insets.bottom);
-        }
-    }
-
-    public AppletContext getAppletContext() {
-        checkDestroyed();
-
-        return this;
-    }
-
-    public URL getCodeBase() {
-        checkDestroyed();
-
-        return file.getCodeBase();
-    }
-
-    public URL getDocumentBase() {
-        checkDestroyed();
-
-        return file.getApplet().getDocumentBase();
-    }
-
-    // FIXME: Sun's applet code forces all parameters to lower case.
-    // Does Netx's JNLP code do the same, so we can remove the first lookup?
-    public String getParameter(String name) {
-        checkDestroyed();
-
-        String s = (String) parameters.get(name);
-        if (s != null)
-            return s;
-
-        return (String) parameters.get(name.toLowerCase());
-    }
-
-    public boolean isActive() {
-        checkDestroyed();
-
-        // it won't be started or stopped, so if it can call it's running
-        return true;
-    }
-
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/AppletInstance.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.applet.*;
-import java.awt.*;
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.util.List;
-import java.security.*;
-import java.lang.reflect.*;
-import java.lang.ref.*;
-
-import net.sourceforge.jnlp.*;
-
-
-/**
- * Represents a launched application instance created from a JNLP
- * file.  This class does not control the operation of the applet,
- * use the AppletEnvironment class to start and stop the applet.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.9 $ 
- */
-public class AppletInstance extends ApplicationInstance {
-
-    /** whether the applet's stop and destroy methods have been called */
-    private boolean appletStopped = false;
-
-    /** the applet */
-    private Applet applet;
-
-    /** the applet environment */
-    private AppletEnvironment environment;
-
-
-    /**
-     * Create a New Task based on the Specified URL
-     */
-    public AppletInstance(JNLPFile file, ThreadGroup group, ClassLoader loader, Applet applet) {
-        super(file, group, loader);
-
-        this.applet = applet;
-
-        this.environment = new AppletEnvironment(file, this);
-    }
-
-    /**
-     * 
-     */
-    public AppletInstance(JNLPFile file, ThreadGroup group, ClassLoader loader, Applet applet, Container cont) {
-        super(file, group, loader);
-        this.applet = applet;
-        this.environment = new AppletEnvironment(file, this, cont);
-    }
-
-    /**
-     * Sets whether the applet is resizable or not.  Applets default
-     * to being not resizable.
-     */
-    public void setResizable(boolean resizable) {
-        Container c = environment.getAppletFrame();
-        if (c instanceof Frame)
-            ((Frame) c).setResizable(resizable);
-    }
-
-    /**
-     * Returns whether the applet is resizable.
-     */
-    public boolean isResizable() {
-        Container c = environment.getAppletFrame();
-        if (c instanceof Frame)
-            return ((Frame) c).isResizable();
-
-        return false;
-    }
-
-    /**
-     * Returns the application title.
-     */
-    public String getTitle() {
-        return getJNLPFile().getApplet().getName();
-    }
-
-    /**
-     * Returns the applet environment.
-     */
-    public AppletEnvironment getAppletEnvironment() {
-        return environment;
-    }
-
-    /**
-     * Returns the applet.
-     */
-    public Applet getApplet() {
-        return applet;
-    }
-
-    /**
-     * Stop the application and destroy its resources.
-     */
-    public void destroy() {
-        if (appletStopped)
-            return;
-
-        appletStopped = true;
-
-        try {
-            applet.stop();
-            applet.destroy();
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-        }
-
-        environment.destroy();
-
-        super.destroy();
-    }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/ApplicationInstance.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.awt.*;
-import java.util.*;
-import java.util.List;
-import java.security.*;
-import javax.swing.event.EventListenerList;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.event.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * Represents a running instance of an application described in a
- * JNLPFile.  This class provides a way to track the application's
- * resources and destroy the application.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.15 $ 
- */
-public class ApplicationInstance {
-
-    // todo: should attempt to unload the environment variables
-    // installed by the application.
-
-
-    /** the file */
-    private JNLPFile file;
-
-    /** the thread group */
-    private ThreadGroup group;
-
-    /** the classloader */
-    private ClassLoader loader;
-
-    /** whether the application has stopped running */
-    private boolean stopped = false;
-
-    /** weak list of windows opened by the application */
-    private WeakList weakWindows = new WeakList();
-
-    /** list of application listeners  */
-    private EventListenerList listeners = new EventListenerList();
-
-	/** whether or not this application is signed */
-	private boolean isSigned = false;
-
-    /**
-     * Create an application instance for the file.
-     */
-    public ApplicationInstance(JNLPFile file, ThreadGroup group, ClassLoader loader) {
-        this.file = file;
-        this.group = group;
-        this.loader = loader;
-        this.isSigned = ((JNLPClassLoader) loader).getSigning();
-    }
-
-    /**
-     * Add an Application listener
-     */
-    public void addApplicationListener(ApplicationListener listener) {
-        listeners.add(ApplicationListener.class, listener);
-    }
-
-    /**
-     * Remove an Application Listener
-     */
-    public void removeApplicationListener(ApplicationListener listener) {
-        listeners.remove(ApplicationListener.class, listener);
-    }
-
-    /**
-     * Notify listeners that the application has been terminated.
-     */
-    protected void fireDestroyed() {
-        Object list[] = listeners.getListenerList();
-        ApplicationEvent event = null;
-
-        for (int i=list.length-1; i>0; i-=2) { // last to first required
-            if (event == null)
-                event = new ApplicationEvent(this);
-
-            ((ApplicationListener)list[i]).applicationDestroyed(event);
-        }
-    }
-
-    /**
-     * Initialize the application's environment (installs
-     * environment variables, etc).
-     */
-    public void initialize() {
-        installEnvironment();
-    }
-
-    /**
-     * Releases the application's resources before it is collected.
-     * Only collectable if classloader and thread group are
-     * also collectable so basically is almost never called (an
-     * application would have to close its windows and exit its
-     * threads but not call System.exit).
-     */
-    public void finalize() {
-        destroy();
-    }
-
-    /**
-     * Install the environment variables.
-     */
-    void installEnvironment() {
-        final PropertyDesc props[] = file.getResources().getProperties();
-
-        PrivilegedAction installProps = new PrivilegedAction() {
-            public Object run() {
-                for (int i=0; i < props.length; i++) {
-                    System.setProperty(props[i].getKey(), props[i].getValue());
-                }
-
-                return null;
-            }
-        };
-        AccessController.doPrivileged(installProps);
-    }
-
-    /** 
-     * Returns the JNLP file for this task.
-     */
-    public JNLPFile getJNLPFile() {
-        return file;
-    }
-
-    /**
-     * Returns the application title.
-     */
-    public String getTitle() {
-        return file.getTitle();
-    }
-
-    /**
-     * Returns whether the application is running.
-     */
-    public boolean isRunning() {
-        return !stopped;
-    }
-
-    /**
-     * Stop the application and destroy its resources.
-     */
-    public void destroy() {
-        if (stopped)
-            return;
-
-        try {
-            // destroy resources
-            for (int i=0; i < weakWindows.size(); i++) {
-                Window w = (Window) weakWindows.get(i);
-                if (w != null)
-                    w.dispose();
-            }
-
-            weakWindows.clear();
-
-             // interrupt threads
-            Thread threads[] = new Thread[ group.activeCount() * 2 ];
-            int nthreads = group.enumerate(threads);
-            for (int i=0; i < nthreads; i++) {
-                if (JNLPRuntime.isDebug())
-                    System.out.println("Interrupt thread: "+threads[i]);
-
-                threads[i].interrupt();
-            }
-
-            // then stop
-            Thread.currentThread().yield();
-            nthreads = group.enumerate(threads);
-            for (int i=0; i < nthreads; i++) {
-                if (JNLPRuntime.isDebug())
-                    System.out.println("Stop thread: "+threads[i]);
-
-                threads[i].stop();
-            }
-
-            // then destroy - except Thread.destroy() not implemented in jdk
-
-       }
-        finally {
-            stopped = true;
-            fireDestroyed();
-        }
-    }
-
-    /**
-     * Returns the thread group.
-     *
-     * @throws IllegalStateException if the app is not running
-     */
-    public ThreadGroup getThreadGroup() throws IllegalStateException {
-        if (stopped)
-            throw new IllegalStateException();
-
-        return group;
-    }
-
-    /** 
-     * Returns the classloader.
-     *
-     * @throws IllegalStateException if the app is not running
-     */
-    public ClassLoader getClassLoader() throws IllegalStateException {
-        if (stopped)
-            throw new IllegalStateException();
-
-        return loader;
-    }
-
-    /**
-     * Adds a window that this application opened.  When the
-     * application is disposed, these windows will also be disposed.
-     */
-    protected void addWindow(Window window) {
-        weakWindows.add(window);
-        weakWindows.trimToSize();
-    }
-
-	/**
-	 * Returns whether or not this jar is signed.
-	 */
-	public boolean isSigned() {
-		return isSigned;
-	}
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-
-import net.sourceforge.jnlp.AppletDesc;
-import net.sourceforge.jnlp.ApplicationDesc;
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.LaunchException;
-import net.sourceforge.jnlp.Launcher;
-import net.sourceforge.jnlp.ParseException;
-import net.sourceforge.jnlp.PropertyDesc;
-import net.sourceforge.jnlp.ResourcesDesc;
-import net.sourceforge.jnlp.cache.UpdatePolicy;
-import net.sourceforge.jnlp.security.VariableX509TrustManager;
-import net.sourceforge.jnlp.security.viewer.CertificateViewer;
-import net.sourceforge.jnlp.services.ServiceUtil;
-
-/**
- * This is the main entry point for the JNLP client.  The main
- * method parses the command line parameters and loads a JNLP
- * file into the secure runtime environment.  This class is meant
- * to be called from the command line or file association; to
- * initialize the netx engine from other code invoke the
- * <code>JNLPRuntime.initialize</code> method after configuring
- * the runtime.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.21 $
- */
-public final class Boot implements PrivilegedAction {
-
-    // todo: decide whether a spawned netx (external launch)
-    // should inherit the same options as this instance (store argv?)
-    
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-    private static String R(String key, Object param) { return JNLPRuntime.getMessage(key, new Object[] {param}); }
-
-    private static final String version = "0.5";
-
-    /** the JNLP file to open to display the network-based about window */
-    private static final String aboutFile = 
-        System.getProperty("java.home") + "/lib/about.jnlp";
-
-    /** the text to display before launching the about link */
-    private static final String aboutMessage = ""
-        + "netx v"+version+" - (C)2001-2003 Jon A. Maxwell (jmaxwell@users.sourceforge.net)\n"
-        + "\n"
-        + R("BLaunchAbout");
-
-    private static final String miniLicense = "\n"
-        + "   netx - an open-source JNLP client.\n"
-        + "   Copyright (C) 2001-2003 Jon A. Maxwell (JAM)\n"
-        + "\n"
-        + "   // This library is free software; you can redistribute it and/or\n"
-        + "   modify it under the terms of the GNU Lesser General Public\n"
-        + "   License as published by the Free Software Foundation; either\n"
-        + "   version 2.1 of the License, or (at your option) any later version.\n"
-        + "\n"
-        + "   This library is distributed in the hope that it will be useful,\n"
-        + "   but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-        + "   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
-        + "   Lesser General Public License for more details.\n"
-        + "\n"
-        + "   You should have received a copy of the GNU Lesser General Public\n"
-        + "   License along with this library; if not, write to the Free Software\n"
-        + "   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n"
-        + "\n";
-
-    private static final String helpMessage = "\n"
-        + "Usage:   " + R("BOUsage")+"\n"
-        + "         " + R("BOUsage2")+"\n"
-        + "\n"
-        + "control-options:"+"\n"
-        + "  -about                "+R("BOAbout")+"\n"
-        + "  -viewer               "+R("BOViewer")+"\n"
-        + "\n"
-        + "run-options:"+"\n"
-        + "  -basedir dir          "+R("BOBasedir")+"\n"
-        + "  -arg arg              "+R("BOArg")+"\n"
-        + "  -param name=value     "+R("BOParam")+"\n"
-        + "  -property name=value  "+R("BOProperty")+"\n"
-        + "  -update seconds       "+R("BOUpdate")+"\n"
-        + "  -license              "+R("BOLicense")+"\n"
-        + "  -verbose              "+R("BOVerbose")+"\n"
-        + "  -nosecurity           "+R("BONosecurity")+"\n"
-        + "  -noupdate             "+R("BONoupdate")+"\n"
-        + "  -headless             "+R("BOHeadless")+"\n"
-        + "  -strict               "+R("BOStrict")+"\n"
-        + "  -umask=value          "+R("BOUmask")+"\n"
-        + "  -help                 "+R("BOHelp")+"\n";
-
-    private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update";
-
-    private static String args[]; // avoid the hot potato
-
-
-    /**
-     * Launch the JNLP file specified by the command-line arguments.
-     */
-    public static void main(String[] argsIn) {
-        args = argsIn;
-        
-        if (null != getOption("-viewer")) {
-
-            try {
-                CertificateViewer.main(null);
-                System.exit(0);
-            } catch (Exception e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            }
-
-        }
-
-        if (null != getOption("-license")) {
-            System.out.println(miniLicense);
-            System.exit(0);
-        }
-
-        if (null != getOption("-help")) {
-            System.out.println(helpMessage);
-            System.exit(0);
-        }
-
-        if (null != getOption("-about"))
-            System.out.println(aboutMessage);
-
-        if (null != getOption("-verbose"))
-            JNLPRuntime.setDebug(true);
-
-        if (null != getOption("-update")) {
-            int value = Integer.parseInt(getOption("-update"));
-            JNLPRuntime.setDefaultUpdatePolicy(new UpdatePolicy(value*1000l));
-        }
-
-        if (null != getOption("-headless"))
-            JNLPRuntime.setHeadless(true);
-
-
-        if (null != getOption("-noupdate"))
-            JNLPRuntime.setDefaultUpdatePolicy(UpdatePolicy.NEVER);
-        
-        // wire in custom authenticator
-        try {
-            SSLSocketFactory sslSocketFactory;
-            SSLContext context = SSLContext.getInstance("SSL");
-            TrustManager[] trust = new TrustManager[] { VariableX509TrustManager.getInstance() };
-            context.init(null, trust, null);
-            sslSocketFactory = context.getSocketFactory();
-            
-            HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
-        } catch (Exception e) {
-            System.err.println("Unable to set SSLSocketfactory (may _prevent_ access to sites that should be trusted)! Continuing anyway...");
-            e.printStackTrace();
-        }
-
-        // do in a privileged action to clear the security context of
-        // the Boot13 class, which doesn't have any privileges in
-        // JRE1.3; JRE1.4 works without Boot13 or this PrivilegedAction.
-        AccessController.doPrivileged(new Boot());
-
-        args = null; // might save a couple bytes...
-    }
-
-    /**
-     * The privileged part (jdk1.3 compatibility).
-     */
-    public Object run() {
-        JNLPRuntime.setBaseDir(getBaseDir());
-        JNLPRuntime.setSecurityEnabled(null == getOption("-nosecurity"));
-        JNLPRuntime.initialize(true);
-
-        try {
-            new Launcher().launch(getFile());
-        }
-        catch (LaunchException ex) {
-            // default handler prints this
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-
-            fatalError(ex.getMessage());
-        }
-
-        return null;
-    }
-
-    private static void fatalError(String message) {
-        System.err.println("netx: "+message);
-        System.exit(1);
-    }
-
-    /**
-     * Returns the about.jnlp file in {java.home}/lib or null if this file
-     * does not exist.
-     */
-    private static String getAboutFile() {
-
-        if (new File(aboutFile).exists())
-            return aboutFile;
-        else
-            return null;
-    }
-
-    /**
-     * Returns the file to open; does not return if no file was
-     * specified.
-     */
-    private static JNLPFile getFile() throws ParseException, MalformedURLException, IOException {
-    
-        String location = getJNLPFile();
-        
-        // override -jnlp with aboutFile
-        if (getOption("-about") != null) {
-            location = getAboutFile();
-            if (location == null)
-                fatalError("Unable to find about.jnlp in {java.home}/lib/");
-        } else {
-            location = getJNLPFile();
-        }
-
-        if (location == null) {
-            System.out.println(helpMessage);
-            System.exit(1);
-        }
-        
-        if (JNLPRuntime.isDebug())
-            System.out.println(R("BFileLoc")+": "+location);
-
-        URL url = null;
-
-        try {
-            if (new File(location).exists())
-                url = new File(location).toURL(); // Why use file.getCanonicalFile?
-            else 
-                url = new URL(ServiceUtil.getBasicService().getCodeBase(), location);
-        } catch (Exception e) {
-            fatalError("Invalid jnlp file " + location);
-            if (JNLPRuntime.isDebug())
-                e.printStackTrace();
-        }
-        
-        boolean strict = (null != getOption("-strict"));
-
-        JNLPFile file = new JNLPFile(url, null, strict);
-
-        // add in extra params from command line
-        addProperties(file);
-
-        if (file.isApplet())
-            addParameters(file);
-
-        if (file.isApplication())
-            addArguments(file);
-
-        if (JNLPRuntime.isDebug()) {
-            if (getOption("-arg") != null)
-                if (file.isInstaller() || file.isApplet())
-                    System.out.println(R("BArgsNA"));
-
-            if (getOption("-param") != null)
-                if (file.isApplication())
-                    System.out.println(R("BParamNA"));
-        }
-
-        return file;
-    }
-
-    /**
-     * Add the properties to the JNLP file.
-     */
-    private static void addProperties(JNLPFile file) {
-        String props[] = getOptions("-property");
-        ResourcesDesc resources = file.getResources();
-
-        for (int i=0; i < props.length; i++) {
-            // allows empty property, not sure about validity of that.
-            int equals = props[i].indexOf("=");
-            if (equals == -1)
-                fatalError(R("BBadProp", props[i]));
-
-            String key = props[i].substring(0, equals);
-            String value = props[i].substring(equals+1, props[i].length());
-
-            resources.addResource(new PropertyDesc(key, value));
-        }
-    }
-
-    /**
-     * Add the params to the JNLP file; only call if file is
-     * actually an applet file.
-     */
-    private static void addParameters(JNLPFile file) {
-        String params[] = getOptions("-param");
-        AppletDesc applet = file.getApplet();
-
-        for (int i=0; i < params.length; i++) {
-            // allows empty param, not sure about validity of that.
-            int equals = params[i].indexOf("=");
-            if (equals == -1)
-                fatalError(R("BBadParam", params[i]));
-
-            String name = params[i].substring(0, equals);
-            String value = params[i].substring(equals+1, params[i].length());
-
-            applet.addParameter(name, value);
-        }
-    }
-
-    /**
-     * Add the arguments to the JNLP file; only call if file is
-     * actually an application (not installer).
-     */
-    private static void addArguments(JNLPFile file) {
-        String args[] = getOptions("-arg");  // FYI args also global variable
-        ApplicationDesc app = file.getApplication();
-
-        for (int i=0; i < args.length; i++) {
-            app.addArgument(args[i]);
-        }
-    }
-
-    /**
-     * Gets the JNLP file from the command line arguments, or exits upon error.
-     */
-    private static String getJNLPFile() {
-
-        if (args.length == 0) {
-            System.out.println(helpMessage);
-            System.exit(0);
-        } else if (args.length == 1) {
-            return args[args.length - 1];
-        } else {
-            String lastArg = args[args.length - 1];
-            String secondLastArg = args[args.length - 2];
-
-            if (doubleArgs.indexOf(secondLastArg) == -1) {
-                return lastArg;
-            } else {
-                System.out.println(helpMessage);
-                System.exit(0);
-            }
-        }
-        return null;
-    }
-    
-    /**
-     * Return value of the first occurence of the specified
-     * option, or null if the option is not present.  If the
-     * option is a flag (0-parameter) and is present then the
-     * option name is returned.
-     */
-    private static String getOption(String option) {
-        String result[] = getOptions(option);
-
-        if (result.length == 0)
-            return null;
-        else
-            return result[0];
-    }
-
-    /**
-     * Return all the values of the specified option, or an empty
-     * array if the option is not present.  If the option is a
-     * flag (0-parameter) and is present then the option name is
-     * returned once for each occurrence.
-     */
-    private static String[] getOptions(String option) {
-        List result = new ArrayList();
-
-        for (int i=0; i < args.length; i++) {
-            if (option.equals(args[i])) {
-                if (-1 == doubleArgs.indexOf(option))
-                    result.add(option);
-                else
-                    if (i+1 < args.length)
-                        result.add(args[i+1]);
-            }
-
-            if (args[i].startsWith("-") && -1 != doubleArgs.indexOf(args[i]))
-                i++;
-        }
-
-        return (String[]) result.toArray( new String[result.size()] );
-    }
-
-    /**
-     * Return the base dir.  If the base dir parameter is not set
-     * the value is read from the "${user.home}/.netxrc" file (as
-     * defined by JNLPRuntime).  If that file does not exist, an
-     * install dialog is displayed to select the base directory.
-     */
-    private static File getBaseDir() {
-        if (getOption("-basedir") != null) {
-            File basedir = new File(getOption("-basedir"));
-
-            if (!basedir.exists() || !basedir.isDirectory())
-                fatalError(R("BNoDir", basedir));
-
-            return basedir;
-        }
-
-        // check .netxrc, display dialog
-        File basedir = JNLPRuntime.getDefaultBaseDir();
-        if (basedir == null)
-            fatalError(R("BNoBase"));
-
-        return basedir;
-    }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/Boot13.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.lang.reflect.*;
-import java.io.*;
-import java.net.*;
-import java.security.*;
-import javax.swing.*;
-
-/**
- * Allows a Policy and SecurityManager to be set in JRE1.3 without
- * running the code with only applet permissions; this class is
- * for backward compatibility only and is totally unnecessary if
- * running in jdk 1.4 or later (can call Boot directly).
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.5 $
- */
-public class Boot13 extends URLClassLoader {
-
-    // The problem with setting a Policy in jdk1.3 is that the
-    // system and application classes seem to be loaded in such a
-    // way that only their protection domain determines the
-    // permissions; the policy object is never asked for permissions
-    // after the class is loaded.  This hack creates a classloader
-    // that loads duplicate versions of the classes in such a
-    // manner where they ask with the policy object.  The jdk1.4
-    // correctly honors the Policy object making this unneccessary
-    // post-1.3.
-
-    private Boot13(URL source[]) {
-        super(source);
-    }
-
-    protected PermissionCollection getPermissions(CodeSource source) {
-        Permissions result = new Permissions();
-        result.add( new AllPermission() );
-
-        return result;
-    }
-
-    public Class loadClass(String name) throws ClassNotFoundException {
-        Class c = findLoadedClass(name);
-        if (c != null)
-            return c;
-
-        // reverse the search order so that classes from this
-        // classloader, which sets the right permissions, are found
-        // before the parent classloader which has the same classes
-        // but the wrong permissions.
-        try {
-            return findClass(name);
-        }
-        catch (ClassNotFoundException ex) {
-        }
-
-        return getParent().loadClass(name);
-    }
-
-    public static void main(final String args[]) throws Exception {
-        URL cs = Boot13.class.getProtectionDomain().getCodeSource().getLocation();
-        //  instead of using a custom loadClass search order, we could
-        //  put the classes in a boot/ subdir of the JAR and load
-        //  them from there.  This would be an improvement by not
-        //  allowing applications to get a duplicate jnlp engine (one
-        //  with applet access permissions) by using the system
-        //  classloader but a drawback by not allowing Boot to be
-        //  called directly.
-        //cs = new URL("jar:"+cs+"!/boot/");
-
-        if (cs == null) {
-            System.err.println("fatal: cannot determine code source.");
-            System.exit(1);
-        }
-
-        Boot13 b = new Boot13(new URL[] {cs});
-
-        Thread.currentThread().setContextClassLoader(b); // try to prevent getting the non-policy version of classes
-
-        Class c = b.loadClass("net.sourceforge.jnlp.runtime.Boot");
-        Method main = c.getDeclaredMethod("main", new Class[] {String[].class} );
-
-        main.invoke(null, new Object[] { args } );
-    }
-
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,986 +0,0 @@
-
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.CodeSource;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.TreeSet;
-import java.util.Vector;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import net.sourceforge.jnlp.ExtensionDesc;
-import net.sourceforge.jnlp.JARDesc;
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.LaunchException;
-import net.sourceforge.jnlp.ParseException;
-import net.sourceforge.jnlp.PluginBridge;
-import net.sourceforge.jnlp.ResourcesDesc;
-import net.sourceforge.jnlp.SecurityDesc;
-import net.sourceforge.jnlp.cache.CacheUtil;
-import net.sourceforge.jnlp.cache.ResourceTracker;
-import net.sourceforge.jnlp.cache.UpdatePolicy;
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-import net.sourceforge.jnlp.tools.JarSigner;
-import sun.misc.JarIndex;
-
-/**
- * Classloader that takes it's resources from a JNLP file.  If the
- * JNLP file defines extensions, separate classloaders for these
- * will be created automatically.  Classes are loaded with the
- * security context when the classloader was created.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.20 $ 
- */
-public class JNLPClassLoader extends URLClassLoader {
-
-    // todo: initializePermissions should get the permissions from
-    // extension classes too so that main file classes can load
-    // resources in an extension.
-
-    /** shortcut for resources */
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
-    /** map from JNLPFile url to shared classloader */
-    private static Map urlToLoader = new HashMap(); // never garbage collected!
-
-    /** number of times a classloader with native code is created */
-    private static int nativeCounter = 0;
-
-    /** the directory for native code */
-    private File nativeDir = null; // if set, some native code exists
-
-    /** security context */
-    private AccessControlContext acc = AccessController.getContext();
-
-    /** the permissions for the cached jar files */
-    private List resourcePermissions;
-
-    /** the app */
-    private ApplicationInstance app = null; // here for faster lookup in security manager
-
-    /** list of this, local and global loaders this loader uses */
-    private JNLPClassLoader loaders[] = null; // ..[0]==this
-
-    /** whether to strictly adhere to the spec or not */
-    private boolean strict = true;
-
-    /** loads the resources */
-    private ResourceTracker tracker = new ResourceTracker(true); // prefetch
-
-    /** the update policy for resources */
-    private UpdatePolicy updatePolicy;
-
-    /** the JNLP file */
-    private JNLPFile file;
-
-    /** the resources section */
-    private ResourcesDesc resources;
-
-    /** the security section */
-    private SecurityDesc security;
-    
-    /** Permissions granted by the user during runtime. */
-    private ArrayList<Permission> runtimePermissions = new ArrayList<Permission>();
-
-    /** all jars not yet part of classloader or active */
-    private List available = new ArrayList();
-
-	/** all of the jar files that were verified */
-	private ArrayList<String> verifiedJars = null;
-
-	/** all of the jar files that were not verified */
-	private ArrayList<String> unverifiedJars = null;
-
-	/** the jarsigner tool to verify our jars */
-	private JarSigner js = null;
-
-	private boolean signing = false;
-	
-	/** ArrayList containing jar indexes for various jars available to this classloader */
-	private ArrayList<JarIndex> jarIndexes = new ArrayList<JarIndex>();
-	
-	/** File entries in the jar files available to this classloader */
-	private TreeSet jarEntries = new TreeSet();
-
-    /**
-     * Create a new JNLPClassLoader from the specified file.
-     *
-     * @param file the JNLP file
-     */
-    protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy) throws LaunchException {
-        super(new URL[0], JNLPClassLoader.class.getClassLoader());
-
-        if (JNLPRuntime.isDebug())
-            System.out.println("New classloader: "+file.getFileLocation());
-
-        this.file = file;
-        this.updatePolicy = policy;
-        this.resources = file.getResources();
-
-        // initialize extensions
-        initializeExtensions();
-
-        // initialize permissions
-        initializePermissions();
-
-        initializeResources();
-
-        setSecurity();
-
-    }
-
-    private void setSecurity() {
-		/**
-		 * When we're trying to load an applet, file.getSecurity() will return
-		 * null since there is no jnlp file to specify permissions. We
-		 * determine security settings here, after trying to verify jars.
-		 */
-		if (file instanceof PluginBridge) {
-			if (signing == true) {
-				this.security = new SecurityDesc(file, 
-					SecurityDesc.ALL_PERMISSIONS,
-					file.getCodeBase().getHost());
-			} else {
-				this.security = new SecurityDesc(file, 
-					SecurityDesc.SANDBOX_PERMISSIONS, 
-					file.getCodeBase().getHost());
-			}
-		} else { //regular jnlp file
-			
-			/**
-			 * If the application is signed, then we set the SecurityDesc to the
-			 * <security> tag in the jnlp file. Note that if an application is
-			 * signed, but there is no <security> tag in the jnlp file, the
-			 * application will get sandbox permissions.
-			 * If the application is unsigned, we ignore the <security> tag and 
-			 * use a sandbox instead. 
-			 */
-			if (signing == true) {
-				this.security = file.getSecurity();
-			} else {
-				this.security = new SecurityDesc(file, 
-						SecurityDesc.SANDBOX_PERMISSIONS, 
-						file.getCodeBase().getHost());
-			}
-		}
-    }
-    
-    /**
-     * Returns a JNLP classloader for the specified JNLP file.
-     *
-     * @param file the file to load classes for
-     * @param policy the update policy to use when downloading resources
-     */
-    public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy) throws LaunchException {
-        JNLPClassLoader loader = null;
-        URL location = file.getFileLocation();
-
-        if (location != null)
-            loader = (JNLPClassLoader) urlToLoader.get(location);
-
-		try {
-        	if (loader == null)
-            	loader = new JNLPClassLoader(file, policy);
-		} catch (LaunchException e) {
-			throw e;
-		}
-
-        if (file.getInformation().isSharingAllowed())
-            urlToLoader.put(location, loader);
-
-        return loader;
-    }
-
-    /**
-     * Returns a JNLP classloader for the JNLP file at the specified
-     * location. 
-     *
-     * @param location the file's location
-     * @param policy the update policy to use when downloading resources
-     */
-    public static JNLPClassLoader getInstance(URL location, String cookieStr, UpdatePolicy policy) throws IOException, ParseException, LaunchException {
-        JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(location);
-
-        if (loader == null)
-            loader = getInstance(new JNLPFile(location, cookieStr, false, policy), policy);
-
-        return loader;
-    }
-
-    /**
-     * Load the extensions specified in the JNLP file.
-     */
-    void initializeExtensions() {
-        ExtensionDesc[] ext = resources.getExtensions();
-
-        List loaderList = new ArrayList();
-
-        loaderList.add(this);
-
-		//if (ext != null) {
-        	for (int i=0; i < ext.length; i++) {
-            	try {
-               		JNLPClassLoader loader = getInstance(ext[i].getLocation(), ext[i].getCookieStr(), updatePolicy);
-                	loaderList.add(loader);
-            	}
-            	catch (Exception ex) {
-                	ex.printStackTrace();
-            	}
-        	}
-		//}
-
-        loaders = (JNLPClassLoader[]) loaderList.toArray(new JNLPClassLoader[ loaderList.size()]);
-    }
-
-    /**
-     * Make permission objects for the classpath.
-     */
-    void initializePermissions() {
-        resourcePermissions = new ArrayList();
-
-        JARDesc jars[] = resources.getJARs();
-        for (int i=0; i < jars.length; i++) {
-            Permission p = CacheUtil.getReadPermission(jars[i].getLocation(),
-                                                       jars[i].getVersion());
-
-            if (JNLPRuntime.isDebug()) {
-            	if (p == null)
-            		System.out.println("Unable to add permission for " + jars[i].getLocation());
-            	else
-            		System.out.println("Permission added: " + p.toString());
-            }
-            if (p != null)
-                resourcePermissions.add(p);
-        }
-    }
-
-    /**
-     * Load all of the JARs used in this JNLP file into the
-     * ResourceTracker for downloading.
-     */
-    void initializeResources() throws LaunchException {
-        JARDesc jars[] = resources.getJARs();
-		if (jars == null || jars.length == 0)
-			return;
-		/*
-		if (jars == null || jars.length == 0) {
-			throw new LaunchException(null, null, R("LSFatal"),
-			                    R("LCInit"), R("LFatalVerification"), "No jars!");
-		}
-		*/
-        List initialJars = new ArrayList();
-
-        for (int i=0; i < jars.length; i++) {
-
-            available.add(jars[i]);
-
-            if (jars[i].isEager())
-                initialJars.add(jars[i]); // regardless of part
-
-            tracker.addResource(jars[i].getLocation(),
-                                file.getCookieStr(),
-                                jars[i].getVersion(), 
-                                jars[i].isCacheable() ? JNLPRuntime.getDefaultUpdatePolicy() : UpdatePolicy.FORCE
-                               );
-        }
-
-        if (strict)
-            fillInPartJars(initialJars); // add in each initial part's lazy jars
-
-		if (JNLPRuntime.isVerifying()) {
-
-			JarSigner js;
-			waitForJars(initialJars); //download the jars first.
-
-			try {
-				js = verifyJars(initialJars);
-			} catch (Exception e) {
-				//we caught an Exception from the JarSigner class.
-				//Note: one of these exceptions could be from not being able
-				//to read the cacerts or trusted.certs files.
-				e.printStackTrace();
-				throw new LaunchException(null, null, R("LSFatal"),
-					R("LCInit"), R("LFatalVerification"), R("LFatalVerificationInfo"));
-			}
-
-			//Case when at least one jar has some signing
-			if (js.anyJarsSigned()){
-				signing = true;
-
-				//user does not trust this publisher
-				if (!js.getAlreadyTrustPublisher()) {
-				    checkTrustWithUser(js);
-				} else {
-					/**
-					 * If the user trusts this publisher (i.e. the publisher's certificate
-					 * is in the user's trusted.certs file), we do not show any dialogs.
-					 */
-				}
-			} else {
-
-				signing = false;
-				//otherwise this jar is simply unsigned -- make sure to ask
-				//for permission on certain actions
-			}
-		}
-
-        activateJars(initialJars);
-    }
-
-    private void checkTrustWithUser(JarSigner js) throws LaunchException {
-        if (!js.getRootInCacerts()) { //root cert is not in cacerts
-            boolean b = SecurityWarningDialog.showCertWarningDialog(
-                SecurityWarningDialog.AccessType.UNVERIFIED, file, js);
-            if (!b)
-                throw new LaunchException(null, null, R("LSFatal"), 
-                    R("LCLaunching"), R("LNotVerified"), "");
-        } else if (js.getRootInCacerts()) { //root cert is in cacerts
-            boolean b = false;
-            if (js.noSigningIssues())
-                b = SecurityWarningDialog.showCertWarningDialog(
-                        SecurityWarningDialog.AccessType.VERIFIED, file, js);
-            else if (!js.noSigningIssues())
-                b = SecurityWarningDialog.showCertWarningDialog(
-                        SecurityWarningDialog.AccessType.SIGNING_ERROR, file, js);
-            if (!b)
-                throw new LaunchException(null, null, R("LSFatal"),
-                    R("LCLaunching"), R("LCancelOnUserRequest"), "");
-        }
-    }
-
-    /**
-     * Add applet's codebase URL.  This allows compatibility with
-     * applets that load resources from their codebase instead of
-     * through JARs, but can slow down resource loading.  Resources
-     * loaded from the codebase are not cached.
-     */
-    public void enableCodeBase() {
-        addURL( file.getCodeBase() ); // nothing happens if called more that once?
-    }
-
-    /**
-     * Sets the JNLP app this group is for; can only be called once.
-     */
-    public void setApplication(ApplicationInstance app) {
-        if (this.app != null) {
-            if (JNLPRuntime.isDebug()) {
-                Exception ex = new IllegalStateException("Application can only be set once");
-                ex.printStackTrace();
-            }
-            return;
-        }
-
-        this.app = app;
-    }
-
-    /**
-     * Returns the JNLP app for this classloader
-     */
-    public ApplicationInstance getApplication() {
-        return app;
-    }
-
-    /**
-     * Returns the JNLP file the classloader was created from.
-     */
-    public JNLPFile getJNLPFile() {
-        return file;
-    }
-
-    /**
-     * Returns the permissions for the CodeSource.
-     */
-    protected PermissionCollection getPermissions(CodeSource cs) {
-        Permissions result = new Permissions();
-
-        // should check for extensions or boot, automatically give all
-        // access w/o security dialog once we actually check certificates.
-
-        // copy security permissions from SecurityDesc element
-		if (security != null) {
-        	Enumeration e = security.getPermissions().elements();
-        	while (e.hasMoreElements())
-            	result.add((Permission) e.nextElement());
-		}
-
-        // add in permission to read the cached JAR files
-        for (int i=0; i < resourcePermissions.size(); i++)
-            result.add((Permission) resourcePermissions.get(i));
-
-        // add in the permissions that the user granted.
-        for (int i=0; i < runtimePermissions.size(); i++)
-        	result.add(runtimePermissions.get(i));
-
-        return result;
-    }
-
-    protected void addPermission(Permission p) {
-    	runtimePermissions.add(p);
-    }
-    
-    /**
-     * Adds to the specified list of JARS any other JARs that need
-     * to be loaded at the same time as the JARs specified (ie, are
-     * in the same part).
-     */
-    protected void fillInPartJars(List jars) {
-        for (int i=0; i < jars.size(); i++) {
-            String part = ((JARDesc) jars.get(i)).getPart();
-
-            for (int a=0; a < available.size(); a++) {
-                JARDesc jar = (JARDesc) available.get(a);
-
-                if (part != null && part.equals(jar.getPart()))
-                    if (!jars.contains(jar))
-                        jars.add(jar);
-            }
-        }
-    }
-
-    /**
-     * Ensures that the list of jars have all been transferred, and
-     * makes them available to the classloader.  If a jar contains
-     * native code, the libraries will be extracted and placed in
-     * the path.
-     *
-     * @param jars the list of jars to load
-     */
-    protected void activateJars(final List jars) {
-        PrivilegedAction activate = new PrivilegedAction() {
-
-            public Object run() {
-                // transfer the Jars
-                waitForJars(jars);
-
-                for (int i=0; i < jars.size(); i++) {
-                    JARDesc jar = (JARDesc) jars.get(i);
-
-                    available.remove(jar);
-
-                    // add jar
-                    File localFile = tracker.getCacheFile(jar.getLocation());
-                    try {
-                        URL location = jar.getLocation(); // non-cacheable, use source location
-                        if (localFile != null) {
-                            location = localFile.toURL(); // cached file
-                            
-                            // This is really not the best way.. but we need some way for 
-                            // PluginAppletViewer::getCachedImageRef() to check if the image 
-                            // is available locally, and it cannot use getResources() because 
-                            // that prefetches the resource, which confuses MediaTracker.waitForAll() 
-                            // which does a wait(), waiting for notification (presumably 
-                            // thrown after a resource is fetched). This bug manifests itself
-                            // particularly when using The FileManager applet from Webmin.
-                            
-                            JarFile jarFile = new JarFile(localFile);
-                            Enumeration e = jarFile.entries();
-                            while (e.hasMoreElements()) {
-                                
-                                JarEntry je = (JarEntry) e.nextElement();
-                                
-                                // another jar in my jar? it is more likely than you think  
-                                if (je.getName().endsWith(".jar")) {
-                                    // We need to extract that jar so that it can be loaded 
-                                    // (inline loading with "jar:..!/..." path will not work 
-                                    // with standard classloader methods)
-
-                                    String extractedJarLocation = localFile.getParent() + "/" + je.getName();
-                                    FileOutputStream extractedJar = new FileOutputStream(extractedJarLocation);
-                                    InputStream is = jarFile.getInputStream(je);
-
-                                    byte[] bytes = new byte[1024];
-                                    int read = is.read(bytes);
-                                    while (read > 0) {
-                                        extractedJar.write(bytes, 0, read);
-                                        read = is.read(bytes);
-                                    }
-
-                                    is.close();
-                                    extractedJar.close();
-
-                                    JarSigner signer = new JarSigner();
-                                    signer.verifyJar(extractedJarLocation);
-
-                                    if (signer.anyJarsSigned() && !signer.getAlreadyTrustPublisher()) {
-                                        checkTrustWithUser(signer);
-                                    }
-
-                                    try {
-                                        addURL(new URL("file://" + extractedJarLocation));
-                                    } catch (MalformedURLException mfue) {
-                                        if (JNLPRuntime.isDebug())
-                                            System.err.println("Unable to add extracted nested jar to classpath");
-
-                                        mfue.printStackTrace();
-                                    }
-                                }
-
-                                jarEntries.add(je.getName());
-                            }
-
-                        }
-
-                        addURL(location);
-
-                        // there is currently no mechanism to cache files per 
-                        // instance.. so only index cached files
-                        if (localFile != null) {
-                            JarIndex index = JarIndex.getJarIndex(new JarFile(localFile.getAbsolutePath()), null);
-
-                            if (index != null)
-                                jarIndexes.add(index);
-                        }
-
-                        if (JNLPRuntime.isDebug())
-                            System.err.println("Activate jar: "+location);
-                    }
-                    catch (Exception ex) {
-                        if (JNLPRuntime.isDebug())
-                            ex.printStackTrace();
-                    }
-
-                    if (jar.isNative())
-                        activateNative(jar);
-                }
-
-                return null;
-            }
-        };
-
-        AccessController.doPrivileged(activate, acc);
-    }
-
-    /**
-     * Enable the native code contained in a JAR by copying the
-     * native files into the filesystem.  Called in the security
-     * context of the classloader.
-     */
-    protected void activateNative(JARDesc jar) {
-        if (JNLPRuntime.isDebug())
-            System.out.println("Activate native: "+jar.getLocation());
-
-        File localFile = tracker.getCacheFile(jar.getLocation());
-        if (localFile == null)
-            return;
-
-        if (nativeDir == null)
-            nativeDir = getNativeDir();
-
-        try {
-            JarFile jarFile = new JarFile(localFile, false);
-            Enumeration entries = jarFile.entries();
-
-            while (entries.hasMoreElements()) {
-                JarEntry e = (JarEntry) entries.nextElement();
-
-                if (e.isDirectory() || e.getName().indexOf('/') != -1)
-                    continue;
-
-                File outFile = new File(nativeDir, e.getName());
-
-                CacheUtil.streamCopy(jarFile.getInputStream(e),
-                                     new FileOutputStream(outFile));
-            }
-        }
-        catch (IOException ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-        }
-    }
-
-    /**
-     * Return the base directory to store native code files in.
-     * This method does not need to return the same directory across
-     * calls.
-     */
-    protected File getNativeDir() {
-        nativeDir = new File(System.getProperty("java.io.tmpdir") 
-                             + File.separator + "netx-native-" 
-                             + (new Random().nextInt() & 0xFFFF));
-
-        if (!nativeDir.mkdirs()) 
-            return null;
-        else
-            return nativeDir;
-    }
-
-    /**
-     * Return the absolute path to the native library.
-     */
-    protected String findLibrary(String lib) {
-        if (nativeDir == null)
-            return null;
-
-        String syslib = System.mapLibraryName(lib);
-
-        File target = new File(nativeDir, syslib);
-        if (target.exists())
-            return target.toString();
-        else {
-            String result = super.findLibrary(lib);
-            if (result != null)
-                return result;
-
-            return findLibraryExt(lib);
-        }
-    }
-
-    /**
-     * Try to find the library path from another peer classloader.
-     */
-    protected String findLibraryExt(String lib) {
-        for (int i=0; i < loaders.length; i++) {
-            String result = null;
-
-            if (loaders[i] != this)
-                result = loaders[i].findLibrary(lib);
-
-            if (result != null)
-                return result;
-        }
-
-        return null;
-    }
-
-    /**
-     * Wait for a group of JARs, and send download events if there
-     * is a download listener or display a progress window otherwise.
-     *
-     * @param jars the jars
-     */
-    private void waitForJars(List jars) {
-        URL urls[] = new URL[jars.size()];
-
-        for (int i=0; i < jars.size(); i++) {
-            JARDesc jar = (JARDesc) jars.get(i);
-
-            urls[i] = jar.getLocation();
-        }
-
-        CacheUtil.waitForResources(app, tracker, urls, file.getTitle());
-    }
-
-    /**
-	 * Verifies code signing of jars to be used.
-	 *
-	 * @param jars the jars to be verified.
-	 */
-	private JarSigner verifyJars(List<JARDesc> jars) throws Exception {
-	
-		js = new JarSigner();
-		js.verifyJars(jars, tracker);
-		return js;
-	}
-
-    /**
-     * Find the loaded class in this loader or any of its extension loaders.
-     */
-    protected Class findLoadedClassAll(String name) {
-        for (int i=0; i < loaders.length; i++) {
-            Class result = null;
-
-            if (loaders[i] == this)
-                result = super.findLoadedClass(name);
-            else
-                result = loaders[i].findLoadedClassAll(name);
-
-            if (result != null)
-                return result;
-        }
-
-        return null;
-    }
-
-    /**
-     * Find a JAR in the shared 'extension' classloaders, this
-     * classloader, or one of the classloaders for the JNLP file's
-     * extensions.
-     */
-    public Class loadClass(String name) throws ClassNotFoundException {
-
-        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(), 
-                                    file.getCookieStr(),
-                                    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;
-    }
-
-    /**
-     * Find the class in this loader or any of its extension loaders.
-     */
-    protected Class findClass(String name) throws ClassNotFoundException {
-        for (int i=0; i < loaders.length; i++) {
-            try {
-                if (loaders[i] == this)
-                    return super.findClass(name);
-                else
-                    return loaders[i].findClass(name);
-            }
-            catch(ClassNotFoundException ex) { }
-            catch(ClassFormatError cfe) {}
-        }
-
-        throw new ClassNotFoundException(name);
-    }
-
-    /**
-     * Search for the class by incrementally adding resources to the
-     * classloader and its extension classloaders until the resource
-     * is found.
-     */
-    private Class loadClassExt(String name) throws ClassNotFoundException {
-        // make recursive
-        addAvailable();
-
-        // find it
-        try {
-            return findClass(name);
-        }
-        catch(ClassNotFoundException ex) {
-        }
-
-        // add resources until found
-        while (true) {
-            JNLPClassLoader addedTo = addNextResource();
-
-            if (addedTo == null)
-                throw new ClassNotFoundException(name);
-
-            try {
-                return addedTo.findClass(name);
-            }
-            catch(ClassNotFoundException ex) {
-            }
-        }
-    }
-
-    /**
-     * Finds the resource in this, the parent, or the extension
-     * class loaders.
-     */
-    public URL getResource(String name) {
-        URL result = super.getResource(name);
-
-        for (int i=1; i < loaders.length; i++)
-            if (result == null)
-                result = loaders[i].getResource(name);
-
-        return result;
-    }
-
-    /**
-     * Finds the resource in this, the parent, or the extension
-     * class loaders.
-     */
-    public Enumeration findResources(String name) throws IOException {
-        Vector resources = new Vector();
-
-        for (int i=0; i < loaders.length; i++) {
-            Enumeration e;
-
-            if (loaders[i] == this)
-                e = super.findResources(name);
-            else 
-                e = loaders[i].findResources(name);
-
-            while (e.hasMoreElements())
-                resources.add(e.nextElement());
-        }
-
-        return resources.elements();
-    }
-    
-    /**
-     * Returns if the specified resource is available locally from a cached jar
-     * 
-     * @param s The name of the resource
-     * @return Whether or not the resource is available locally
-     */
-    public boolean resourceAvailableLocally(String s) {
-        return jarEntries.contains(s);
-    }
-
-    /**
-     * Adds whatever resources have already been downloaded in the
-     * background.
-     */
-    protected void addAvailable() {
-        // go through available, check tracker for it and all of its
-        // part brothers being available immediately, add them.
-
-        for (int i=1; i < loaders.length; i++) {
-            loaders[i].addAvailable();
-        }
-    }
-
-    /**
-     * Adds the next unused resource to the classloader.  That
-     * resource and all those in the same part will be downloaded
-     * and added to the classloader before returning.  If there are
-     * no more resources to add, the method returns immediately.
-     *
-     * @return the classloader that resources were added to, or null
-     */
-    protected JNLPClassLoader addNextResource() {
-        if (available.size() == 0) {
-            for (int i=1; i < loaders.length; i++) {
-                JNLPClassLoader result = loaders[i].addNextResource();
-
-                if (result != null)
-                    return result;
-            }
-            return null;
-        }
-
-        // add jar
-        List jars = new ArrayList();
-        jars.add(available.get(0));
-
-        fillInPartJars(jars);
-
-		
-		activateJars(jars);
-
-        return this;
-    }
-
-    // this part compatibility with previous classloader
-    /**
-     * @deprecated
-     */
-    public String getExtensionName() {
-        String result = file.getInformation().getTitle();
-
-        if (result == null)
-            result = file.getInformation().getDescription();
-        if (result == null && file.getFileLocation() != null)
-            result = file.getFileLocation().toString();
-        if (result == null && file.getCodeBase() != null)
-            result = file.getCodeBase().toString();
-
-        return result;
-    }
-
-    /**
-     * @deprecated
-     */
-    public String getExtensionHREF() {
-        return file.getFileLocation().toString();
-    }
-
-	public boolean getSigning() {
-		return signing;
-	}
-
-	protected SecurityDesc getSecurity() {
-		return security;
-	}
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPPolicy.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.security.*;
-import java.util.Enumeration;
-
-/**
- * Policy for JNLP environment.  This class delegates to the
- * system policy but always grants permissions to the JNLP code
- * and system CodeSources (no separate policy file needed).  This
- * class may also grant permissions to applications at runtime if
- * approved by the user.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $ 
- */
-public class JNLPPolicy extends Policy {
-
-    /** classes from this source have all permissions */
-    private static CodeSource shellSource;
-
-    /** classes from this source have all permissions */
-    private static CodeSource systemSource;
-
-    /** the previous policy */
-    private static Policy systemPolicy;
-
-
-    protected JNLPPolicy() {
-        shellSource = JNLPPolicy.class.getProtectionDomain().getCodeSource();
-        systemSource = Policy.class.getProtectionDomain().getCodeSource();
-        systemPolicy = Policy.getPolicy();
-    }
-
-    /**
-     * Return a mutable, heterogeneous-capable permission collection
-     * for the source.
-     */
-    public PermissionCollection getPermissions(CodeSource source) {
-        if (source.equals(systemSource) || source.equals(shellSource))
-            return getAllPermissions();
-
-        // if we check the SecurityDesc here then keep in mind that
-        // code can add properties at runtime to the ResourcesDesc!
-        if (JNLPRuntime.getApplication() != null) {
-        	if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
-        		JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
-        		
-        		PermissionCollection clPermissions = cl.getPermissions(source);
-        		
-        		// systempolicy permissions need to be accounted for as well
-        		CodeSource appletCS = new CodeSource(JNLPRuntime.getApplication().getJNLPFile().getSourceLocation(), (java.security.cert.Certificate[]) null);
-        		Enumeration e = systemPolicy.getPermissions(appletCS).elements();
-                while (e.hasMoreElements())
-                    clPermissions.add((Permission) e.nextElement());
-
-        		return clPermissions;
-        	}
-        }
-
-        // delegate to original Policy object; required to run under WebStart
-        return systemPolicy.getPermissions(source);
-    }
-
-    /**
-     * Refresh.
-     */
-    public void refresh() {
-        // no op
-    }
-
-    /**
-     * Return an all-permissions collection.
-     */
-    private Permissions getAllPermissions() {
-        Permissions result = new Permissions();
-
-        result.add( new AllPermission() );
-        return result;
-    }
-
-	public boolean implies(ProtectionDomain domain, Permission permission) {
-		//Include the permissions that may be added during runtime.
-		PermissionCollection pc = getPermissions(domain.getCodeSource());
-		return super.implies(domain, permission) || pc.implies(permission);
-	}
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,496 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.io.*;
-import java.awt.*;
-import java.text.*;
-import java.util.*;
-import java.security.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.services.*;
-import net.sourceforge.jnlp.util.*;
-
-
-/**
- * Configure and access the runtime environment.  This class
- * stores global jnlp properties such as default download
- * indicators, the install/base directory, the default resource
- * update policy, etc.  Some settings, such as the base directory,
- * cannot be changed once the runtime has been initialized.<p>
- *
- * The JNLP runtime can be locked to prevent further changes to
- * the runtime environment except by a specified class.  If set,
- * only instances of the <i>exit class</i> can exit the JVM or
- * change the JNLP runtime settings once the runtime has been
- * initialized.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.19 $
- */
-public class JNLPRuntime {
-
-    static {
-        loadResources();
-    }
-
-    /** the localized resource strings */
-    private static ResourceBundle resources;
-
-    /** the security manager */
-    private static JNLPSecurityManager security;
-
-    /** the security policy */
-    private static JNLPPolicy policy;
-
-    /** the base dir for cache, etc */
-    private static File baseDir;
-
-    /** a default launch handler */
-    private static LaunchHandler handler = null;
-
-    /** default download indicator */
-    private static DownloadIndicator indicator = null;
-
-    /** update policy that controls when to check for updates */
-    private static UpdatePolicy updatePolicy = UpdatePolicy.ALWAYS;
-
-    /** netx window icon */
-    private static Image windowIcon = null;
-
-    /** whether initialized */
-    private static boolean initialized = false;
-
-    /** whether netx is in command-line mode (headless) */
-    private static boolean headless = false;
-
-	/** whether we'll be checking for jar signing */
-	private static boolean verify = true;
-
-    /** whether the runtime uses security */
-    private static boolean securityEnabled = true;
-
-    /** whether debug mode is on */
-    private static boolean debug = false; // package access by Boot
-    
-    /** mutex to wait on, for initialization */
-    public static Object initMutex = new Object();
-
-    /** set to true if this is a webstart application. */
-    private static boolean isWebstartApplication; 
-
-    /**
-     * Returns whether the JNLP runtime environment has been
-     * initialized.  Once initialized, some properties such as the
-     * base directory cannot be changed.  Before 
-     */
-    public static boolean isInitialized() {
-        return initialized;
-    }
-
-    /**
-     * Initialize the JNLP runtime environment by installing the
-     * security manager and security policy, initializing the JNLP
-     * standard services, etc.<p>
-     *
-     * This method cannot be called more than once.  Once
-     * initialized, methods that alter the runtime can only be
-     * called by the exit class.<p>
-     *
-     * @param isApplication is true if a webstart application is being initialized
-     *
-     * @throws IllegalStateException if the runtime was previously initialized
-     */
-    public static void initialize(boolean isApplication) throws IllegalStateException {
-        checkInitialized();
-     
-        isWebstartApplication = isApplication;
-
-        if (headless == false)
-            checkHeadless();
-
-        if (!headless && windowIcon == null)
-            loadWindowIcon();
-
-        if (!headless && indicator == null)
-            indicator = new DefaultDownloadIndicator();
-
-        if (handler == null)
-            handler = new DefaultLaunchHandler();
-
-        if (baseDir == null)
-            baseDir = getDefaultBaseDir();
-
-        if (baseDir == null)
-            throw new IllegalStateException(JNLPRuntime.getMessage("BNoBase"));
-
-        ServiceManager.setServiceManagerStub(new XServiceManagerStub()); // ignored if we're running under Web Start
-	
-        policy = new JNLPPolicy();
-        security = new JNLPSecurityManager(); // side effect: create JWindow
-
-        if (securityEnabled) {
-            Policy.setPolicy(policy); // do first b/c our SM blocks setPolicy
-            System.setSecurityManager(security);
-        }
-
-        initialized = true;
-    }
-
-    /**
-     * Returns true if a webstart application has been initialized, and false
-     * for a plugin applet.
-     */
-    public static boolean isWebstartApplication() {
-        return isWebstartApplication;
-    }
-
-    /**
-     * Returns the window icon.
-     */
-    public static Image getWindowIcon() {
-        return windowIcon;
-    }
-
-    /**
-     * Sets the window icon that is displayed in Java applications
-     * and applets instead of the default Java icon.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setWindowIcon(Image image) {
-        checkExitClass();
-        windowIcon = image;
-    }
-
-    /**
-     * Returns whether the JNLP client will use any AWT/Swing
-     * components.
-     */
-    public static boolean isHeadless() {
-        return headless;
-    }
-
-	/**
-	 * Returns whether we are verifying code signing.
-	 */
-	public static boolean isVerifying() {
-		return verify;
-	}
-    /**
-     * Sets whether the JNLP client will use any AWT/Swing
-     * components.  In headless mode, client features that use the
-     * AWT are disabled such that the client can be used in
-     * headless mode (<code>java.awt.headless=true</code>).
-     *
-     * @throws IllegalStateException if the runtime was previously initialized
-     */
-    public static void setHeadless(boolean enabled) {
-        checkInitialized();
-        headless = enabled;
-    }
-
-   /**
-	* Sets whether we will verify code signing.
-	* @throws IllegalStateException if the runtime was previously initialized
-	*/
-    public static void setVerify(boolean enabled) {
-		checkInitialized();
-		verify = enabled;
-    }
-
-    /**
-     * Return the base directory containing the cache, persistence
-     * store, etc.
-     */
-    public static File getBaseDir() {
-        return baseDir;
-    }
-
-    /**
-     * Sets the base directory containing the cache, persistence
-     * store, etc.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setBaseDir(File baseDirectory) {
-        checkInitialized();
-        baseDir = baseDirectory;
-    }
-
-    /**
-     * Returns whether the secure runtime environment is enabled.
-     */
-    public static boolean isSecurityEnabled() {
-        return securityEnabled;
-    }
-
-    /**
-     * Sets whether to enable the secure runtime environment.
-     * Disabling security can increase performance for some
-     * applications, and can be used to use netx with other code
-     * that uses its own security manager or policy.
-     *
-     * Disabling security is not recommended and should only be
-     * used if the JNLP files opened are trusted.  This method can
-     * only be called before initalizing the runtime.<p>
-     *
-     * @param enabled whether security should be enabled
-     * @throws IllegalStateException if the runtime is already initialized
-     */
-    public static void setSecurityEnabled(boolean enabled) {
-        checkInitialized();
-        securityEnabled = enabled;
-    }
-
-    /**
-     * Returns the system default base dir for or if not set,
-     * prompts the user for the location.
-     *
-     * @return the base dir, or null if the user canceled the dialog
-     * @throws IOException if there was an io exception
-     */
-    public static File getDefaultBaseDir() {
-        PropertiesFile props = JNLPRuntime.getProperties();
-
-        loadWindowIcon();
-
-        String baseStr = props.getProperty("basedir");
-        if (baseStr != null)
-            return new File(baseStr);
-
-        if (isHeadless())
-            return null;
-
-        String homeDir = System.getProperty("user.home");
-	File baseDir = new File(homeDir + "/.netx/");
-	if (homeDir == null || !baseDir.mkdir())
-            return null;
-
-        props.setProperty("basedir", baseDir.toString());
-        props.store();
-
-        return baseDir;
-    }
-
-    /**
-     * Set a class that can exit the JVM; if not set then any class
-     * can exit the JVM.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setExitClass(Class exitClass) {
-        checkExitClass();
-        security.setExitClass(exitClass);
-    }
-    
-    /**
-     * Disables applets from calling exit.
-     * 
-     * Once disabled, exit cannot be re-enabled for the duration of the JVM instance
-     */
-    public static void disableExit() {
-    	security.disableExit();
-    }
-
-    /**
-     * Return the current Application, or null if none can be
-     * determined.
-     */
-    public static ApplicationInstance getApplication() {
-        return security.getApplication();
-    }
-
-    /**
-     * Return a PropertiesFile object backed by the runtime's
-     * properties file.
-     */
-    public static PropertiesFile getProperties() {
-        File netxrc = new File(System.getProperty("user.home"), ".netxrc");
-
-        return new PropertiesFile(netxrc);
-    }
-
-    /**
-     * Return whether debug statements for the JNLP client code
-     * should be printed.
-     */
-    public static boolean isDebug() {
-        return debug;
-    }
-
-    /**
-     * Sets whether debug statements for the JNLP client code
-     * should be printed to the standard output.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setDebug(boolean enabled) {
-        checkExitClass();
-        debug = enabled;
-    }
-
-    /**
-     * Sets the default update policy.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setDefaultUpdatePolicy(UpdatePolicy policy) {
-        checkExitClass();
-        updatePolicy = policy;
-    }
-
-    /**
-     * Returns the default update policy.
-     */
-    public static UpdatePolicy getDefaultUpdatePolicy() {
-        return updatePolicy;
-    }
-
-    /**
-     * Sets the default launch handler.
-     */
-    public static void setDefaultLaunchHandler(LaunchHandler handler) {
-        checkExitClass();
-        JNLPRuntime.handler = handler;
-    }
-
-    /**
-     * Returns the default launch handler.
-     */
-    public static LaunchHandler getDefaultLaunchHandler() {
-        return handler;
-    }
-
-    /**
-     * Sets the default download indicator.
-     *
-     * @throws IllegalStateException if caller is not the exit class
-     */
-    public static void setDefaultDownloadIndicator(DownloadIndicator indicator) {
-        checkExitClass();
-        JNLPRuntime.indicator = indicator;
-    }
-
-    /**
-     * Returns the default download indicator.
-     */
-    public static DownloadIndicator getDefaultDownloadIndicator() {
-        return indicator;
-    }
-
-    /**
-     * Returns the localized resource string identified by the
-     * specified key.  If the message is empty, a null is
-     * returned.
-     */
-    public static String getMessage(String key) {
-        try {
-            String result = resources.getString(key);
-            if (result.length() == 0)
-                return null;
-            else
-                return result;
-        }
-        catch (Exception ex) {
-            if (!key.equals("RNoResource"))
-                return getMessage("RNoResource", new Object[] {key});
-            else
-                return "Missing resource: "+key;
-        }
-    }
-
-    /**
-     * Returns the localized resource string using the specified
-     * arguments.
-     *
-     * @param args the formatting arguments to the resource string
-     */
-    public static String getMessage(String key, Object args[]) {
-        return MessageFormat.format(getMessage(key), args);
-    }
-
-    /**
-     * Throws an exception if called when the runtime is
-     * already initialized.
-     */
-    private static void checkInitialized() {
-        if (initialized)
-            throw new IllegalStateException("JNLPRuntime already initialized.");
-    }
-
-    /**
-     * Throws an exception if called with security enabled but
-     * a caller is not the exit class and the runtime has been
-     * initialized.
-     */
-    private static void checkExitClass() {
-        if (securityEnabled && initialized)
-            if (!security.isExitClass())
-                throw new IllegalStateException("Caller is not the exit class");
-    }
-
-    /**
-     * Check whether the VM is in headless mode.
-     */
-    private static void checkHeadless() {
-        //if (GraphicsEnvironment.isHeadless()) // jdk1.4+ only
-        //    headless = true;
-        try {
-            if ("true".equalsIgnoreCase(System.getProperty("java.awt.headless")))
-                headless = true;
-        }
-        catch (SecurityException ex) {
-        }
-    }
-
-    /**
-     * Load the resources.
-     */
-    private static void loadResources() {
-        try {
-            resources = ResourceBundle.getBundle("net.sourceforge.jnlp.resources.Messages");
-        }
-        catch (Exception ex) {
-            throw new IllegalStateException("Missing resource bundle in netx.jar:net/sourceforge/jnlp/resource/Messages.properties");
-        }
-    }
-
-    /**
-     * Load the window icon.
-     */
-    private static void loadWindowIcon() {
-        if (windowIcon != null)
-            return;
-
-        try {
-            windowIcon = new javax.swing.ImageIcon((new sun.misc.Launcher())
-            		.getClassLoader().getResource("net/sourceforge/jnlp/resources/netx-icon.png")).getImage();
-        }
-        catch (Exception ex) {
-            if (JNLPRuntime.isDebug())
-                ex.printStackTrace();
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,490 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.runtime;
-
-import java.awt.Frame;
-import java.awt.Window;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.lang.ref.WeakReference;
-import java.net.SocketPermission;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-
-import javax.swing.JWindow;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-import net.sourceforge.jnlp.services.ServiceUtil;
-import net.sourceforge.jnlp.util.WeakList;
-import sun.security.util.SecurityConstants;
-
-/**
- * Security manager for JNLP environment.  This security manager
- * cannot be replaced as it always denies attempts to replace the
- * security manager or policy.<p>
- *
- * The JNLP security manager tracks windows created by an
- * application, allowing those windows to be disposed when the
- * application exits but the JVM does not.  If security is not
- * enabled then the first application to call System.exit will
- * halt the JVM.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.17 $
- */
-class JNLPSecurityManager extends SecurityManager {
-
-    // todo: some apps like JDiskReport can close the VM even when
-    // an exit class is set - fix!
-
-    // todo: create an event dispatch thread for each application,
-    // so that the context classloader doesn't have to be switched
-    // to the foreground application (the currently the approach
-    // since some apps need their classloader as event dispatch
-    // thread's context classloader).
-
-    // todo: use a custom Permission object to identify the current
-    // application in an AccessControlContext by setting a side
-    // effect in its implies method.  Use a custom
-    // AllPermissions-like permission to do this for apps granted
-    // all permissions (but investigate whether this will nuke
-    // the all-permission optimizations in the JRE).
-
-    // todo: does not exit app if close button pressed on JFrame
-    // with CLOSE_ON_EXIT (or whatever) set; if doesn't exit, use an
-    // WindowListener to catch WindowClosing event, then if exit is
-    // called immediately afterwards from AWT thread.
-
-    // todo: deny all permissions to applications that should have
-    // already been 'shut down' by closing their resources and
-    // interrupt the threads if operating in a shared-VM (exit class
-    // set).  Deny will probably will slow checks down a lot though.
-
-    // todo: weak remember last getProperty application and
-    // re-install properties if another application calls, or find
-    // another way for different apps to have different properties
-    // in java.lang.Sytem with the same names.
-
-    private static String R(String key) { return JNLPRuntime.getMessage(key); }
-
-    /** only class that can exit the JVM, if set */
-    private Object exitClass = null;
-
-    /** this exception prevents exiting the JVM */
-    private SecurityException closeAppEx = // making here prevents huge stack traces
-        new SecurityException(JNLPRuntime.getMessage("RShutdown"));
-
-    /** weak list of windows created */
-    private WeakList weakWindows = new WeakList();
-
-    /** weak list of applications corresponding to window list */
-    private WeakList weakApplications = new WeakList();
-
-    /** weak reference to most app who's windows was most recently activated */
-    private WeakReference activeApplication = null;
-
-    /** listener installs the app's classloader on the event dispatch thread */
-    private ContextUpdater contextListener = new ContextUpdater();
-    
-    /** Sets whether or not exit is allowed (in the context of the plugin, this is always false) */
-    private boolean exitAllowed = true;
-
-    private class ContextUpdater extends WindowAdapter implements PrivilegedAction {
-        private ApplicationInstance app = null;
-
-        public void windowActivated(WindowEvent e) {
-            app = getApplication(e.getWindow());
-            AccessController.doPrivileged(this);
-            app = null;
-        }
-
-        public Object run() {
-            if (app != null) {
-                Thread.currentThread().setContextClassLoader(app.getClassLoader());
-                activeApplication = new WeakReference(app);
-            }
-            else
-                Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
-            return null;
-        }
-
-        public void windowDeactivated(WindowEvent e) {
-            activeApplication = null;
-        }
-        
-        public void windowClosing(WindowEvent e) {
-        	System.err.println("Disposing window");
-        	e.getWindow().dispose();
-        }
-    };
-
-
-    /**
-     * Creates a JNLP SecurityManager.
-     */
-    JNLPSecurityManager() {
-        // this has the side-effect of creating the Swing shared Frame
-        // owner.  Since no application is running at this time, it is
-        // not added to any window list when checkTopLevelWindow is
-        // called for it (and not disposed).
-
-        if (!JNLPRuntime.isHeadless())
-            new JWindow().getOwner();
-    }
-
-    /**
-     * Returns whether the exit class is present on the stack, or
-     * true if no exit class is set.
-     */
-    public boolean isExitClass() {
-        return isExitClass(getClassContext());
-    }
-
-    /**
-     * Returns whether the exit class is present on the stack, or
-     * true if no exit class is set.
-     */
-    private boolean isExitClass(Class stack[]) {
-        if (exitClass == null)
-            return true;
-
-        for (int i=0; i < stack.length; i++)
-            if (stack[i] == exitClass)
-                return true;
-
-        return false;
-    }
-
-    /**
-     * Set the exit class, which is the only class that can exit the
-     * JVM; if not set then any class can exit the JVM.
-     *
-     * @param exitClass the exit class
-     * @throws IllegalStateException if the exit class is already set
-     */
-    public void setExitClass(Class exitClass) throws IllegalStateException {
-        if (this.exitClass != null)
-            throw new IllegalStateException(R("RExitTaken"));
-
-        this.exitClass = exitClass;
-    }
-
-    /**
-     * Return the current Application, or null if none can be
-     * determined.
-     */
-    protected ApplicationInstance getApplication() {
-        return getApplication(getClassContext(), 0);
-    }
-
-    /**
-     * Return the application the opened the specified window (only
-     * call from event dispatch thread).
-     */
-    protected ApplicationInstance getApplication(Window window) {
-        for (int i = weakWindows.size(); i-->0;) {
-            Window w = (Window) weakWindows.get(i);
-            if (w == null) {
-                weakWindows.remove(i);
-                weakApplications.remove(i);
-            }
-
-            if (w == window)
-                return (ApplicationInstance) weakApplications.get(i);
-        }
-
-        return null;
-    }
-
-    /**
-     * Return the current Application, or null.
-     */
-    protected ApplicationInstance getApplication(Class stack[], int maxDepth) {
-    	if (maxDepth <= 0)
-    		maxDepth = stack.length;
-
-    	// this needs to be tightened up
-    	for (int i=0; i < stack.length && i < maxDepth; i++) {
-    		if (stack[i].getClassLoader() instanceof JNLPClassLoader) {
-    			JNLPClassLoader loader = (JNLPClassLoader) stack[i].getClassLoader();
-
-    			if (loader != null && loader.getApplication() != null) {
-    				return loader.getApplication();
-    			}
-    		} 
-    	}
-
-    	return null;
-    }
-
-    /**
-     * Returns the application's thread group if the application can
-     * be determined; otherwise returns super.getThreadGroup()
-     */
-    public ThreadGroup getThreadGroup() {
-        ApplicationInstance app = getApplication();
-        if (app == null)
-            return super.getThreadGroup();
-
-        return app.getThreadGroup();
-    }
-
-    /**
-     * Throws a SecurityException if the permission is denied,
-     * otherwise return normally.  This method always denies
-     * permission to change the security manager or policy.
-     */
-    public void checkPermission(Permission perm) {
-        String name = perm.getName();
-
-        // Enable this manually -- it'll produce too much output for -verbose
-        // otherwise.
-	//	if (true)
-	//  	  System.out.println("Checking permission: " + perm.toString());
-
-        if (!JNLPRuntime.isWebstartApplication() && 
-	      ("setPolicy".equals(name) || "setSecurityManager".equals(name)))
-            throw new SecurityException(R("RCantReplaceSM"));
-
-        try {
-            // deny all permissions to stopped applications
-        	// The call to getApplication() below might not work if an 
-        	// application hasn't been fully initialized yet.
-//            if (JNLPRuntime.isDebug()) {
-//                if (!"getClassLoader".equals(name)) {
-//                    ApplicationInstance app = getApplication();
-//                    if (app != null && !app.isRunning())
-//                        throw new SecurityException(R("RDenyStopped"));
-//                }
-//            }
-        	
-			try {
-				super.checkPermission(perm);
-			} catch (SecurityException se) {
-
-				//This section is a special case for dealing with SocketPermissions.
-				if (JNLPRuntime.isDebug())
-					System.err.println("Requesting permission: " + perm.toString());
-
-				//Change this SocketPermission's action to connect and accept
-				//(and resolve). This is to avoid asking for connect permission 
-				//on every address resolve.
-				Permission tmpPerm;
-				if (perm instanceof SocketPermission) {
-					tmpPerm = new SocketPermission(perm.getName(), 
-							SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION);
-					
-					// before proceeding, check if we are trying to connect to same origin
-					ApplicationInstance app = getApplication();
-					JNLPFile file = app.getJNLPFile();
-
-					String srcHost =  file.getSourceLocation().getAuthority();
-					String destHost = name;
-					
-					// host = abc.xyz.com or abc.xyz.com:<port> 
-					if (destHost.indexOf(':') >= 0)
-						destHost = destHost.substring(0, destHost.indexOf(':'));
-					
-					// host = abc.xyz.com
-					String[] hostComponents = destHost.split("\\.");
-					
-					int length = hostComponents.length;
-					if (length >= 2) {
-						
-						// address is in xxx.xxx.xxx format
-						destHost = hostComponents[length -2] + "." + hostComponents[length -1];
-					
-						// host = xyz.com i.e. origin
-						boolean isDestHostName = false;
-
-						// make sure that it is not an ip address
-						try {
-							Integer.parseInt(hostComponents[length -1]);
-						} catch (NumberFormatException e) {
-							isDestHostName = true;
-						}
-
-						if (isDestHostName) {
-							// okay, destination is hostname. Now figure out if it is a subset of origin
-							if (srcHost.endsWith(destHost)) {
-								addPermission(tmpPerm);
-								return;
-							}
-						}
-					}
-
-				} else
-					tmpPerm = perm;
-				
-				//askPermission will only prompt the user on SocketPermission 
-				//meaning we're denying all other SecurityExceptions that may arise.
-				if (askPermission(tmpPerm)) {
-					addPermission(tmpPerm);
-					//return quietly.
-				} else {
-					throw se;
-				}
-			}
-        }
-        catch (SecurityException ex) {
-            if (JNLPRuntime.isDebug()) {
-                System.out.println("Denying permission: "+perm);
-            }
-            throw ex;
-        }
-    }
-    
-    /**
-     * Asks the user whether or not to grant permission.
-     * @param perm the permission to be granted
-     * @return true if the permission was granted, false otherwise.
-     */
-    private boolean askPermission(Permission perm)	{
-    	
-    	ApplicationInstance app = getApplication();
-    	if (app != null && !app.isSigned()) {
-        	if (perm instanceof SocketPermission 
-        			&& ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.NETWORK, perm.getName())) {
-        		return true;
-        	}
-    	}
-
-    	return false;
-    }
-
-    /**
-     * Adds a permission to the JNLPClassLoader.
-     * @param perm the permission to add to the JNLPClassLoader
-     */
-    private void addPermission(Permission perm)	{
-    	if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
-
-    		JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
-    		cl.addPermission(perm);
-        	if (JNLPRuntime.isDebug()) {
-        		if (cl.getPermissions(null).implies(perm))
-        			System.err.println("Added permission: " + perm.toString());
-        		else
-        			System.err.println("Unable to add permission: " + perm.toString());
-        	}
-    	} else {
-        	if (JNLPRuntime.isDebug())
-        		System.err.println("Unable to add permission: " + perm + ", classloader not JNLP.");
-    	}
-    }
-    
-    /**
-     * Checks whether the window can be displayed without an applet
-     * warning banner, and adds the window to the list of windows to
-     * be disposed when the calling application exits.
-     */
-    public boolean checkTopLevelWindow(Object window) {
-        ApplicationInstance app = getApplication();
-
-        // remember window -> application mapping for focus, close on exit 
-        if (app != null && window instanceof Window) {
-            Window w = (Window) window;
-
-            if (JNLPRuntime.isDebug())
-                System.err.println("SM: app: "+app.getTitle()+" is adding a window: "+window);
-
-            weakWindows.add(window); // for mapping window -> app
-            weakApplications.add(app);
-
-            w.addWindowListener(contextListener); // for dynamic context classloader
-
-            app.addWindow(w);
-        }
-
-        // change coffee cup to netx for default icon
-        if (window instanceof Window)
-            for (Window w = (Window)window; w != null; w = w.getOwner())
-                if (window instanceof Frame)
-                    ((Frame)window).setIconImage(JNLPRuntime.getWindowIcon());
-
-        // todo: set awt.appletWarning to custom message
-        // todo: logo on with glass pane on JFrame/JWindow?
-        
-        return super.checkTopLevelWindow(window);
-    }
-
-    /**
-     * Checks whether the caller can exit the system.  This method
-     * identifies whether the caller is a real call to Runtime.exec
-     * and has special behavior when returning from this method
-     * would exit the JVM and an exit class is set: if the caller is
-     * not the exit class then the calling application will be
-     * stopped and its resources destroyed (when possible), and an
-     * exception will be thrown to prevent the JVM from shutting
-     * down.<p>
-     *
-     * Calls not from Runtime.exit or with no exit class set will
-     * behave normally, and the exit class can always exit the JVM.
-     */
-    public void checkExit(int status) {
-
-    	// applets are not allowed to exit, but the plugin main class (primordial loader) is
-        Class stack[] = getClassContext();
-        if (!exitAllowed) {
-        	for (int i=0; i < stack.length; i++)
-        		if (stack[i].getClassLoader() != null)
-        			throw new AccessControlException("Applets may not call System.exit()");
-        }
-
-    	super.checkExit(status);
-        
-        boolean realCall = (stack[1] == Runtime.class);
-
-        if (isExitClass(stack)) // either exitClass called or no exitClass set
-            return; // to Runtime.exit or fake call to see if app has permission
-
-        // not called from Runtime.exit()
-        if (!realCall) {
-            // apps that can't exit should think they can exit normally
-            super.checkExit(status);
-            return;
-        }
-
-        // but when they really call, stop only the app instead of the JVM
-        ApplicationInstance app = getApplication(stack, 0);
-        if (app == null) {
-            // should check caller to make sure it is JFrame.close or
-            // other known System.exit call
-            if (activeApplication != null)
-                app = (ApplicationInstance) activeApplication.get();
-
-            if (app == null)
-                throw new SecurityException(R("RExitNoApp"));
-        }
-
-        app.destroy();
-
-        throw closeAppEx;
-    }
-
-    protected void disableExit() {
-    	exitAllowed = false;
-    }
-    
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/runtime/package.html	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the classes that manage the secure runtime
-environment for JNLP apps.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AccessWarningPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/* AccessWarningPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * Provides the look and feel for a SecurityWarningDialog. These dialogs are
- * used to warn the user when either signed code (with or without signing 
- * issues) is going to be run, or when service permission (file, clipboard,
- * printer, etc) is needed with unsigned code.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public class AccessWarningPane extends SecurityDialogUI {
-
-	JCheckBox alwaysAllow;
-	Object[] extras;
-	
-	public AccessWarningPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-	}
-
-	public AccessWarningPane(JComponent x, Object[] extras, CertVerifier certVerifier) {
-		super(x, certVerifier);
-		this.extras = extras;
-	}
-
-	/**
-	 * Creates the actual GUI components, and adds it to <code>optionPane</code>
-	 */
-	protected void installComponents() {
-		SecurityWarningDialog.AccessType type =
-		    ((SecurityWarningDialog)optionPane).getType();
-		JNLPFile file =
-		    ((SecurityWarningDialog)optionPane).getFile();
-
-		String name = "";
-		String publisher = "";
-		String from = "";
-
-		//We don't worry about exceptions when trying to fill in
-		//these strings -- we just want to fill in as many as possible.
-		try {
-			name = file.getInformation().getTitle() != null ? file.getInformation().getTitle() : "<no associated certificate>";
-		} catch (Exception e) {
-		}
-
-		try {
-			publisher = file.getInformation().getVendor() != null ? file.getInformation().getVendor() : "<no associated certificate>";
-		} catch (Exception e) {
-		}
-
-		try {
-			from = !file.getInformation().getHomepage().toString().equals("") ? file.getInformation().getHomepage().toString() : file.getSourceLocation().getAuthority();
-		} catch (Exception e) {
-			from = file.getSourceLocation().getAuthority();
-		}
-
-		//Top label
-		String topLabelText = "";
-		switch (type) {
-			case READ_FILE:
-				topLabelText = R("SFileReadAccess");
-				break;
-			case WRITE_FILE:
-				topLabelText = R("SFileWriteAccess");
-				break;
-			case CLIPBOARD_READ:
-				topLabelText = R("SClipboardReadAccess");
-				break;
-			case CLIPBOARD_WRITE:
-				topLabelText = R("SClipboardWriteAccess");
-				break;
-			case PRINTER:
-				topLabelText = R("SPrinterAccess");
-				break;
-			case NETWORK:
-				if (extras != null && extras.length >= 0)
-					topLabelText = R("SNetworkAccess", extras[0]);
-				else
-					topLabelText = R("SNetworkAccess", "(address here)");
-		}
-		
-		ImageIcon icon = new ImageIcon((new sun.misc.Launcher()).getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
-		JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
-		topLabel.setFont(new Font(topLabel.getFont().toString(), 
-			Font.BOLD, 12));
-		JPanel topPanel = new JPanel(new BorderLayout());
-		topPanel.setBackground(Color.WHITE);
-		topPanel.add(topLabel, BorderLayout.CENTER);
-		topPanel.setPreferredSize(new Dimension(400,60));
-		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		//application info
-		JLabel nameLabel = new JLabel("Name:   " + name);
-		nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-		JLabel publisherLabel = new JLabel("Publisher: " + publisher);
-		publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-		JLabel fromLabel = new JLabel("From:   " + from);
-		fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-
-		alwaysAllow = new JCheckBox("Always allow this action");
-		alwaysAllow.setEnabled(false);
-
-		JPanel infoPanel = new JPanel(new GridLayout(4,1));
-		infoPanel.add(nameLabel);
-		infoPanel.add(publisherLabel);
-		infoPanel.add(fromLabel);
-		infoPanel.add(alwaysAllow);
-		infoPanel.setBorder(BorderFactory.createEmptyBorder(25,25,25,25));
-
-		//run and cancel buttons
-		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-		
-		JButton run = new JButton("Allow");
-		JButton cancel = new JButton("Cancel");
-		run.addActionListener(createButtonActionListener(0));
-		run.addActionListener(new CheckBoxListener());
-		cancel.addActionListener(createButtonActionListener(1));
-		initialFocusComponent = cancel;
-		buttonPanel.add(run);
-		buttonPanel.add(cancel);
-		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		//all of the above
-		JPanel main = new JPanel();
-		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
-		main.add(topPanel);
-		main.add(infoPanel);
-		main.add(buttonPanel);
-
-		optionPane.add(main, BorderLayout.CENTER);
-	}
-
-	private static String R(String key) {
-        return JNLPRuntime.getMessage(key);
-    }
-
-    private static String R(String key, Object param) {
-        return JNLPRuntime.getMessage(key, new Object[] {param});
-    }
-
-	protected String htmlWrap (String s) {
-        return "<html>"+s+"</html>";
-    }
-
-	private class CheckBoxListener implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			if (alwaysAllow != null && alwaysAllow.isSelected()) {
-				// TODO: somehow tell the ApplicationInstance
-				// to stop asking for permission
-			}
-		}
-	}
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/AppletWarningPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* AppletWarningPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-
-public class AppletWarningPane extends SecurityDialogUI {
-
-	public AppletWarningPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-	}
-
-	protected void installComponents() {
-
-		//Top label
-		String topLabelText = "While support for verifying signed code" +
-				" has not been implemented yet, some applets will not run " +
-				"properly under the default restricted security level.";
-		String bottomLabelText = "Do you want to run this applet under the " +
-				"restricted security level? (clicking No will run this applet " +
-				"without any security checking, and should only be done if you " +
-				"trust the applet!)";
-		
-		JLabel topLabel = new JLabel(htmlWrap(topLabelText));
-		topLabel.setFont(new Font(topLabel.getFont().toString(), 
-			Font.BOLD, 12));
-		JPanel topPanel = new JPanel(new BorderLayout());
-		topPanel.setBackground(Color.WHITE);
-		topPanel.add(topLabel, BorderLayout.CENTER);
-		topPanel.setPreferredSize(new Dimension(400,80));
-		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		JLabel bottomLabel = new JLabel(htmlWrap(bottomLabelText));
-		JPanel infoPanel = new JPanel(new BorderLayout());
-		infoPanel.add(bottomLabel, BorderLayout.CENTER);
-		infoPanel.setPreferredSize(new Dimension(400,80));
-		infoPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-		
-		//run and cancel buttons
-		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-		
-		JButton yes = new JButton("Yes");
-		JButton no = new JButton("No");
-		JButton cancel = new JButton("Cancel");
-		int buttonWidth = cancel.getMinimumSize().width;
-		int buttonHeight = cancel.getMinimumSize().height;
-		Dimension d = new Dimension(buttonWidth, buttonHeight);
-		yes.setPreferredSize(d);
-		no.setPreferredSize(d);
-		cancel.setPreferredSize(d);
-		yes.addActionListener(createButtonActionListener(0));
-		no.addActionListener(createButtonActionListener(1));
-		cancel.addActionListener(createButtonActionListener(2));
-		initialFocusComponent = cancel;
-		buttonPanel.add(yes);
-		buttonPanel.add(no);
-		buttonPanel.add(cancel);
-		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		//all of the above
-		JPanel main = new JPanel();
-		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
-		main.add(topPanel);
-		main.add(infoPanel);
-		main.add(buttonPanel);
-
-		optionPane.add(main, BorderLayout.CENTER);
-	}
-
-	protected String htmlWrap (String s) {
-	        return "<html>"+s+"</html>";
-	}
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertVerifier.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/* CertVerifier.java
-   Copyright (C) 2009 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.util.ArrayList;
-
-/**
- * An interface that provides various details about a certificate 
- */
-
-public interface CertVerifier {
-
-    /**
-     * Return if the publisher is already trusted
-     */
-    public boolean getAlreadyTrustPublisher();
-
-    /**
-     * Return if the root is in CA certs
-     */
-    public boolean getRootInCacerts();
-
-    /**
-     * Return if there are signing issues with the certificate(s) being veried
-     */
-    public boolean hasSigningIssues();
-
-    /**
-     * Return if there are no signing issues with this cert (!hasSigningIssues())
-     */
-    public boolean noSigningIssues();
-
-    /**
-     * Get the details regarding issue(s) with this certificate
-     */
-    public ArrayList<String> getDetails();
-
-    /**
-     * Return a valid certificate path to this certificate(s) being verified
-     * @return The CertPath
-     */
-    public ArrayList<CertPath> getCerts();
-
-    /** 
-     * Returns the application's publisher's certificate.
-     */
-    public abstract Certificate getPublisher();
-
-    /**
-     * Returns the application's root's certificate. This
-     * may return the same certificate as getPublisher() in
-     * the event that the application is self signed.
-     */
-    public abstract Certificate getRoot();
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertWarningPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/* CertWarningPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.PluginBridge;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.tools.KeyTool;
-
-/**
- * Provides the look and feel for a SecurityWarningDialog. These dialogs are
- * used to warn the user when either signed code (with or without signing 
- * issues) is going to be run, or when service permission (file, clipboard,
- * printer, etc) is needed with unsigned code.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public class CertWarningPane extends SecurityDialogUI {
-
-	JCheckBox alwaysTrust;
-	CertVerifier certVerifier;
-
-	public CertWarningPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-		this.certVerifier = certVerifier;
-	}
-
-	/**
-	 * Creates the actual GUI components, and adds it to <code>optionPane</code>
-	 */
-	protected void installComponents() {
-		SecurityWarningDialog.AccessType type =
-			((SecurityWarningDialog)optionPane).getType();
-		JNLPFile file =
-			((SecurityWarningDialog)optionPane).getFile();
-		Certificate c = ((SecurityWarningDialog)optionPane)
-                                .getJarSigner().getPublisher();
-		
-		String name = "";
-		String publisher = "";
-		String from = "";
-
-		//We don't worry about exceptions when trying to fill in
-		//these strings -- we just want to fill in as many as possible.
-		try {
-			if ((certVerifier instanceof HttpsCertVerifier) && 
-			     (c instanceof X509Certificate))
-			   name = getCN(((X509Certificate)c)
-                                        .getSubjectX500Principal().getName());
-			else if (file instanceof PluginBridge)
-				name = file.getTitle();
-			else
-				name = file.getInformation().getTitle();
-		} catch (Exception e) {
-		}
-
-		try {
-			if (c instanceof X509Certificate) {
-				publisher = getCN(((X509Certificate)c)
-					.getSubjectX500Principal().getName());
-			}
-		} catch (Exception e) {
-		}
-
-		try {
-			if (file instanceof PluginBridge)
-				from = file.getCodeBase().getHost();
-			else
-				from = file.getInformation().getHomepage().toString();
-		} catch (Exception e) {
-		}
-
-		//Top label
-		String topLabelText = "";
-		String propertyName = "";
-		if (certVerifier instanceof HttpsCertVerifier)
-		{
-		  topLabelText = "The website's certificate cannot be verified. " +
-				 "Do you want to continue?";
-		  propertyName = "OptionPane.warningIcon";
-		}
-		else
-		  switch (type) {
-		  case VERIFIED:
-		 	topLabelText = R("SSigVerified");
-			propertyName = "OptionPane.informationIcon";
-			break;
-		  case UNVERIFIED:
-			topLabelText = R("SSigUnverified");
-			propertyName = "OptionPane.warningIcon";
-			break;
-	  	  case SIGNING_ERROR:
-			topLabelText = R("SSignatureError");
-			propertyName = "OptionPane.warningIcon";
-			break;
-		  }
-		ImageIcon icon = new ImageIcon((new sun.misc.Launcher())
-				.getClassLoader().getResource("net/sourceforge/jnlp/resources/warning.png"));
-		JLabel topLabel = new JLabel(htmlWrap(topLabelText), icon, SwingConstants.LEFT);
-		topLabel.setFont(new Font(topLabel.getFont().toString(), 
-				Font.BOLD, 12));
-		JPanel topPanel = new JPanel(new BorderLayout());
-		topPanel.setBackground(Color.WHITE);
-		topPanel.add(topLabel, BorderLayout.CENTER);
-		topPanel.setPreferredSize(new Dimension(400,60));
-		topPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		//application info
-		JLabel nameLabel = new JLabel("Name:   " + name);
-		nameLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-		JLabel publisherLabel = new JLabel("Publisher: " + publisher);
-		publisherLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-		JLabel fromLabel = new JLabel("From:   " + from);
-		fromLabel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-
-		alwaysTrust = new JCheckBox(
-		"Always trust content from this publisher");
-		alwaysTrust.setEnabled(true);
-
-		JPanel infoPanel = new JPanel(new GridLayout(4,1));
-		infoPanel.add(nameLabel);
-		infoPanel.add(publisherLabel);
-
-		if (!(certVerifier instanceof HttpsCertVerifier))
-		  infoPanel.add(fromLabel);
-
-		infoPanel.add(alwaysTrust);
-		infoPanel.setBorder(BorderFactory.createEmptyBorder(25,25,25,25));
-
-		//run and cancel buttons
-		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-		JButton run = new JButton("Run");
-		JButton cancel = new JButton("Cancel");
-		int buttonWidth = Math.max(run.getMinimumSize().width, 
-			cancel.getMinimumSize().width);
-		int buttonHeight = run.getMinimumSize().height;
-		Dimension d = new Dimension(buttonWidth, buttonHeight);
-		run.setPreferredSize(d);
-		cancel.setPreferredSize(d);
-		run.addActionListener(createButtonActionListener(0));
-		run.addActionListener(new CheckBoxListener());
-		cancel.addActionListener(createButtonActionListener(1));
-		initialFocusComponent = cancel;
-		buttonPanel.add(run);
-		buttonPanel.add(cancel);
-		buttonPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-
-		//all of the above
-		JPanel main = new JPanel();
-		main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
-		main.add(topPanel);
-		main.add(infoPanel);
-		main.add(buttonPanel);
-
-		JLabel bottomLabel;
-		JButton moreInfo = new JButton("More information...");
-		moreInfo.addActionListener(new MoreInfoButtonListener());
-		
-		if (((SecurityWarningDialog)optionPane).getJarSigner().getRootInCacerts())
-			bottomLabel = new JLabel(htmlWrap(R("STrustedSource")));
-		else
-			bottomLabel = new JLabel(htmlWrap(R("SUntrustedSource")));
-
-		JPanel bottomPanel = new JPanel();
-		bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
-		bottomPanel.add(bottomLabel);
-		bottomPanel.add(moreInfo);
-		bottomPanel.setPreferredSize(new Dimension(500,100));
-		bottomPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-		main.add(bottomPanel);
-
-		optionPane.add(main, BorderLayout.CENTER);
-	}
-
-	private static String R(String key) {
-        return JNLPRuntime.getMessage(key);
-    }
-
-	protected String htmlWrap (String s) {
-        return "<html>"+s+"</html>";
-    }
-
-
-    /**
-     * Extracts the CN field from a Certificate principal string.
-     */
-    private String getCN(String principal) {
-        int start = principal.indexOf("CN=");
-        int end = principal.indexOf(",", start);
-
-        if (end == -1) {
-            end = principal.length();
-        }
-
-        if (start >= 0)
-            return principal.substring(start+3, end);
-        else
-            return principal;
-    }
-
-	private class MoreInfoButtonListener implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			
-			// TODO: Can we change this to just
-			// optionPane.showMoreInfo(); ?
-			SecurityWarningDialog.showMoreInfoDialog(
-				((SecurityWarningDialog)optionPane).getJarSigner(), 
-				optionPane);
-		}
-	}
-
-	/**
-	 * Updates the user's KeyStore of trusted Certificates.
-	 */
-	private class CheckBoxListener implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			if (alwaysTrust != null && alwaysTrust.isSelected()) {
-				try {
-					KeyTool kt = new KeyTool();
-					Certificate c =
-						((SecurityWarningDialog)optionPane).getJarSigner().getPublisher();
-					kt.importCert(c);
-				} catch (Exception ex) {
-					//TODO: Let NetX show a dialog here notifying user 
-					//about being unable to add cert to keystore
-				}
-			}
-		}
-	}
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/CertsInfoPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-/* CertsInfoPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.security.cert.CertPath;
-import java.security.cert.X509Certificate;
-import java.security.MessageDigest;
-import java.math.BigInteger;
-import javax.security.auth.x500.X500Principal;
-import sun.security.x509.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.StringSelection;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sourceforge.jnlp.tools.*;
-
-/**
- * Provides the UI for the Certificate Info dialog. This dialog displays data from
- * X509Certificate(s) used in jar signing.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public class CertsInfoPane extends SecurityDialogUI {
-	
-	private ArrayList<CertPath> certs;
-    private JList list;
-	protected JTree tree;
-    private JTable table;
-    private JTextArea output;
-    private ListSelectionModel listSelectionModel;
-    private ListSelectionModel tableSelectionModel;
-    protected String[] certNames;
-    private String[] columnNames = { "Field", "Value" };
-	protected ArrayList<String[][]> certsData;
-
-	public CertsInfoPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-	}
-
-	/**
-	 * Builds the JTree out of CertPaths.
-	 */
-	void buildTree() {
-		certs = ((SecurityWarningDialog)optionPane).getJarSigner().getCerts();
-		//for now, we're only going to display the first signer, even though
-		//jars can be signed by multiple people.
-		CertPath firstPath = certs.get(0);
-		X509Certificate firstCert = 
-			((X509Certificate)firstPath.getCertificates().get(0));
-		String subjectString = 
-			getCN(firstCert.getSubjectX500Principal().getName());
-		String issuerString = 
-			getCN(firstCert.getIssuerX500Principal().getName());
-
-		DefaultMutableTreeNode top =
-			new DefaultMutableTreeNode(subjectString 
-				+ " (" + issuerString + ")");
-
-		//not self signed
-		if (!firstCert.getSubjectDN().equals(firstCert.getIssuerDN()) 
-			&& (firstPath.getCertificates().size() > 1)) {
-			X509Certificate secondCert = 
-				((X509Certificate)firstPath.getCertificates().get(1));
-			subjectString = 
-				getCN(secondCert.getSubjectX500Principal().getName());
-			issuerString = 
-				getCN(secondCert.getIssuerX500Principal().getName());
-			top.add(new DefaultMutableTreeNode(subjectString 
-				+ " (" + issuerString + ")"));
-		}
-
-		tree = new JTree(top);
-		tree.getSelectionModel().setSelectionMode
-		                (TreeSelectionModel.SINGLE_TREE_SELECTION);
-		tree.addTreeSelectionListener(new TreeSelectionHandler());
-	}
-
-	/**
-	 * Fills in certsNames, certsData with data from the certificates.
-	 */
-	protected void populateTable() {
-		certNames = new String[certs.get(0).getCertificates().size()];
-		certsData = new ArrayList<String[][]>();
-
-        for (int i = 0; i < certs.get(0).getCertificates().size(); i++) {
-
-            X509Certificate c = (X509Certificate) certs.get(0).getCertificates().get(i);
-            certsData.add(parseCert(c));
-            certNames[i] = getCN(c.getSubjectX500Principal().getName())
-				+ " (" + getCN(c.getIssuerX500Principal().getName()) + ")";
-        }
-	}
-	
-	protected String[][] parseCert(X509Certificate c) {
-		
-        String version = ""+c.getVersion();
-        String serialNumber = c.getSerialNumber().toString();
-        String signatureAlg = c.getSigAlgName();
-        String issuer = c.getIssuerX500Principal().toString();
-        String validity = new CertificateValidity(c.getNotBefore(),
-                            c.getNotAfter()).toString();
-        String subject = c.getSubjectX500Principal().toString();
-
-        //convert our signature into a nice human-readable form.
-        HexDumpEncoder encoder = new HexDumpEncoder();
-        String signature = encoder.encodeBuffer(c.getSignature());
-
-		String md5Hash = "";
-		String sha1Hash = "";
-		try {
-			MessageDigest digest = MessageDigest.getInstance("MD5");
-			digest.update(c.getEncoded());
-			md5Hash = makeFingerprint(digest.digest());
-
-			digest = MessageDigest.getInstance("SHA-1");
-			digest.update(c.getEncoded());
-			sha1Hash = makeFingerprint(digest.digest());
-		} catch (Exception e) {
-			//fail quietly
-		}
-
-        String[][] cert = { {"Version", version},
-                            {"Serial", serialNumber},
-                            {"Signature Algorithm", signatureAlg},
-                            {"Issuer", issuer},
-                            {"Validity", validity},
-                            {"Subject", subject},
-                            {"Signature", signature},
-							{"MD5 Fingerprint", md5Hash},
-							{"SHA1 Fingerprint", sha1Hash}
-							};
-        return cert;
-	}
-	
-	/**
-	 * Constructs the GUI components of this UI
-	 */
-	protected void installComponents() {
-		buildTree();
-		populateTable();
-		/**
-		//List of Certs
-        list = new JList(certNames);
-		list.setSelectedIndex(0); //assuming there's at least 1 cert
-        listSelectionModel = list.getSelectionModel();
-        listSelectionModel.addListSelectionListener(new ListSelectionHandler());
-        JScrollPane listPane = new JScrollPane(list);
-		*/
-		JScrollPane listPane = new JScrollPane(tree);
-
-        //Table of field-value pairs
-        DefaultTableModel tableModel = new DefaultTableModel(certsData.get(0),
-                                                            columnNames);
-        table = new JTable(tableModel);
-		table.getTableHeader().setReorderingAllowed(false);
-        tableSelectionModel = table.getSelectionModel();
-        tableSelectionModel.addListSelectionListener(new TableSelectionHandler());
-        table.setFillsViewportHeight(true);
-        JScrollPane tablePane = new JScrollPane(table);
-		tablePane.setPreferredSize(new Dimension(500,200));
-
-        //Text area to display the larger values
-        output = new JTextArea();
-        output.setEditable(false);
-        JScrollPane outputPane = new JScrollPane(output,
-            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
-            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		outputPane.setPreferredSize(new Dimension(500,200));
-
-		//split pane of the field-value pairs and textbox
-		JSplitPane rightSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
-			tablePane, outputPane);
-		rightSplitPane.setDividerLocation(0.50);
-		rightSplitPane.setResizeWeight(0.50);
-
-		JSplitPane mainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
-			listPane, rightSplitPane);
-		mainPane.setDividerLocation(0.30);
-		mainPane.setResizeWeight(0.30);
-
-		JPanel buttonPane = new JPanel(new BorderLayout());
-		JButton close = new JButton("Close");
-		JButton copyToClipboard = new JButton("Copy to Clipboard");
-		close.addActionListener(createButtonActionListener(0));
-		copyToClipboard.addActionListener(new CopyToClipboardHandler());
-		buttonPane.add(close, BorderLayout.EAST);
-		buttonPane.add(copyToClipboard, BorderLayout.WEST);
-		buttonPane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-
-		optionPane.add(mainPane, BorderLayout.CENTER);
-		optionPane.add(buttonPane, BorderLayout.SOUTH);
-	}
-
-	/**
-	 * Extracts the CN field from a Certificate principal string.
-	 */
-	protected String getCN(String principal) {
-        int start = principal.indexOf("CN=");
-        int end = principal.indexOf(",", start);
-
-		if (end == -1) {
-			end = principal.length();
-		}
-
-        if (start >= 0)
-            return principal.substring(start+3, end);
-        else
-            return principal;
-    }
-
-	/**
-	 * Copies the currently selected certificate to the system Clipboard.
-	 */
-	private class CopyToClipboardHandler implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-			int certIndex = 0;
-			DefaultMutableTreeNode node = (DefaultMutableTreeNode)
-                tree.getLastSelectedPathComponent();
-            if (node == null) return;
-            if (node.isRoot())
-				certIndex = 0;
-            else if (node.isLeaf())
-				certIndex = 1;
-
-			String[][] cert = certsData.get(certIndex);
-			int rows = cert.length;
-			int cols = cert[0].length;
-	
-			String certString = "";
-			for (int i = 0; i < rows; i++) {
-				for (int j = 0; j < cols; j++) {
-					certString += cert[i][j];
-					certString += " ";
-				}
-				certString += "\n";
-			}
-
-			clipboard.setContents(new StringSelection(certString), null);
-		}
-	}
-
-	/**
-	 * Updates the JTable when the JTree selection has changed.
-	 */
-	protected class TreeSelectionHandler implements TreeSelectionListener {
-		public void valueChanged(TreeSelectionEvent e) {
-			DefaultMutableTreeNode node = (DefaultMutableTreeNode)
-				tree.getLastSelectedPathComponent();
-
-			if (node == null) return;
-			if (node.isRoot()) {
-				table.setModel(new DefaultTableModel(certsData.get(0),
-					columnNames));
-			} else if (node.isLeaf()) {
-				table.setModel(new DefaultTableModel(certsData.get(1),
-					columnNames));
-			}
-		}
-	}
-
-	/**
-     * Updates the JTable when the selection on the list has changed.
-     */
-    private class ListSelectionHandler implements ListSelectionListener {
-        public void valueChanged(ListSelectionEvent e) {
-            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
-
-            int minIndex = lsm.getMinSelectionIndex();
-            int maxIndex = lsm.getMaxSelectionIndex();
-
-            for (int i = minIndex; i <= maxIndex; i++) {
-                if (lsm.isSelectedIndex(i)) {
-                    table.setModel(new DefaultTableModel(certsData.get(i),
-                                                            columnNames));
-                }
-            }
-        }
-    }
-
-    /**
-     * Updates the JTextArea output when the selection on the JTable
-     * has changed.
-     */
-    private class TableSelectionHandler implements ListSelectionListener {
-        public void valueChanged(ListSelectionEvent e) {
-            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
-
-            int minIndex = lsm.getMinSelectionIndex();
-            int maxIndex = lsm.getMaxSelectionIndex();
-
-            for (int i = minIndex; i <= maxIndex; i++) {
-                if (lsm.isSelectedIndex(i)) {
-                    output.setText((String) table.getValueAt(i,1));
-                }
-            }
-        }
-    }
-
-	/**
-	 * Makes a human readable hash fingerprint.
-	 * For example: 11:22:33:44:AA:BB:CC:DD:EE:FF.
-	 */
-	private String makeFingerprint(byte[] hash) {
-		String fingerprint = "";
-		for (int i = 0; i < hash.length; i++) {
-			if (!fingerprint.equals(""))
-				fingerprint += ":";
-			fingerprint += Integer.toHexString(
-				((hash[i] & 0xFF)|0x100)).substring(1,3);
-		}
-		return fingerprint.toUpperCase();
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/HttpsCertVerifier.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/* HttpsCertVerifier.java
-   Copyright (C) 2009 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.tools.KeyTool;
- 
-public class HttpsCertVerifier implements CertVerifier {
-
-    private VariableX509TrustManager tm;
-    private X509Certificate[] chain;
-    private String authType;
-    private ArrayList<String> details = new ArrayList<String>();
-    
-    public HttpsCertVerifier(VariableX509TrustManager tm, X509Certificate[] chain, String authType) {
-        this.tm = tm;
-        this.chain = chain;
-        this.authType = authType;
-    }
-
-    public boolean getAlreadyTrustPublisher() {
-        try {
-            tm.checkServerTrusted(chain, authType, true);
-            return true;
-        } catch (CertificateException ce) {
-            return false;
-        }
-    }
-
-    public ArrayList<CertPath> getCerts() {
-        
-        ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
-        for (int i=0; i < chain.length; i++)
-            list.add(chain[i]);
-
-        ArrayList<CertPath> certPaths = new ArrayList<CertPath>();
-        
-        try {
-            certPaths.add(CertificateFactory.getInstance("X.509").generateCertPath(list));
-        } catch (CertificateException ce) {
-            ce.printStackTrace();
-            
-            // carry on
-        }
-
-        return certPaths; 
-    }
-
-    public ArrayList<String> getDetails() {
-	boolean hasExpiredCert=false; 
-	boolean hasExpiringCert=false;
-	boolean notYetValidCert=false;
-	boolean isUntrusted=false; 
-
-	if (! getAlreadyTrustPublisher())
-              isUntrusted = true;
-
-	for (int i=0; i < chain.length; i++)
-	{
-	   X509Certificate cert = chain[i];	
-
-           long now = System.currentTimeMillis();
-           long SIX_MONTHS = 180*24*60*60*1000L;
-	   long notAfter = cert.getNotAfter().getTime();
-           if (notAfter < now) {
-             hasExpiredCert = true;
-           } else if (notAfter < now + SIX_MONTHS) {
-             hasExpiringCert = true;
-           }
-	
-	   try {
-	     cert.checkValidity();
-	   } catch (CertificateNotYetValidException cnyve) {
-             notYetValidCert = true;
-	   } catch (CertificateExpiredException cee) {
-	     hasExpiredCert = true;
-	   }
-	}
-
-	if (isUntrusted || hasExpiredCert || hasExpiringCert || notYetValidCert) {
-	      if (isUntrusted)
-	        addToDetails(R("SUntrustedCertificate"));
-              if (hasExpiredCert)
-                addToDetails(R("SHasExpiredCert"));
-              if (hasExpiringCert)
-                addToDetails(R("SHasExpiringCert"));
-              if (notYetValidCert)
-                addToDetails(R("SNotYetValidCert"));
-        }
-	return details;
-    }
-
-    private void addToDetails(String detail) {
-      if (!details.contains(detail))
-        details.add(detail);
-    }
-
-    private static String R(String key) {
-      return JNLPRuntime.getMessage(key);
-    }
-
-    public Certificate getPublisher() {
-      if (chain.length > 0)
-        return (Certificate)chain[0];
-      return null;
-    }
-
-    public Certificate getRoot() {
-      if (chain.length > 0) 
-        return (Certificate)chain[chain.length - 1];
-      return null;
-    }
-
-    public boolean getRootInCacerts() {
-	try {
-	  KeyTool kt = new KeyTool();
-          return kt.checkCacertsForCertificate(getRoot());
-        } catch (Exception e) {
-	}
-	return false;
-    }
-
-    public boolean hasSigningIssues() {
-        return false;
-    }
-
-    public boolean noSigningIssues() {
-        return false;
-    }
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/MoreInfoPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/* MoreInfoPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-
-import javax.swing.BorderFactory;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * Provides the UI for the More Info dialog. This dialog shows details about an
- * application's signing status.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public class MoreInfoPane extends SecurityDialogUI {
-
-	public MoreInfoPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-	}
-
-	/**
-	 * Constructs the GUI components of this UI
-	 */
-	protected void installComponents() {
-		ArrayList<String> details = certVerifier.getDetails();
-
-		int numLabels = details.size();
-		JPanel errorPanel = new JPanel(new GridLayout(numLabels,1));
-		errorPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-		errorPanel.setPreferredSize(new Dimension(400, 70*(numLabels)));
-
-		for (int i = 0; i < numLabels; i++) {
-			ImageIcon icon = null;
-			if (details.get(i).equals(R("STrustedCertificate")))
-				icon = new ImageIcon((new sun.misc.Launcher())
-						.getClassLoader().getResource("net/sourceforge/jnlp/resources/info-small.png"));
-			else
-				icon = new ImageIcon((new sun.misc.Launcher())
-						.getClassLoader().getResource("net/sourceforge/jnlp/resources/warning-small.png"));
-
-			errorPanel.add(new JLabel(htmlWrap(details.get(i)), icon, SwingConstants.LEFT));
-		}
-
-		JPanel buttonsPanel = new JPanel(new BorderLayout());
-		JButton certDetails = new JButton("Certificate Details");
-		certDetails.addActionListener(new CertInfoButtonListener());
-		JButton close = new JButton("Close");
-		close.addActionListener(createButtonActionListener(0));
-        buttonsPanel.add(certDetails, BorderLayout.WEST);
-        buttonsPanel.add(close, BorderLayout.EAST);
-		buttonsPanel.setBorder(BorderFactory.createEmptyBorder(15,15,15,15));
-
-        JPanel main = new JPanel(new BorderLayout());
-        main.add(errorPanel, BorderLayout.NORTH);
-        main.add(buttonsPanel, BorderLayout.SOUTH);
-
-        optionPane.add(main);
-	}
-
-    private static String R(String key) {
-        return JNLPRuntime.getMessage(key);
-    }
-    
-	/**
-	 * Needed to get word-wrap working in JLabels.
-	 */
-	private String htmlWrap (String s) {
-        return "<html>"+s+"</html>";
-    }
-
-	private class CertInfoButtonListener implements ActionListener {
-        public void actionPerformed(ActionEvent e) {
-        	//TODO: Change to ((SecurityWarningDialog) optionPane).showCertInfoDialog()
-            SecurityWarningDialog.showCertInfoDialog(
-				((SecurityWarningDialog)optionPane).getJarSigner(),
-				optionPane);
-        }
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityDialogUI.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/* SecurityDialogUI.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.ComponentOrientation;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.plaf.OptionPaneUI;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * Provides a base for JNLP warning dialogs.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public abstract class SecurityDialogUI extends OptionPaneUI {
-
-	/** The JOptionPane that we're providing the L&F for */
-	protected JOptionPane optionPane;
-
-	/** Component to receive focus when messaged with selectInitialValue. */
-	Component initialFocusComponent;
-	
-	CertVerifier certVerifier;
-
-	/** PropertyChangeListener for <code>optionPane</code> */
-	private PropertyChangeListener propertyChangeListener;
-	private Handler handler;
-
-	public SecurityDialogUI(JComponent x, CertVerifier certVerifier){
-		optionPane = (JOptionPane)x;
-		this.certVerifier = certVerifier;
-	}
-
-	/**
-	 * Installs the user interface for the SecurityWarningDialog.
-	 */
-	public void installUI(JComponent c) {
-
-		//Only install the UI when type and file in SecurityWarningDialog
-		//have been set.
-		if (((SecurityWarningDialog)c).isInitialized()) {
-			setSystemLookAndFeel();
-			optionPane = (JOptionPane)c;
-			optionPane.setLayout(new BorderLayout());
-			installComponents();
-			installListeners();
-		}
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	protected void installListeners() {
-		if ((propertyChangeListener = getHandler()) != null)
-			optionPane.addPropertyChangeListener(propertyChangeListener);
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	protected void uninstallComponents() {
-		initialFocusComponent = null;
-		optionPane.removeAll();
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	private Handler getHandler() {
-		if (handler == null)
-			handler = new Handler();
-		return handler;
-	}
-
-	//Inherited from OptionPaneUI
-	//Modified from javax.swing.plaf.basic.BasicOptionPaneUI
-	public void selectInitialValue(JOptionPane op) {
-		if (initialFocusComponent != null)
-			initialFocusComponent.requestFocus();
-
-		if (initialFocusComponent instanceof JButton) {
-			JRootPane root = SwingUtilities.getRootPane(initialFocusComponent);
-			if (root != null)
-				root.setDefaultButton((JButton) initialFocusComponent);
-		}
-	}
-
-	//Inherited from OptionPaneUI
-	public boolean containsCustomComponents(JOptionPane op) {
-		return false;
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	protected ActionListener createButtonActionListener(int buttonIndex) {
-		return new ButtonActionListener(buttonIndex);
-	}
-
-	private static String R(String key) {
-		return JNLPRuntime.getMessage(key);
-	}
-
-	/**
-	 * Needed to get word wrap working in JLabels.
-	 */
-	private String htmlWrap (String s) {
-		return "<html>"+s+"</html>";
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	private class Handler implements PropertyChangeListener {
-		public void propertyChange(PropertyChangeEvent e) {
-			if (e.getSource() == optionPane) {
-				String changeName = e.getPropertyName();
-				if (changeName == JOptionPane.OPTIONS_PROPERTY ||
-				        changeName == JOptionPane.INITIAL_VALUE_PROPERTY ||
-				        changeName == JOptionPane.ICON_PROPERTY ||
-				        changeName == JOptionPane.MESSAGE_TYPE_PROPERTY ||
-				        changeName == JOptionPane.OPTION_TYPE_PROPERTY ||
-				        changeName == JOptionPane.MESSAGE_PROPERTY ||
-				        changeName == JOptionPane.SELECTION_VALUES_PROPERTY ||
-				        changeName == JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY ||
-				        changeName == JOptionPane.WANTS_INPUT_PROPERTY) {
-					uninstallComponents();
-					installComponents();
-					optionPane.validate();
-				} else if (changeName == "componentOrientation") {
-					ComponentOrientation o = (ComponentOrientation)e.getNewValue();
-					JOptionPane op = (JOptionPane)e.getSource();
-					if (o != (ComponentOrientation)e.getOldValue()) {
-						op.applyComponentOrientation(o);
-					}
-				}
-			}
-		}
-	}
-
-	//Taken from javax.swing.plaf.basic.BasicOptionPaneUI
-	public class ButtonActionListener implements ActionListener {
-		protected int buttonIndex;
-
-		public ButtonActionListener(int buttonIndex) {
-			this.buttonIndex = buttonIndex;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			if (optionPane != null) {
-				optionPane.setValue(new Integer(buttonIndex));
-			}
-		}
-	}
-
-	private void setSystemLookAndFeel() {
-		try {
-			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-		} catch (Exception e) {
-			//don't worry if we can't.
-		}
-	}
-
-	//this is for the different dialogs to fill in.
-	protected abstract void installComponents();
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityUtil.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/* SecurityUtil.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.security.KeyStore;
-
-public class SecurityUtil {
-
-	private static String homeDir = null;
-	private static final String certDir = "/.netx/security/";
-	private static final String certFile = "trusted.certs";
-	private static final char[] password = "changeit".toCharArray();
-	
-	public static String getTrustedCertsFilename() throws Exception{
-		
-		homeDir = System.getProperty("user.home");
-		
-		if (homeDir == null) {
-			throw new Exception("Could not access home directory");
-		} else {
-			return homeDir + certDir + certFile;
-		}
-	}
-	
-	public static char[] getTrustedCertsPassword() {
-		return password;
-	}
-	
-	public static String getCN(String principal) {
-        int start = principal.indexOf("CN=");
-        int end = principal.indexOf(",", start);
-
-		if (end == -1) {
-			end = principal.length();
-		}
-
-        if (start >= 0)
-            return principal.substring(start+3, end);
-        else
-            return principal;
-    }
-	
-	/**
-	 * Checks the user's home directory to see if the trusted.certs file exists.
-	 * If it does not exist, it tries to create an empty keystore.
-	 * @return true if the trusted.certs file exists or a new trusted.certs
-	 * was created successfully, otherwise false.
-	 */
-	public static boolean checkTrustedCertsFile() throws Exception {
-		
-		File certFile = new File(getTrustedCertsFilename());
-		
-		//file does not exist
-		if (!certFile.isFile()) {
-			File dir = new File(homeDir+certDir);
-			boolean madeDir = false;
-			if (!dir.isDirectory()) {
-				madeDir = dir.mkdirs();
-			}
-			
-			//made directory, or directory exists
-			if (madeDir || dir.isDirectory()) {
-				KeyStore ks = KeyStore.getInstance("JKS");
-				ks.load(null, password);
-				FileOutputStream fos = new FileOutputStream(certFile);
-				ks.store(fos, password);
-				fos.close();
-				return true;
-			} else {
-				return false;
-			}
-		} else {
-			return true;
-		}
-	}
-	
-	/**
-	 * Returns the keystore associated with the user's trusted.certs file,
-	 * or null otherwise.
-	 */
-	public static KeyStore getUserKeyStore() throws Exception {
-		
-		KeyStore ks = null;
-		FileInputStream fis = null;
-		
-		if (checkTrustedCertsFile()) {
-
-			try {
-				File file = new File(getTrustedCertsFilename());
-				if (file.exists()) {
-					fis = new FileInputStream(file);
-					ks = KeyStore.getInstance("JKS");
-					ks.load(fis, password);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				throw e;
-			} finally {
-				if (fis != null)
-					fis.close();
-			}
-		}
-		return ks;
-	}
-	
-    /**
-     * Returns the keystore associated with the JDK cacerts file, 
-	 * or null otherwise.
-     */
-    public static KeyStore getCacertsKeyStore() throws Exception {
-
-		KeyStore caks = null;
-		FileInputStream fis = null;
-
-		try {
-        	File file = new File(System.getProperty("java.home") 
-        			+ "/lib/security/cacerts");
-        	if (file.exists()) {
-        		fis = new FileInputStream(file);
-        		caks = KeyStore.getInstance("JKS"); 
-        		caks.load(fis, null);
-        	}
-		} catch (Exception e) {
-			caks = null;
-		} finally {
-			if (fis != null)
-				fis.close();
-		}
-
-		return caks;
-    }
-    
-	/**
-	 * Returns the keystore associated with the system certs file,
-	 * or null otherwise.
-	 */
-	public static KeyStore getSystemCertStore() throws Exception {
-
-		KeyStore caks = null;
-		FileInputStream fis = null;
-
-		try {
-			File file = new File(System.getProperty("javax.net.ssl.trustStore"));
-			String type = System.getProperty("javax.net.ssl.trustStoreType");
-			//String provider = "SUN";
-			char[] password = System.getProperty(
-				"javax.net.ssl.trustStorePassword").toCharArray();
-			if (file.exists()) {
-				fis = new FileInputStream(file);
-				caks = KeyStore.getInstance(type);
-				caks.load(fis, password);
-			}
-		} catch (Exception e) {
-			caks = null;
-		} finally {
-			if (fis != null)
-				fis.close();
-		}
-		
-		return caks;
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SecurityWarningDialog.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +0,0 @@
-/* SecurityWarningDialog.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import net.sourceforge.jnlp.JNLPFile;
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-import javax.swing.plaf.OptionPaneUI;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeEvent;
-import java.security.cert.X509Certificate;
-
-/**
- * Provides methods for showing security warning dialogs
- * for a wide range of JNLP security issues.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-public class SecurityWarningDialog extends JOptionPane {
-
-	/** Types of dialogs we can create */
-	public static enum DialogType {
-		CERT_WARNING,
-		MORE_INFO,
-		CERT_INFO,
-		SINGLE_CERT_INFO,
-		ACCESS_WARNING,
-		APPLET_WARNING
-	}
-	
-	/** The types of access which may need user permission. */
-	public static enum AccessType {
-        READ_FILE,
-        WRITE_FILE,
-        CLIPBOARD_READ,
-        CLIPBOARD_WRITE,
-        PRINTER,
-        NETWORK,
-        VERIFIED,
-        UNVERIFIED,
-        SIGNING_ERROR
-    }
-
-	/** The type of dialog we want to show */
-	private DialogType dialogType;
-
-	/** The type of access that this dialog is for */
-	private AccessType accessType;
-
-	/** The application file associated with this security warning */
-	private JNLPFile file;
-
-	private CertVerifier certVerifier;
-	
-	private X509Certificate cert;
-	
-	/** An optional String array that's only necessary when a dialog
-	 * label requires some parameters (e.g. showing which address an application
-	 * is trying to connect to).
-	 */ 
-	private Object[] extras;
-	
-	/** Whether or not this object has been fully initialized */
-	private boolean initialized = false;
-
-	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
-			JNLPFile file) {
-		this.dialogType = dialogType;
-		this.accessType = accessType;
-		this.file = file;
-		this.certVerifier = null;
-		initialized = true;
-		updateUI();
-	}
-	
-	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
-			JNLPFile file, CertVerifier jarSigner) {
-		this.dialogType = dialogType;
-		this.accessType = accessType;
-		this.file = file;
-		this.certVerifier = jarSigner;
-		initialized = true;
-		updateUI();
-	}
-	
-	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
-	        CertVerifier certVerifier) {
-	    this.dialogType = dialogType;
-	    this.accessType = accessType;
-	    this.file = null;
-	    this.certVerifier = certVerifier;
-	    initialized = true;
-	    updateUI();
-	}
-
-	public SecurityWarningDialog(DialogType dialogType, AccessType accessType,
-			JNLPFile file, Object[] extras) {
-		this.dialogType = dialogType;
-		this.accessType = accessType;
-		this.file = file;
-		this.certVerifier = null;
-		initialized = true;
-		this.extras = extras;
-		updateUI();
-	}
-	
-	//for displaying a single certificate
-	public SecurityWarningDialog(DialogType dialogType, X509Certificate c) {
-		this.dialogType = dialogType;
-		this.accessType = null;
-		this.file = null;
-		this.certVerifier = null;
-		this.cert = c;
-		initialized = true;
-		updateUI();
-	}
-	
-	/**
-	 * Returns if this dialog has been fully initialized yet.
-	 * @return true if this dialog has been initialized, and false otherwise.
-	 */
-	public boolean isInitialized(){
-		return initialized;
-	}
-	
-	/**
-	 * Shows a warning dialog for different types of system access (i.e. file
-	 * open/save, clipboard read/write, printing, etc).
-	 * 
-	 * @param accessType the type of system access requested.
-	 * @param file the jnlp file associated with the requesting application.
-	 * @return true if permission was granted by the user, false otherwise.
-	 */
-	public static boolean showAccessWarningDialog(AccessType accessType, 
-		JNLPFile file) {
-		return showAccessWarningDialog(accessType, file, null);
-	}
-	
-	/**
-	 * Shows a warning dialog for different types of system access (i.e. file
-	 * open/save, clipboard read/write, printing, etc).
-	 * 
-	 * @param accessType the type of system access requested.
-	 * @param file the jnlp file associated with the requesting application.
-	 * @param extras an optional array of Strings (typically) that gets 
-	 * passed to the dialog labels.
-	 * @return true if permission was granted by the user, false otherwise.
-	 */
-	public static boolean showAccessWarningDialog(AccessType accessType, 
-			JNLPFile file, Object[] extras) {
-			SecurityWarningDialog swd = new SecurityWarningDialog(
-					DialogType.ACCESS_WARNING, accessType, file, extras);
-			JDialog dialog = swd.createDialog();
-			swd.selectInitialValue();
-			dialog.setResizable(true);
-			centerDialog(dialog);
-			dialog.setVisible(true);
-			dialog.dispose();
-
-			Object selectedValue = swd.getValue();
-			if (selectedValue == null) {
-				return false;
-			} else if (selectedValue instanceof Integer) {
-				if (((Integer)selectedValue).intValue() == 0)
-					return true;
-				else
-					return false;
-			} else {
-				return false;
-			}
-		}
-	
-	/**
-	 * Shows a security warning dialog according to the specified type of
-	 * access. If <code>type</code> is one of AccessType.VERIFIED or
-	 * AccessType.UNVERIFIED, extra details will be available with regards
-	 * to code signing and signing certificates.
-	 *
-	 * @param accessType the type of warning dialog to show
-	 * @param file the JNLPFile associated with this warning
-	 * @param jarSigner the JarSigner used to verify this application
-	 */
-	public static boolean showCertWarningDialog(AccessType accessType, 
-			JNLPFile file, CertVerifier jarSigner) {
-		SecurityWarningDialog swd = 
-			new SecurityWarningDialog(DialogType.CERT_WARNING, accessType, file,
-			jarSigner);
-		JDialog dialog = swd.createDialog();
-		swd.selectInitialValue();
-		dialog.setResizable(true);
-		centerDialog(dialog);
-		dialog.setVisible(true);
-		dialog.dispose();
-
-		Object selectedValue = swd.getValue();
-		if (selectedValue == null) {
-			return false;
-		} else if (selectedValue instanceof Integer) {
-			if (((Integer)selectedValue).intValue() == 0)
-				return true;
-			else
-				return false;
-		} else {
-			return false;
-		}
-	}
-	
-	/**
-	 * Shows more information regarding jar code signing
-	 *
-	 * @param jarSigner the JarSigner used to verify this application
-	 * @param parent the parent option pane
-	 */
-	public static void showMoreInfoDialog(
-		CertVerifier jarSigner, JOptionPane parent) {
-
-		SecurityWarningDialog swd =
-			new SecurityWarningDialog(DialogType.MORE_INFO, null, null,
-			jarSigner);
-		JDialog dialog = swd.createDialog();
-		dialog.setLocationRelativeTo(parent);
-		swd.selectInitialValue();
-		dialog.setResizable(true);
-		dialog.setVisible(true);
-		dialog.dispose();
-	}
-
-	/**
-	 * Displays CertPath information in a readable table format.
-	 *
-	 * @param certs the certificates used in signing.
-	 */
-	public static void showCertInfoDialog(CertVerifier jarSigner,
-		JOptionPane parent) {
-		SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.CERT_INFO,
-			null, null, jarSigner);
-		JDialog dialog = swd.createDialog();
-		dialog.setLocationRelativeTo(parent);
-		swd.selectInitialValue();
-		dialog.setResizable(true);
-		dialog.setVisible(true);
-		dialog.dispose();
-	}
-
-	/**
-	 * Displays a single certificate's information.
-	 * 
-	 * @param c
-	 * @param optionPane
-	 */
-	public static void showSingleCertInfoDialog(X509Certificate c, 
-			JOptionPane parent) {
-
-		SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.SINGLE_CERT_INFO, c);
-			JDialog dialog = swd.createDialog();
-			dialog.setLocationRelativeTo(parent);
-			swd.selectInitialValue();
-			dialog.setResizable(true);
-			dialog.setVisible(true);
-			dialog.dispose();
-	}
-	
-	public static int showAppletWarning() {
-        	SecurityWarningDialog swd = new SecurityWarningDialog(DialogType.APPLET_WARNING,
-            		null, null, (CertVerifier) null);
-        	JDialog dialog = swd.createDialog();
-		centerDialog(dialog);
-        	swd.selectInitialValue();
-        	dialog.setResizable(true);
-        	dialog.setVisible(true);
-        	dialog.dispose();
-
-		Object selectedValue = swd.getValue();
-
-		//result 0 = Yes, 1 = No, 2 = Cancel
-		if (selectedValue == null) {
-			return 2;
-		} else if (selectedValue instanceof Integer) {
-			return ((Integer)selectedValue).intValue();
-		} else {
-			return 2;
-		}
-	}
-
-	//Modified from javax.swing.JOptionPane
-	private JDialog createDialog() {
-		String dialogTitle = "";
-		if (dialogType == DialogType.CERT_WARNING)
-			dialogTitle = "Warning - Security";
-		else if (dialogType == DialogType.MORE_INFO)
-			dialogTitle = "More Information";
-		else if (dialogType == DialogType.CERT_INFO)
-			dialogTitle = "Details - Certificate";
-		else if (dialogType == DialogType.ACCESS_WARNING)
-			dialogTitle = "Security Warning";
-		else if (dialogType == DialogType.APPLET_WARNING)
-			dialogTitle = "Applet Warning";
-
-		final JDialog dialog = new JDialog((Frame)null, dialogTitle, true);
-		
-		Container contentPane = dialog.getContentPane();
-		contentPane.setLayout(new BorderLayout());
-		contentPane.add(this, BorderLayout.CENTER);
-		dialog.pack();
-
-		WindowAdapter adapter = new WindowAdapter() {
-            private boolean gotFocus = false;
-            public void windowClosing(WindowEvent we) {
-                setValue(null);
-            }
-            public void windowGainedFocus(WindowEvent we) {
-                // Once window gets focus, set initial focus
-                if (!gotFocus) {
-                    selectInitialValue();
-                    gotFocus = true;
-                }
-            }
-        };
-		dialog.addWindowListener(adapter);
-		dialog.addWindowFocusListener(adapter);
-
-		dialog.addComponentListener(new ComponentAdapter() {
-            public void componentShown(ComponentEvent ce) {
-                // reset value to ensure closing works properly
-                setValue(JOptionPane.UNINITIALIZED_VALUE);
-            }
-        });
-
-		addPropertyChangeListener( new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent event) {
-                // Let the defaultCloseOperation handle the closing
-                // if the user closed the window without selecting a button
-                // (newValue = null in that case).  Otherwise, close the dialog.
-                if (dialog.isVisible() && 
-                	event.getSource() == SecurityWarningDialog.this &&
-                	(event.getPropertyName().equals(VALUE_PROPERTY) ||
-                	event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
-                	event.getNewValue() != null &&
-                	event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
-                    dialog.setVisible(false);
-                }
-            }
-        });
-
-		return dialog;
-	}
-
-	public AccessType getType() {
-		return accessType;
-	}
-
-	public JNLPFile getFile() {
-		return file;
-	}
-	
-	public CertVerifier getJarSigner() {
-		return certVerifier;
-	}
-	
-	public X509Certificate getCert() {
-		return cert;
-	}
-
-	/**
-	 * Updates the UI using SecurityWarningOptionPane, instead of the
-	 * basic dialog box.
-	 */
-	public void updateUI() {
-
-		if (dialogType == DialogType.CERT_WARNING)
-			setUI((OptionPaneUI) new CertWarningPane(this, this.certVerifier));
-		else if (dialogType == DialogType.MORE_INFO)
-			setUI((OptionPaneUI) new MoreInfoPane(this, this.certVerifier));
-		else if (dialogType == DialogType.CERT_INFO)
-			setUI((OptionPaneUI) new CertsInfoPane(this, this.certVerifier));
-		else if (dialogType == DialogType.SINGLE_CERT_INFO)
-			setUI((OptionPaneUI) new SingleCertInfoPane(this, this.certVerifier));
-		else if (dialogType == DialogType.ACCESS_WARNING)
-			setUI((OptionPaneUI) new AccessWarningPane(this, extras, this.certVerifier));
-		else if (dialogType == DialogType.APPLET_WARNING)
-			setUI((OptionPaneUI) new AppletWarningPane(this, this.certVerifier));
-	}
-
-	private static void centerDialog(JDialog dialog) {
-		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
-		Dimension dialogSize = dialog.getSize();
-
-		dialog.setLocation((screen.width - dialogSize.width)/2,
-			(screen.height - dialogSize.height)/2);
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/SingleCertInfoPane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* SingleCertInfoPane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import javax.swing.JComponent;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeSelectionModel;
-
-
-public class SingleCertInfoPane extends CertsInfoPane {
-
-	public SingleCertInfoPane(JComponent x, CertVerifier certVerifier) {
-		super(x, certVerifier);
-	}
-	
-	protected void buildTree() {
-		X509Certificate cert = ((SecurityWarningDialog)optionPane).getCert();
-		String subjectString = 
-			getCN(cert.getSubjectX500Principal().getName());
-		String issuerString = 
-			getCN(cert.getIssuerX500Principal().getName());
-
-		DefaultMutableTreeNode top = new DefaultMutableTreeNode(subjectString 
-				+ " (" + issuerString + ")");
-		
-		tree = new JTree(top);
-		tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-		tree.addTreeSelectionListener(new TreeSelectionHandler());
-	}
-	
-	protected void populateTable() {
-		X509Certificate c = ((SecurityWarningDialog)optionPane).getCert();
-		certNames = new String[1];
-		certsData = new ArrayList<String[][]>();
-		certsData.add(parseCert(c));
-		certNames[0] = getCN(c.getSubjectX500Principal().getName())
-		+ " (" + getCN(c.getIssuerX500Principal().getName()) + ")";
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/VariableX509TrustManager.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/* VariableX509TrustManager.java
-   Copyright (C) 2009 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security;
-
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-import sun.security.validator.ValidatorException;
-
-/**
- * This class implements an X509 Trust Manager. The certificates it trusts are 
- * "variable", in the sense that it can dynamically, and temporarily support 
- * different certificates that are not in the keystore.  
- */
-
-public class VariableX509TrustManager implements X509TrustManager {
-
-    KeyStore userKeyStore = null;
-    KeyStore caKeyStore = null;
-    
-    X509TrustManager userTrustManager = null;
-    X509TrustManager caTrustManager = null;
-    
-    ArrayList<Certificate> temporarilyTrusted = new ArrayList();
-    
-    static VariableX509TrustManager instance = null;
-
-    /**
-     * Constructor initializes the system, user and custom stores
-     */
-    public VariableX509TrustManager() {
-
-        try {
-            userKeyStore = SecurityUtil.getUserKeyStore();
-            TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
-            tmFactory.init(userKeyStore);
-            
-            // tm factory initialized, now get the managers so we can assign the X509 one
-            TrustManager[] trustManagers = tmFactory.getTrustManagers();
-            
-            for (int i=0; i < trustManagers.length; i++) {
-                if (trustManagers[i] instanceof X509TrustManager) {
-                    userTrustManager = (X509TrustManager) trustManagers[i];
-                }
-            }
-
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        try {
-            caKeyStore = SecurityUtil.getCacertsKeyStore();
-            TrustManagerFactory tmFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
-            tmFactory.init(caKeyStore);
-
-            // tm factory initialized, now get the managers so we can extract the X509 one
-            TrustManager[] trustManagers = tmFactory.getTrustManagers();
-
-            for (int i=0; i < trustManagers.length; i++) {
-                if (trustManagers[i] instanceof X509TrustManager) {
-                    caTrustManager = (X509TrustManager) trustManagers[i];
-                }
-            }
-
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Check if client is trusted (not support for custom here, only system/user)
-     */
-    public void checkClientTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-
-        // First try catrustmanager, then try usertrustmanager
-        try {
-            caTrustManager.checkClientTrusted(chain, authType);
-        } catch (Exception caex) {
-            try {
-                userTrustManager.checkClientTrusted(chain, authType);
-            } catch (Exception userex) {
-                // Do nothing here. This trust manager is intended to be used 
-                // only in the plugin instance vm, which does not act as a 
-                // server
-            }
-        }
-    }
-
-    public void checkServerTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-        checkServerTrusted(chain, authType, false);
-    }
-
-    /**
-     * Check if the server is trusted
-     * 
-     * @param chain The cert chain
-     * @param authType The auth type algorithm
-     * @param checkOnly Whether to "check only" i.e. no user prompt, or to prompt for permission 
-     */
-    public void checkServerTrusted(X509Certificate[] chain, String authType, boolean checkOnly) throws CertificateException {
-        try {
-            checkAllManagers(chain, authType);
-        } catch (CertificateException ce) {
-            
-            if (checkOnly) {
-                throw ce;
-            } else {
-
-                boolean b = askUser(chain,authType);
-            
-                if (b) {
-                    temporarilyTrust(chain[0]);
-                }
-
-                checkAllManagers(chain, authType);
-            }
-        }
-    }
-
-    /**
-     * Check system, user and custom trust manager  
-     */
-    private void checkAllManagers(X509Certificate[] chain, String authType) throws CertificateException {
-        // First try catrustmanager, then try usertrustmanager, and finally, check temp trusted certs
-        try {
-            caTrustManager.checkServerTrusted(chain, authType);
-        } catch (ValidatorException caex) {
-            try {
-                userTrustManager.checkServerTrusted(chain, authType);
-            } catch (ValidatorException uex) {
-                if (!temporarilyTrusted.contains(chain[0]))
-                    throw (CertificateException) uex;
-            }
-        }        
-    }
-
-    public X509Certificate[] getAcceptedIssuers() {
-        // delegate to default
-        return caTrustManager.getAcceptedIssuers();
-    }
-
-    /**
-     * Temporarily trust the given cert (runtime)
-     * 
-     * @param c The certificate to trust
-     */
-    private void temporarilyTrust(Certificate c) {
-        temporarilyTrusted.add(c);
-    }
-    
-    /**
-     * Ask user if the certificate should be trusted 
-     * 
-     * @param chain The certificate chain
-     * @param authType The authentication algorithm
-     * @return user's response
-     */
-    private boolean askUser(X509Certificate[] chain, String authType) {
-    	return SecurityWarningDialog.showCertWarningDialog(SecurityWarningDialog.AccessType.UNVERIFIED, null, new HttpsCertVerifier(this, chain, authType)); 
-    }
-
-    /**
-     * Return an instance of this singleton
-     * 
-     * @return The instance
-     */
-    public static VariableX509TrustManager getInstance() {
-        if (instance == null)
-            instance = new VariableX509TrustManager();
-        
-        return instance;
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificatePane.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,350 +0,0 @@
-/* CertificatePane.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security.viewer;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Enumeration;
-
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTable;
-import javax.swing.UIManager;
-import javax.swing.table.DefaultTableModel;
-
-import net.sourceforge.jnlp.security.CertVerifier;
-import net.sourceforge.jnlp.security.SecurityDialogUI;
-import net.sourceforge.jnlp.security.SecurityUtil;
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-import net.sourceforge.jnlp.tools.KeyTool;
-
-//import java.security.KeyStoreException;
-//import java.security.NoSuchAlgorithmException;
-//import java.security.cert.CertificateException;
-//import java.io.FileNotFoundException;
-//import java.io.IOException;
-
-
-// note: We might want to extend OptionPaneUI instead
-public class CertificatePane extends SecurityDialogUI {
-	
-	/**
-	 * The certificates stored in the user's trusted.certs file.
-	 */
-	private ArrayList<X509Certificate> certs = null;
-	
-	/**
-	 * "Issued To" and "Issued By" string pairs for certs.
-	 */
-	private String[][] issuedToAndBy = null;
-	private final String[] columnNames = { "Issued To", "Issued By" };
-	
-	private JTable table;
-	
-	/**
-	 * The KeyStore associated with the user's trusted.certs file.
-	 */
-	private KeyStore keyStore = null;
-	
-	public CertificatePane(JComponent x) {
-		super(x, null);
-		initializeKeyStore();
-	}
-	
-	/**
-	 * Reads the user's trusted.cacerts keystore.
-	 */
-	private void initializeKeyStore() {
-		try {
-			keyStore = SecurityUtil.getUserKeyStore();
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	
-	/**
-	 * Installs the user interface for the SecurityWarningDialog.
-	 */
-	public void installUI(JComponent c) {
-
-		//Only install the UI when type and file in SecurityWarningDialog
-		//have been set.
-		if (((CertificateViewer)c).isInitialized()) {
-			setSystemLookAndFeel();
-			optionPane = (JOptionPane)c;
-			optionPane.setLayout(new BorderLayout());
-			installComponents();
-			installListeners();
-		}
-	}
-
-	private void setSystemLookAndFeel() {
-		try {
-			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-		} catch (Exception e) {
-			//don't worry if we can't.
-		}
-	}
-	
-	//create the GUI here.
-	protected void installComponents() {
-		readKeyStore();
-		
-		JPanel main = new JPanel(new BorderLayout());
-		
-		JPanel tablePanel = new JPanel(new BorderLayout());
-		
-		//Table
-		DefaultTableModel tableModel 
-			= new DefaultTableModel(issuedToAndBy, columnNames);
-		table = new JTable(tableModel);
-		table.getTableHeader().setReorderingAllowed(false);
-		table.setFillsViewportHeight(true);
-		JScrollPane tablePane = new JScrollPane(table);
-		tablePane.setPreferredSize(new Dimension(500,200));
-		tablePane.setSize(new Dimension(500,200));
-		tablePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
-		
-		JTabbedPane tabbedPane = new JTabbedPane();
-		tabbedPane.addTab("User", tablePane);
-		JPanel buttonPanel = new JPanel(new FlowLayout());
-
-		String[] buttonNames = {"Import", "Export", "Remove", "Details"};
-		char[] buttonMnemonics = {	KeyEvent.VK_I, 
-									KeyEvent.VK_E, 
-									KeyEvent.VK_M,
-									KeyEvent.VK_D};
-		ActionListener[] listeners = {	new ImportButtonListener(),
-										new ExportButtonListener(),
-										new RemoveButtonListener(),
-										new DetailsButtonListener() };
-		JButton button;
-		
-		//get the max width
-		int maxWidth = 0;
-		for (int i = 0; i < buttonNames.length; i++) {
-			button = new JButton(buttonNames[i]);
-			maxWidth = Math.max(maxWidth, button.getMinimumSize().width);
-		}
-		
-		for (int i = 0; i < buttonNames.length; i++) {
-			button = new JButton(buttonNames[i]);
-			button.setMnemonic(buttonMnemonics[i]);
-			button.addActionListener(listeners[i]);
-			button.setSize(maxWidth, button.getSize().height);
-			buttonPanel.add(button);
-		}
-		
-		tablePanel.add(tabbedPane, BorderLayout.CENTER);
-		tablePanel.add(buttonPanel, BorderLayout.SOUTH);
-		
-		JPanel closePanel = new JPanel(new BorderLayout());
-		closePanel.setBorder(BorderFactory.createEmptyBorder(7,7,7,7));
-		JButton closeButton = new JButton("Close");
-		closeButton.addActionListener(createButtonActionListener(0));
-		closePanel.add(closeButton, BorderLayout.EAST);
-		
-		main.add(tablePanel, BorderLayout.CENTER);
-		main.add(closePanel, BorderLayout.SOUTH);
-		
-		optionPane.add(main);
-
-	}	
-	
-	/**
-	 * Read in the optionPane's keystore to issuedToAndBy.
-	 */
-	private void readKeyStore() {
-		
-		Enumeration<String> aliases = null;
-		certs = new ArrayList<X509Certificate>();
-		try {
-			
-			//Get all of the X509Certificates and put them into an ArrayList
-			aliases = keyStore.aliases();
-			while (aliases.hasMoreElements()) {
-				Certificate c = keyStore.getCertificate(aliases.nextElement());
-				if (c instanceof X509Certificate)
-					certs.add((X509Certificate)c);
-			}
-
-			//get the publisher and root information
-			issuedToAndBy = new String[certs.size()][2];
-			for (int i = 0; i < certs.size(); i++) {
-	            X509Certificate c = certs.get(i);
-				issuedToAndBy[i][0] = 
-					SecurityUtil.getCN(c.getSubjectX500Principal().getName());
-				issuedToAndBy[i][1] = 
-					SecurityUtil.getCN(c.getIssuerX500Principal().getName());
-	        }
-		} catch (Exception e) {
-			//TODO
-		}
-	}
-	
-	/**
-	 * Re-reads the certs file and repopulates the JTable. This is typically
-	 * called after a certificate was deleted from the keystore.
-	 */
-	private void repopulateTable() {
-		initializeKeyStore();
-		readKeyStore();
-		DefaultTableModel tableModel 
-			= new DefaultTableModel(issuedToAndBy, columnNames);
-		
-		table.setModel(tableModel);
-		optionPane.repaint();
-	}
-	
-	private class ImportButtonListener implements ActionListener {
-        public void actionPerformed(ActionEvent e) {
-
-        	JFileChooser chooser = new JFileChooser();
-        	int returnVal = chooser.showOpenDialog(optionPane);
-        	if(returnVal == JFileChooser.APPROVE_OPTION) {
-        		try {
-        			KeyTool kt = new KeyTool();
-        			kt.importCert(chooser.getSelectedFile());
-        			repopulateTable();
-        		} catch (Exception ex) {
-        			// TODO: handle exception
-        			ex.printStackTrace();
-        		}
-        	}
-        }
-    }
-	
-	private class ExportButtonListener implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			//For now, let's just export in -rfc mode as keytool does.
-			//we'll write to a file the exported certificate.
-
-
-			try {
-				int selectedRow = table.getSelectedRow();
-				if (selectedRow != -1) {
-		        	JFileChooser chooser = new JFileChooser();
-		        	int returnVal = chooser.showOpenDialog(optionPane);
-		        	if(returnVal == JFileChooser.APPROVE_OPTION) {
-		        		String alias = keyStore.getCertificateAlias(certs
-		        				.get(selectedRow));
-		        		if (alias != null) {
-		        			Certificate c = keyStore.getCertificate(alias);
-		        			PrintStream ps = new PrintStream(chooser.getSelectedFile().getAbsolutePath());
-		        			KeyTool.dumpCert(c, ps);
-		        			repopulateTable();
-		        		}
-		        	}
-				}
-			} catch (Exception ex) {
-				// TODO
-				ex.printStackTrace();
-			}
-		}
-	}
-	
-	private class RemoveButtonListener implements ActionListener {
-		
-		/**
-		 * Removes a certificate from the keyStore and writes changes to disk.
-		 */
-        public void actionPerformed(ActionEvent e) {
-        	
-        	try {
-        		int selectedRow = table.getSelectedRow();
-        		
-        		if (selectedRow != -1){
-        			String alias = keyStore.getCertificateAlias(certs.get(selectedRow));
-        			if (alias != null) {
-        				
-        				int i = JOptionPane.showConfirmDialog(optionPane, 
-        						"Are you sure you want to remove the selected certificate?", 
-        						"Confirmation - Remove Certificate?", 
-        						JOptionPane.YES_NO_OPTION);
-        				if (i == 0) {
-        					keyStore.deleteEntry(alias);
-        					FileOutputStream fos = new FileOutputStream(
-        						SecurityUtil.getTrustedCertsFilename());
-        					keyStore.store(fos, SecurityUtil.getTrustedCertsPassword());
-        					fos.close();
-        				}
-        			}
-        			repopulateTable();
-        		}
-        	} catch (Exception ex) {
-        		// TODO
-				ex.printStackTrace();
-        	}
-
-        }
-    }
-	
-	private class DetailsButtonListener implements ActionListener {
-		
-		/**
-		 * Shows the details of a trusted certificate.
-		 */
-        public void actionPerformed(ActionEvent e) {
-        	
-        	int selectedRow = table.getSelectedRow();
-        	if (selectedRow != -1 && selectedRow >= 0) {
-        		X509Certificate c = certs.get(selectedRow);
-        		SecurityWarningDialog.showSingleCertInfoDialog(c, optionPane);
-        	}
-        }
-    }
-	
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/* CertificateViewer.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.security.viewer;
-
-import java.awt.BorderLayout;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Toolkit;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.plaf.OptionPaneUI;
-
-public class CertificateViewer extends JOptionPane {
-
-	private boolean initialized = false;
-	
-	public CertificateViewer() throws Exception {
-
-		initialized = true;
-		updateUI();
-	}
-		
-	public boolean isInitialized(){
-		return initialized;
-	}
-	
-	public void updateUI() {
-		setUI((OptionPaneUI) new CertificatePane(this));
-	}
-	
-	private static void centerDialog(JDialog dialog) {
-		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
-		Dimension dialogSize = dialog.getSize();
-
-		dialog.setLocation((screen.width - dialogSize.width)/2,
-			(screen.height - dialogSize.height)/2);
-	}
-	
-	//Modified from javax.swing.JOptionPane
-	private JDialog createDialog() {
-		String dialogTitle = "Certificates";
-		final JDialog dialog = new JDialog((Frame)null, dialogTitle, true);
-		
-		Container contentPane = dialog.getContentPane();
-		contentPane.setLayout(new BorderLayout());
-		contentPane.add(this, BorderLayout.CENTER);
-		dialog.pack();
-
-		WindowAdapter adapter = new WindowAdapter() {
-            private boolean gotFocus = false;
-            public void windowClosing(WindowEvent we) {
-                setValue(null);
-            }
-            public void windowGainedFocus(WindowEvent we) {
-                // Once window gets focus, set initial focus
-                if (!gotFocus) {
-                    selectInitialValue();
-                    gotFocus = true;
-                }
-            }
-        };
-		dialog.addWindowListener(adapter);
-		dialog.addWindowFocusListener(adapter);
-
-		dialog.addComponentListener(new ComponentAdapter() {
-            public void componentShown(ComponentEvent ce) {
-                // reset value to ensure closing works properly
-                setValue(JOptionPane.UNINITIALIZED_VALUE);
-            }
-        });
-
-		addPropertyChangeListener( new PropertyChangeListener() {
-            public void propertyChange(PropertyChangeEvent event) {
-                // Let the defaultCloseOperation handle the closing
-                // if the user closed the window without selecting a button
-                // (newValue = null in that case).  Otherwise, close the dialog.
-                if (dialog.isVisible() && 
-                	event.getSource() == CertificateViewer.this &&
-                	(event.getPropertyName().equals(VALUE_PROPERTY) ||
-                	event.getPropertyName().equals(INPUT_VALUE_PROPERTY)) &&
-                	event.getNewValue() != null &&
-                	event.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
-                    dialog.setVisible(false);
-                }
-            }
-        });
-
-		return dialog;
-	}
-	
-	public static void showCertificateViewer() throws Exception {
-		CertificateViewer cv = new CertificateViewer();
-		JDialog dialog = cv.createDialog();
-		cv.selectInitialValue();
-		dialog.setResizable(true);
-		centerDialog(dialog);
-		dialog.setVisible(true);
-		dialog.dispose();	
-	}
-	
-	public static void main(String[] args) throws Exception {
-		CertificateViewer.showCertificateViewer();
-	}
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/ServiceUtil.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.lang.reflect.*;
-import java.security.*;
-
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-
-/**
- * Provides static methods to interact useful for using the JNLP
- * services.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- * @version $Revision: 1.8 $
- */
-public class ServiceUtil {
-
-    private static String R(String key) {
-        return JNLPRuntime.getMessage(key);
-    }
-
-    /**
-     * Types of system access that may need permissions.
-     */
-    public static enum AccessType {
-        READ_FILE, WRITE_FILE, CLIPBOARD_READ, CLIPBOARD_WRITE, PRINTER
-    }
-
-    /**
-     * Returns the BasicService reference, or null if the service is
-     * unavailable.
-     */
-    public static BasicService getBasicService() {
-        return (BasicService) getService("javax.jnlp.BasicService");
-    }
-
-    /**
-     * Returns the ClipboardService reference, or null if the service is
-     * unavailable.
-     */
-    public static ClipboardService getClipboardService() {
-        return (ClipboardService) getService("javax.jnlp.ClipboardService");
-    }
-
-    /**
-     * Returns the DownloadService reference, or null if the service is
-     * unavailable.
-     */
-    public static DownloadService getDownloadService() {
-        return (DownloadService) getService("javax.jnlp.DownloadService");
-    }
-
-    /**
-     * Returns the ExtensionInstallerService reference, or null if the service is
-     * unavailable.
-     */
-    public static ExtensionInstallerService getExtensionInstallerService() {
-        return (ExtensionInstallerService) getService("javax.jnlp.ExtensionInstallerService");
-    }
-
-    /**
-     * Returns the FileOpenService reference, or null if the service is
-     * unavailable.
-     */
-    public static FileOpenService getFileOpenService() {
-        return (FileOpenService) getService("javax.jnlp.FileOpenService");
-    }
-
-    /**
-     * Returns the FileSaveService reference, or null if the service is
-     * unavailable.
-     */
-    public static FileSaveService getFileSaveService() {
-        return (FileSaveService) getService("javax.jnlp.FileSaveService");
-    }
-
-    /**
-     * Returns the PersistenceService reference, or null if the service is
-     * unavailable.
-     */
-    public static PersistenceService getPersistenceService() {
-        return (PersistenceService) getService("javax.jnlp.PersistenceService");
-    }
-
-    /**
-     * Returns the PrintService reference, or null if the service is
-     * unavailable.
-     */
-    public static PrintService getPrintService() {
-        return (PrintService) getService("javax.jnlp.PrintService");
-    }
-
-    /**
-     * Returns the service, or null instead of an UnavailableServiceException
-     */
-    private static Object getService(String name) {
-        try {
-            return ServiceManager.lookup(name);
-        }
-        catch (UnavailableServiceException ex) {
-            return null;
-        }
-    }
-
-    /**
-     * Creates a Proxy object implementing the specified interface
-     * when makes all calls in the security context of the system
-     * classes (ie, AllPermissions).  This means that the services
-     * must be more than extremely careful in the operations they
-     * perform.
-     */
-    static Object createPrivilegedProxy(Class iface, final Object receiver) {
-        return java.lang.reflect.Proxy.newProxyInstance(XServiceManagerStub.class.getClassLoader(),
-                new Class[] { iface },
-                new PrivilegedHandler(receiver));
-    }
-
-    /**
-     * calls the object's method using privileged access
-     */
-    private static class PrivilegedHandler implements InvocationHandler {
-        private final Object receiver;
-
-        PrivilegedHandler(Object receiver) {
-            this.receiver = receiver;
-        }
-
-        public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("call privileged method: "+method.getName());
-                if (args != null)
-                    for (int i=0; i < args.length; i++)
-                        System.err.println("           arg: "+args[i]);
-            }
-
-            PrivilegedExceptionAction invoker = new PrivilegedExceptionAction() {
-                public Object run() throws Exception {
-                    return method.invoke(receiver, args);
-                }
-            };
-
-            Object result = AccessController.doPrivileged(invoker);
-
-            if (JNLPRuntime.isDebug())
-                System.err.println("        result: "+result);
-
-            return result;
-        }
-    };
-
-    /**
-     * Returns whether the app requesting a service is signed. If the app is
-     * unsigned, the user is prompted with a dialog asking if the action
-     * should be allowed.
-     * @param type the type of access being requested
-     * @param extras extra Strings (usually) that are passed to the dialog for
-     * message formatting.
-     * @return true if the access was granted, false otherwise.
-     */
-    public static boolean checkAccess(SecurityWarningDialog.AccessType type,
-    		Object... extras) {
-
-        ApplicationInstance app = JNLPRuntime.getApplication();
-        if (app != null) {
-            if (!app.isSigned()) {
-            	final SecurityWarningDialog.AccessType tmpType = type;
-            	final Object[] tmpExtras = extras;
-            	final ApplicationInstance tmpApp = app;
-            	
-            	//We need to do this to allow proper icon loading for unsigned
-            	//applets, otherwise permissions won't be granted to load icons
-            	//from resources.jar.
-            	Object o = AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                    	boolean b = SecurityWarningDialog.showAccessWarningDialog(tmpType,
-                                tmpApp.getJNLPFile(), tmpExtras);
-                    	return (Object) new Boolean(b);
-                    }
-                });
-            	
-            	return ((Boolean)o).booleanValue();
-                 
-            } else if (app.isSigned()) {
-
-                //just return true here regardless if the app
-                //has signing issues -- at this point the user would've
-                //already decided to run the app anyways.
-                return true;
-            }
-        }
-        return false; //deny
-    }
-}
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XBasicService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-// Copyright (C) 2001 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import javax.jnlp.*;
-import javax.swing.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.util.*;
-
-/**
- * The BasicService JNLP service.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.10 $ 
- */
-class XBasicService implements BasicService {
-
-    /** command used to exec the native browser */
-    private String command = null;
-
-    /** whether the command was loaded / prompted for */
-    private boolean initialized = false;
-
-
-    protected XBasicService() {
-    }
-
-    /**
-     * Returns the codebase of the application, applet, or
-     * installer.  If the codebase was not specified in the JNLP
-     * element then the main JAR's location is returned.  If no main
-     * JAR was specified then the location of the JAR containing the
-     * main class is returned.
-     */
-    public URL getCodeBase() {
-        ApplicationInstance app = JNLPRuntime.getApplication();
-
-        if (app != null) {
-            JNLPFile file = app.getJNLPFile();
-
-            // return the codebase.
-            if (file.getCodeBase() != null)
-                return file.getCodeBase();
-
-            // else return the main JAR's URL.
-            JARDesc mainJar = file.getResources().getMainJAR();
-            if (mainJar != null)
-                return mainJar.getLocation();
-
-            // else find JAR where main class was defined.
-            //
-            // JNLPFile file = app.getJNLPFile();
-            // String mainClass = file.getLaunchInfo().getMainClass()+".class";
-            // URL jarUrl = app.getClassLoader().getResource(mainClass);
-            // go through list of JARDesc to find one matching jarUrl
-        }
-
-        return null;
-    }
-
-    /**
-     * Return true if the Environment is Offline
-     */
-    public boolean isOffline() {
-        return false;
-    }
-
-    /**
-     * Return true if a Web Browser is Supported
-     */
-    public boolean isWebBrowserSupported() {
-        initialize();
-
-        return command != null;
-    }
-
-    /**
-     * Show a document.
-     *
-     * @return whether the document was opened 
-     */
-    public boolean showDocument(URL url)  {
-        initialize();
-
-        if (url.toString().endsWith(".jnlp")) {
-            try {
-                new Launcher().launchExternal(url);
-                return true;
-            }
-            catch (Exception ex) {
-                return false;
-            }
-        }
-
-        if (command != null) {
-            try {
-                // this is bogus because the command may require options;
-                // should use a StreamTokenizer or similar to get tokens
-                // outside of quotes.
-                Runtime.getRuntime().exec(command + url.toString());
-                //Runtime.getRuntime().exec(new String[]{command,url.toString()});
-
-                return true;
-            }
-            catch(IOException ex){
-                if (JNLPRuntime.isDebug())
-                    ex.printStackTrace();
-            }
-        }
-
-        return false;
-    }
-
-    private void initialize() {
-        if (initialized)
-            return;
-        initialized = true;
-
-        if(isWindows()) {
-            command = "rundll32 url.dll,FileProtocolHandler ";
-        }
-        else {
-            PropertiesFile props = JNLPRuntime.getProperties();
-            command = props.getProperty("browser.command");
-
-            if(command == null) { // prompt & store
-                command = promptForCommand(null);
-
-                if(command != null) {
-                    props.setProperty("browser.command", command);
-                    props.store();
-                }
-            }
-        }
-    }
-
-    private boolean isWindows() {
-        String os = System.getProperty("os.name");
-        if(os != null && os.startsWith("Windows"))
-            return true;
-        else
-            return false;
-    }
-
-    private String promptForCommand(String cmd) {
-        return JOptionPane.showInputDialog(new JPanel(),
-                                           "Browser Location:",
-                                           "Specify Browser Location",
-                                           JOptionPane.PLAIN_MESSAGE 
-                                          );
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XClipboardService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/* XClipboardService.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.services;
-
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-
-import java.awt.datatransfer.Transferable;
-import java.awt.Toolkit;
-
-/**
- * The ClipboardService JNLP service.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-class XClipboardService implements ClipboardService {
-
-	protected XClipboardService() {
-	}
-
-	/**
-	 * Returns the contents of the system clipboard.
-	 */
-	public java.awt.datatransfer.Transferable getContents(){
-
-		if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_READ)) {
-			Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
-			return (Transferable) ServiceUtil.createPrivilegedProxy(
-				Transferable.class, t);
-		} else {
-			return null;
-		}
-	}
-
-	/**
-	 * Sets the contents of the system clipboard.
-	 */
-	public void setContents(java.awt.datatransfer.Transferable contents) {
-		if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.CLIPBOARD_WRITE)) {
-			Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
-				contents, null);
-		}
-	}
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XDownloadService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-
-/**
- * The DownloadService JNLP service.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $ 
- */
-class XDownloadService implements DownloadService {
-
-    protected XDownloadService() {
-    }
-
-    // comments copied from DownloadService interface
-
-    /** 
-     * Returns a listener that will automatically display download
-     * progress to the user.
-     */
-    public DownloadServiceListener getDefaultProgressWindow() {
-        return null;
-    }
-
-    /** 
-     * Returns whether the part in an extension (specified by the
-     * url and version) is cached locally.
-     */
-    public boolean isExtensionPartCached(URL ref, String version, String part) {
-        return true;
-    }
-
-    /** 
-     * Returns whether the parts in an extension (specified by the
-     * url and version) are cached locally.
-     */
-    public boolean isExtensionPartCached(URL ref, String version, String[] parts) {
-        return true;
-    }
-
-    /** 
-     * Returns whether the part of the calling application is cached
-     * locally.  If called by code specified by an extension
-     * descriptor, the specified part refers to the extension not
-     * the application.
-     */
-    public boolean isPartCached(String part) {
-        return true;
-    }
-
-    /** 
-     * Returns whether all of the parts of the calling application
-     * are cached locally.  If called by code in an extension, the
-     * part refers the the part of the extension not the
-     * application.
-     */
-    public boolean isPartCached(String[] parts) {
-        return true;
-    }
-
-    /** 
-     * Returns whether the resource is cached locally.  This method
-     * only returns true if the resource is specified by the calling
-     * application or extension.
-     */ 
-    public boolean isResourceCached(URL ref, String version) {
-        return true;
-    }
-
-    /** 
-     * Downloads the parts of an extension.
-     *
-     * @throws IOException
-     */ 
-    public void loadExtensionPart(URL ref, String version, String[] parts, DownloadServiceListener progress) throws IOException {
-    }
-
-    /** 
-     * Downloads a part of an extension.
-     *
-     * @throws IOException
-     */ 
-    public void loadExtensionPart(URL ref, String version, String part, DownloadServiceListener progress) throws IOException {
-    }
-
-    /** 
-     * Downloads the parts.
-     *
-     * @throws IOException
-     */ 
-    public void loadPart(String[] parts, DownloadServiceListener progress) throws IOException {
-    }
-
-    /** 
-     * Downloads the part.
-     *
-     * @throws IOException
-     */ 
-    public void loadPart(String part, DownloadServiceListener progress) throws IOException {
-    }
-
-    /** 
-     * Downloads a resource.
-     *
-     * @throws IOException
-     */ 
-    public void loadResource(URL ref, String version, DownloadServiceListener progress) throws IOException {
-    }
-
-    /** 
-     * Notify the system that an extension's part is no longer
-     * important to cache.
-     *
-     * @throws IOException
-     */ 
-    public void removeExtensionPart(URL ref, String version, String part) throws IOException {
-    }
-
-    /** 
-     * Notify the system that an extension's parts are no longer
-     * important to cache.
-     *
-     * @throws IOException
-     */ 
-    public void removeExtensionPart(URL ref, String version, String[] parts) throws IOException {
-    }
-
-    /** 
-     * Notifies the system that a part  is no longer important to
-     * cache.
-     *
-     * @throws IOException
-     */ 
-    public void removePart(String part) throws IOException {
-    }
-
-    /** 
-     * Notifies the system that the parts  is no longer important to
-     * cache.
-     *
-     * @throws IOException
-     */ 
-    public void removePart(String[] parts) throws IOException {
-    }
-
-    /** 
-     * Notifies the system that the resource is no longer important
-     * to cache.
-     *
-     * @throws IOException
-     */
-    public void removeResource(URL ref, String version) throws IOException {
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XExtensionInstallerService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-
-/**
- * The ExtensionInstallerService JNLP service.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $ 
- */
-class XExtensionInstallerService implements ExtensionInstallerService {
-
-    protected XExtensionInstallerService() {
-    }
-
-    /**
-     *
-     */
-    public URL getExtensionLocation() {
-        return null;
-    }
-
-    /**
-     *
-     */
-    public String getExtensionVersion() {
-        return null;
-    }
-
-    /**
-     *
-     */
-    public String getInstalledJRE(java.net.URL url, java.lang.String version) {
-        return null;
-    }
-
-    /**
-     *
-     */
-    public String getInstallPath() {
-        return null;
-    }
-
-    /**
-     *
-     */
-    public void hideProgressBar() {
-    }
-
-    /**
-     *
-     */
-    public void hideStatusWindow() {
-    }
-
-    /**
-     *
-     */
-    public void installFailed() {
-    }
-
-    /**
-     *
-     */
-    public void installSucceeded(boolean needsReboot) {
-    }
-
-    /**
-     *
-     */
-    public void setHeading(java.lang.String heading) {
-    }
-
-    /**
-     *
-     */
-    public void setJREInfo(java.lang.String platformVersion, java.lang.String jrePath) {
-    }
-
-    /**
-     *
-     */
-    public void setNativeLibraryInfo(java.lang.String path) {
-    }
-
-    /**
-     *
-     */
-    public void setStatus(java.lang.String status) {
-    }
-
-    /**
-     *
-     */
-    public void updateProgress(int value) {
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileContents.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * File contents.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $ 
- */
-class XFileContents implements FileContents {
-
-    /** the file */
-    private File file;
-
-    /**
-     * Create a file contents implementation for the file.
-     */
-    protected XFileContents(File file) {
-        this.file = file;
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public boolean canRead() throws IOException {
-        return file.canRead();
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public boolean canWrite() throws IOException {
-        return file.canWrite();
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public InputStream getInputStream() throws IOException {
-        return new FileInputStream(file);
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public long getLength() throws IOException {
-        return file.length();
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public long getMaxLength() throws IOException {
-        return Long.MAX_VALUE;
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public String getName() throws IOException {
-        return file.getName();
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public OutputStream getOutputStream(boolean overwrite) throws IOException {
-        // file.getPath compatible with pre-1.4 JREs
-        return new FileOutputStream(file.getPath(), !overwrite);
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public JNLPRandomAccessFile getRandomAccessFile(String mode) throws IOException {
-        return new XJNLPRandomAccessFile(file, mode);
-    }
-
-    /**
-     *
-     * @throws IOException if an I/O exception occurs.
-     */
-    public long setMaxLength(long maxlength) throws IOException {
-        return maxlength;
-    }
-
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileOpenService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/* XFileOpenService.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import java.security.*;
-
-/**
- * The FileOpenService JNLP service.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-class XFileOpenService implements FileOpenService {
-
-    protected XFileOpenService() {
-    }
-
-    /**
-     * Prompts the user to select a single file.
-     */
-    public FileContents openFileDialog (java.lang.String pathHint,
-        java.lang.String[] extensions) throws java.io.IOException {
-
-        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) {
-
-            //open a file dialog here, let the user choose the file.
-            JFileChooser chooser = new JFileChooser();
-            int chosen = chooser.showOpenDialog(null);
-            if (chosen == JFileChooser.APPROVE_OPTION) {
-                return (FileContents) ServiceUtil.createPrivilegedProxy(
-                           FileContents.class,
-                           new XFileContents(chooser.getSelectedFile()));
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Prompts the user to select one or more files.
-     */
-    public FileContents[] openMultiFileDialog (java.lang.String pathHint,
-            java.lang.String[] extensions) throws java.io.IOException {
-
-        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
-            JFileChooser chooser = new JFileChooser();
-            chooser.setMultiSelectionEnabled(true);
-            int chosen = chooser.showOpenDialog(null);
-
-            if (chosen == JFileChooser.APPROVE_OPTION) {
-                File[] files = chooser.getSelectedFiles();
-                int length = files.length;
-                XFileContents[] xfiles = new XFileContents[length];
-                for (int i = 0; i < length; i++)
-                    xfiles[i] = new XFileContents(files[i]);
-                return (FileContents[]) ServiceUtil.createPrivilegedProxy(
-                           FileContents.class, xfiles);
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XFileSaveService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/* XFileSaveService.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
-*/
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.security.*;
-
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import java.security.*;
-
-/**
- * The FileSaveService JNLP service.
- *
- * @author <a href="mailto:jsumali@redhat.com">Joshua Sumali</a>
- */
-class XFileSaveService implements FileSaveService {
-
-    protected XFileSaveService() {
-    }
-
-    /**
-     * Prompts the user to save a file.
-     */
-    public FileContents saveFileDialog(java.lang.String pathHint,
-        java.lang.String[] extensions, java.io.InputStream stream,
-        java.lang.String name) throws java.io.IOException {
-
-        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
-            JFileChooser chooser = new JFileChooser();
-            int chosen = chooser.showSaveDialog(null);
-
-            if (chosen == JFileChooser.APPROVE_OPTION) {
-                writeToFile(stream, chooser.getSelectedFile());
-                return (FileContents) ServiceUtil.createPrivilegedProxy(
-                           FileContents.class,
-                           new XFileContents(chooser.getSelectedFile()));
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Prompts the user to save a file, with an optional pre-set filename.
-     */
-    public FileContents saveAsFileDialog(java.lang.String pathHint,
-        java.lang.String[] extensions, FileContents contents) throws java.io.IOException {
-
-        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.WRITE_FILE)) {
-            JFileChooser chooser = new JFileChooser();
-            chooser.setSelectedFile(new File(contents.getName()));
-            int chosen = chooser.showSaveDialog(null);
-
-            if (chosen == JFileChooser.APPROVE_OPTION) {
-                writeToFile(contents.getInputStream(),
-                            chooser.getSelectedFile());
-
-                return (FileContents) ServiceUtil.createPrivilegedProxy(
-                           FileContents.class,
-                           new XFileContents(chooser.getSelectedFile()));
-            } else {
-                return null;
-            }
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Writes actual file to disk.
-     */
-    private void writeToFile(InputStream stream, File file) throws IOException {
-        if (!file.createNewFile()) { //file exists
-            boolean replace = (JOptionPane.showConfirmDialog(null, 
-				file.getAbsolutePath() + " already exists.\n"
-                +"Do you want to replace it?", 
-				"Warning - File Exists", JOptionPane.YES_NO_OPTION) == 0);
-            if (!replace)
-                return;
-        } else {
-            file.createNewFile();
-        }
-
-        if (file.canWrite()) {
-            FileOutputStream out = new FileOutputStream(file);
-            byte[] b = new byte[256];
-            int read = 0;
-            while ((read = stream.read(b)) > 0)
-                out.write(b, 0, read);
-            out.flush();
-            out.close();
-        } else {
-            throw new IOException("Unable to open file for writing");
-        }
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/* XJNLPRandomAccessFile.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
- */
-package net.sourceforge.jnlp.services;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-
-import javax.jnlp.JNLPRandomAccessFile;
-
-public class XJNLPRandomAccessFile implements JNLPRandomAccessFile {
-
-	private RandomAccessFile raf;
-	
-	public XJNLPRandomAccessFile(File file, String mode) {
-		try {
-			raf = new RandomAccessFile(file, mode);
-		} catch (FileNotFoundException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-	
-	public void close() throws IOException {
-		raf.close();
-	}
-
-	public long getFilePointer() throws IOException {
-		return raf.getFilePointer();
-	}
-
-	public long length() throws IOException {
-		return raf.length();
-	}
-
-	public int read() throws IOException {
-		return raf.read();
-	}
-
-	public int read(byte[] b, int off, int len) throws IOException {
-		return raf.read(b, off, len);
-	}
-
-	public int read(byte[] b) throws IOException {
-		return raf.read(b);
-	}
-
-	public boolean readBoolean() throws IOException {
-		return raf.readBoolean();
-	}
-
-	public byte readByte() throws IOException {
-		return raf.readByte();
-	}
-
-	public char readChar() throws IOException {
-		return raf.readChar();
-	}
-
-	public double readDouble() throws IOException {
-		return raf.readDouble();
-	}
-
-	public float readFloat() throws IOException {
-		return raf.readFloat();
-	}
-
-	public void readFully(byte[] b) throws IOException {
-		raf.readFully(b);
-	}
-
-	public void readFully(byte[] b, int off, int len) throws IOException {
-		raf.readFully(b, off, len);
-	}
-
-	public int readInt() throws IOException {
-		return raf.readInt();
-	}
-
-	public String readLine() throws IOException {
-		return raf.readLine();
-	}
-
-	public long readLong() throws IOException {
-		return raf.readLong();
-	}
-
-	public short readShort() throws IOException {
-		return raf.readShort();
-	}
-
-	public String readUTF() throws IOException {
-		return raf.readUTF();
-	}
-
-	public int readUnsignedByte() throws IOException {
-		return raf.readUnsignedByte();
-	}
-
-	public int readUnsignedShort() throws IOException {
-		return raf.readUnsignedShort();
-	}
-
-	public void seek(long pos) throws IOException {
-		raf.seek(pos);
-	}
-
-	public void setLength(long newLength) throws IOException {
-		raf.setLength(newLength);
-	}
-
-	public int skipBytes(int n) throws IOException {
-		return raf.skipBytes(n);
-	}
-
-	public void write(int b) throws IOException {
-		raf.write(b);
-
-	}
-
-	public void write(byte[] b) throws IOException {
-		raf.write(b);
-	}
-
-	public void write(byte[] b, int off, int len) throws IOException {
-		raf.write(b, off, len);
-	}
-
-	public void writeBoolean(boolean v) throws IOException {
-		raf.writeBoolean(v);
-	}
-
-	public void writeByte(int v) throws IOException {
-		raf.writeByte(v);
-	}
-
-	public void writeBytes(String s) throws IOException {
-		raf.writeBytes(s);
-	}
-
-	public void writeChar(int v) throws IOException {
-		raf.writeChar(v);
-	}
-
-	public void writeChars(String s) throws IOException {
-		raf.writeChars(s);
-	}
-
-	public void writeDouble(double v) throws IOException {
-		raf.writeDouble(v);
-	}
-
-	public void writeFloat(float v) throws IOException {
-		raf.writeFloat(v);
-	}
-
-	public void writeInt(int v) throws IOException {
-		raf.writeInt(v);
-	}
-
-	public void writeLong(long v) throws IOException {
-		raf.writeLong(v);
-	}
-
-	public void writeShort(int v) throws IOException {
-		raf.writeShort(v);
-	}
-
-	public void writeUTF(String str) throws IOException {
-		raf.writeUTF(str);
-	}
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPersistenceService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
-
-/**
- * The BasicService JNLP service.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.7 $ 
- */
-class XPersistenceService implements PersistenceService {
-
-    // todo: recheck delete, etc to make sure security is tight
-
-    protected XPersistenceService() {
-    }
-
-    /**
-     * Checks whether the application has access to URL area
-     * requested.  If the method returns normally then the specified
-     * location can be accessed by the current application.
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    protected void checkLocation(URL location) throws MalformedURLException {
-        ApplicationInstance app = JNLPRuntime.getApplication();
-        if (app == null)
-            throw new MalformedURLException("Cannot determine the current application.");
-
-        URL source = app.getJNLPFile().getCodeBase();
-
-        if (!source.getHost().equalsIgnoreCase(location.getHost()))
-            throw new MalformedURLException("Cannot access data from a different host.");
-
-        // test for above codebase, not perfect but works for now
-
-        String requestPath = location.getFile();
-        if (-1 != requestPath.lastIndexOf("/"))
-            requestPath = requestPath.substring(0, requestPath.lastIndexOf("/"));
-        else
-            requestPath = "";
-
-        if (JNLPRuntime.isDebug()) {
-            System.out.println("codebase path: "+source.getFile());
-            System.out.println("request path: "+requestPath);
-        }
-
-        if (!source.getFile().startsWith(requestPath))
-            throw new MalformedURLException("Cannot access data below source URL path.");
-    }
-
-    /**
-     * Converts a URL into a file in the persistence store.
-     *
-     * @return the file
-     */
-    protected File toCacheFile(URL location) throws MalformedURLException {
-        return CacheUtil.urlToPath(location, "pcache");
-    }
-
-    /**
-     *
-     * @return the maximum size of storage that got granted, in bytes
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public long create(URL location, long maxsize) throws MalformedURLException, IOException {
-        checkLocation(location);
-
-        File file = toCacheFile(location);
-        file.getParentFile().mkdirs();
-
-        if (!file.createNewFile())
-            throw new IOException("File already exists.");
-
-        return maxsize;
-    }
-
-    /**
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public void delete(URL location) throws MalformedURLException, IOException {
-        checkLocation(location);
-
-        toCacheFile(location).delete();
-    }
-
-    /**
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public FileContents get(URL location) throws MalformedURLException, IOException, FileNotFoundException {
-        checkLocation(location);
-
-        File file = toCacheFile(location);
-        if (!file.exists())
-            throw new FileNotFoundException("Persistence store for "
-              + location.toString() + " is not found.");
-        file.getParentFile().mkdirs();
-
-        return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class, new XFileContents(file));
-    }
-
-    /**
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public String[] getNames(URL location) throws MalformedURLException, IOException {
-        checkLocation(location);
-
-
-        File file = toCacheFile(location);
-        if (!file.isDirectory())
-            return new String[0];
-
-        List result = new ArrayList();
-
-        // check whether this is right: only add files and not directories.
-        File entries[] = file.listFiles();
-        for (int i=0; i < entries.length; i++)
-            if (entries[i].isFile())
-                result.add(entries[i].getName());
-
-        return (String[]) result.toArray(new String[result.size()]);
-    }
-
-    /**
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public int getTag(URL location) throws MalformedURLException, IOException {
-        checkLocation(location);
-
-        // todo: actually implement tags
-
-        if (toCacheFile(location).exists())
-            return PersistenceService.CACHED;
-
-        return PersistenceService.CACHED;
-    }
-
-    /**
-     *
-     * @throws MalformedURLException if the application cannot access the location
-     */
-    public void setTag(URL location, int tag) throws MalformedURLException, IOException {
-        checkLocation(location);
-
-        // todo: actually implement tags
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XPrintService.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/* XPrintService.java
-   Copyright (C) 2008 Red Hat, Inc.
-
-This file is part of IcedTea.
-
-IcedTea is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 2.
-
-IcedTea is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with IcedTea; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version.
- */
-
-package net.sourceforge.jnlp.services;
-
-import java.awt.print.PageFormat;
-import java.awt.print.Pageable;
-import java.awt.print.Printable;
-import java.awt.print.PrinterException;
-import java.awt.print.PrinterJob;
-
-import javax.jnlp.*;
-import javax.swing.JOptionPane;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-public class XPrintService implements PrintService {
-
-	// If pj is null, then we do not have a printer to use.
-	private PrinterJob pj;
-	
-	public XPrintService() {
-		pj = PrinterJob.getPrinterJob();
-	}
-	
-	public PageFormat getDefaultPage() {
-		if (pj != null)
-			return pj.defaultPage();
-		else {
-			showWarning();
-			return new PageFormat(); // might not have default settings.
-		}
-	}
-	
-	public PageFormat showPageFormatDialog(PageFormat page) {
-		if (pj != null)
-			return pj.pageDialog(page);
-		else {
-			showWarning();
-			return page;
-		}
-
-	}
-	
-	public boolean print(Pageable document) {
-		if (pj != null) {
-			pj.setPageable(document);
-			if (pj.printDialog()) {
-				try {
-					pj.print();
-					return true;
-				} catch(PrinterException pe) {
-					System.err.println("Could not print: " + pe);
-					return false;
-				}
-			}
-		} else 
-			showWarning();
-		
-		return false;
-	}
-	
-	public boolean print(Printable painter) {
-		if (pj != null) {
-			pj.setPrintable(painter);
-			if (pj.printDialog()) {
-				try {
-					pj.print();
-					return true;
-				} catch(PrinterException pe) {
-					System.err.println("Could not print: " + pe);
-					return false;
-				}
-				
-			}
-		} else
-			showWarning();
-		
-		return false;
-	}
-	
-	private void showWarning() {
-		JOptionPane.showMessageDialog(null, 
-				"Unable to find a default printer.", 
-				"Warning", 
-				JOptionPane.WARNING_MESSAGE);
-		System.err.println("Unable to print: Unable to find default printer.");
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/XServiceManagerStub.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.services;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import java.lang.reflect.*;
-import java.security.*;
-import javax.jnlp.*;
-
-import net.sourceforge.jnlp.*;
-
-/**
- * Lookup table for services.
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.6 $ 
- */
-public class XServiceManagerStub implements ServiceManagerStub {
-
-    // todo: only include ExtensionInstallerService if an installer
-    // is getting the service, otherwise return null.
-
-    // todo: fix services to do their own privileged actions that
-    // run less code in the secure environment (or avoid privileged
-    // actions by giving permission to the code source).
-
-	private static String serviceNames[] = {
-        "javax.jnlp.BasicService", // required
-        "javax.jnlp.DownloadService", // required
-        "javax.jnlp.ExtensionInstallerService", // required
-        "javax.jnlp.PersistenceService",
-        "javax.jnlp.FileOpenService",
-        "javax.jnlp.FileSaveService",
-        "javax.jnlp.ClipboardService",
-        "javax.jnlp.PrintService"
-    };
-
-    private static Object services[] = {
-        ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()),
-        ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()),
-        ServiceUtil.createPrivilegedProxy(ExtensionInstallerService.class, new XExtensionInstallerService()),
-        ServiceUtil.createPrivilegedProxy(PersistenceService.class, new XPersistenceService()),
-        ServiceUtil.createPrivilegedProxy(FileOpenService.class, new XFileOpenService()),
-        ServiceUtil.createPrivilegedProxy(FileSaveService.class, new XFileSaveService()),
-        ServiceUtil.createPrivilegedProxy(ClipboardService.class, new XClipboardService()),
-        ServiceUtil.createPrivilegedProxy(PrintService.class, new XPrintService())
-    };
-
-
-    public XServiceManagerStub() {
-    }
-
-    /**
-     * Returns the service names.
-     */
-    public String[] getServiceNames() {
-        // make sure it is a copy because we might be returning to
-        // code we don't own.
-        String result[] = new String[serviceNames.length];
-        System.arraycopy(serviceNames, 0, result, 0, serviceNames.length);
-
-        return result;
-    }
-
-    /**
-     * Returns the service.
-     *
-     * @throws UnavailableServiceException if service is not available
-     */
-    public Object lookup(String name) throws UnavailableServiceException {
-        // exact match
-        for (int i=0; i < serviceNames.length; i++)
-            if (serviceNames[i].equals(name))
-                return services[i];
-
-        // substring match
-        for (int i=0; i < serviceNames.length; i++)
-            if (-1 != serviceNames[i].indexOf(name))
-                return services[i];
-
-        throw new UnavailableServiceException(""+name);
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/services/package.html	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-</head>
-<body bgcolor="white">
-
-This package contains the classes that implement the standard
-services defined by the JNLP specification.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/download-spec.html">JNLP specification</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-<li><a target="_top" href="http://jnlp.sourceforge.net/netx/">Netx JNLP Client</a>
-<li><a target="_top" href="http://java.sun.com/products/javawebstart/">Java Web Start JNLP Client</a>
-</ul>
-
-<!-- Put @see and @since tags down here. -->
-
-</body>
-</html>
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/CharacterEncoder.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
- * Copyright 1995-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.OutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-
-/**
- * This class defines the encoding half of character encoders.
- * A character encoder is an algorithim for transforming 8 bit binary
- * data into text (generally 7 bit ASCII or 8 bit ISO-Latin-1 text)
- * for transmition over text channels such as e-mail and network news.
- *
- * The character encoders have been structured around a central theme
- * that, in general, the encoded text has the form:
- *
- * <pre>
- *      [Buffer Prefix]
- *      [Line Prefix][encoded data atoms][Line Suffix]
- *      [Buffer Suffix]
- * </pre>
- *
- * In the CharacterEncoder and CharacterDecoder classes, one complete
- * chunk of data is referred to as a <i>buffer</i>. Encoded buffers
- * are all text, and decoded buffers (sometimes just referred to as
- * buffers) are binary octets.
- *
- * To create a custom encoder, you must, at a minimum,  overide three
- * abstract methods in this class.
- * <DL>
- * <DD>bytesPerAtom which tells the encoder how many bytes to
- * send to encodeAtom
- * <DD>encodeAtom which encodes the bytes sent to it as text.
- * <DD>bytesPerLine which tells the encoder the maximum number of
- * bytes per line.
- * </DL>
- *
- * Several useful encoders have already been written and are
- * referenced in the See Also list below.
- *
- * @author      Chuck McManis
- * @see         CharacterDecoder;
- * @see         UCEncoder
- * @see         UUEncoder
- * @see         BASE64Encoder
- */
-public abstract class CharacterEncoder {
-
-    /** Stream that understands "printing" */
-    protected PrintStream pStream;
-
-    /** Return the number of bytes per atom of encoding */
-    abstract protected int bytesPerAtom();
-
-    /** Return the number of bytes that can be encoded per line */
-    abstract protected int bytesPerLine();
-
-    /**
-     * Encode the prefix for the entire buffer. By default is simply
-     * opens the PrintStream for use by the other functions.
-     */
-    protected void encodeBufferPrefix(OutputStream aStream) throws IOException {
-        pStream = new PrintStream(aStream);
-    }
-
-    /**
-     * Encode the suffix for the entire buffer.
-     */
-    protected void encodeBufferSuffix(OutputStream aStream) throws IOException {
-    }
-
-    /**
-     * Encode the prefix that starts every output line.
-     */
-    protected void encodeLinePrefix(OutputStream aStream, int aLength)
-    throws IOException {
-    }
-
-    /**
-     * Encode the suffix that ends every output line. By default
-     * this method just prints a <newline> into the output stream.
-     */
-    protected void encodeLineSuffix(OutputStream aStream) throws IOException {
-        pStream.println();
-    }
-
-    /** Encode one "atom" of information into characters. */
-    abstract protected void encodeAtom(OutputStream aStream, byte someBytes[],
-                int anOffset, int aLength) throws IOException;
-
-    /**
-     * This method works around the bizarre semantics of BufferedInputStream's
-     * read method.
-     */
-    protected int readFully(InputStream in, byte buffer[])
-        throws java.io.IOException {
-        for (int i = 0; i < buffer.length; i++) {
-            int q = in.read();
-            if (q == -1)
-                return i;
-            buffer[i] = (byte)q;
-        }
-        return buffer.length;
-    }
-
-    /**
-     * Encode bytes from the input stream, and write them as text characters
-     * to the output stream. This method will run until it exhausts the
-     * input stream, but does not print the line suffix for a final
-     * line that is shorter than bytesPerLine().
-     */
-    public void encode(InputStream inStream, OutputStream outStream)
-        throws IOException {
-        int     j;
-        int     numBytes;
-        byte    tmpbuffer[] = new byte[bytesPerLine()];
-
-        encodeBufferPrefix(outStream);
-
-        while (true) {
-            numBytes = readFully(inStream, tmpbuffer);
-            if (numBytes == 0) {
-                break;
-            }
-            encodeLinePrefix(outStream, numBytes);
-            for (j = 0; j < numBytes; j += bytesPerAtom()) {
-
-                if ((j + bytesPerAtom()) <= numBytes) {
-                    encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
-                } else {
-                    encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
-                }
-            }
-            if (numBytes < bytesPerLine()) {
-                break;
-            } else {
-                encodeLineSuffix(outStream);
-            }
-        }
-        encodeBufferSuffix(outStream);
-    }
-
-    /**
-     * Encode the buffer in <i>aBuffer</i> and write the encoded
-     * result to the OutputStream <i>aStream</i>.
-     */
-    public void encode(byte aBuffer[], OutputStream aStream)
-    throws IOException {
-        ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
-        encode(inStream, aStream);
-    }
-
-    /**
-     * A 'streamless' version of encode that simply takes a buffer of
-     * bytes and returns a string containing the encoded buffer.
-     */
-    public String encode(byte aBuffer[]) {
-        ByteArrayOutputStream   outStream = new ByteArrayOutputStream();
-        ByteArrayInputStream    inStream = new ByteArrayInputStream(aBuffer);
-        String retVal = null;
-        try {
-            encode(inStream, outStream);
-            // explicit ascii->unicode conversion
-            retVal = outStream.toString("8859_1");
-        } catch (Exception IOException) {
-            // This should never happen.
-            throw new Error("CharacterEncoder.encode internal error");
-        }
-        return (retVal);
-    }
-
-    /**
-     * Return a byte array from the remaining bytes in this ByteBuffer.
-     * <P>
-     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
-     * <P>
-     * To avoid an extra copy, the implementation will attempt to return the
-     * byte array backing the ByteBuffer.  If this is not possible, a
-     * new byte array will be created.
-     */
-    private byte [] getBytes(ByteBuffer bb) {
-        /*
-         * This should never return a BufferOverflowException, as we're
-         * careful to allocate just the right amount.
-         */
-        byte [] buf = null;
-
-        /*
-         * If it has a usable backing byte buffer, use it.  Use only
-         * if the array exactly represents the current ByteBuffer.
-         */
-        if (bb.hasArray()) {
-            byte [] tmp = bb.array();
-            if ((tmp.length == bb.capacity()) &&
-                    (tmp.length == bb.remaining())) {
-                buf = tmp;
-                bb.position(bb.limit());
-            }
-        }
-
-        if (buf == null) {
-            /*
-             * This class doesn't have a concept of encode(buf, len, off),
-             * so if we have a partial buffer, we must reallocate
-             * space.
-             */
-            buf = new byte[bb.remaining()];
-
-            /*
-             * position() automatically updated
-             */
-            bb.get(buf);
-        }
-
-        return buf;
-    }
-
-    /**
-     * Encode the <i>aBuffer</i> ByteBuffer and write the encoded
-     * result to the OutputStream <i>aStream</i>.
-     * <P>
-     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
-     */
-    public void encode(ByteBuffer aBuffer, OutputStream aStream)
-        throws IOException {
-        byte [] buf = getBytes(aBuffer);
-        encode(buf, aStream);
-    }
-
-    /**
-     * A 'streamless' version of encode that simply takes a ByteBuffer
-     * and returns a string containing the encoded buffer.
-     * <P>
-     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
-     */
-    public String encode(ByteBuffer aBuffer) {
-        byte [] buf = getBytes(aBuffer);
-        return encode(buf);
-    }
-
-    /**
-     * Encode bytes from the input stream, and write them as text characters
-     * to the output stream. This method will run until it exhausts the
-     * input stream. It differs from encode in that it will add the
-     * line at the end of a final line that is shorter than bytesPerLine().
-     */
-    public void encodeBuffer(InputStream inStream, OutputStream outStream)
-        throws IOException {
-        int     j;
-        int     numBytes;
-        byte    tmpbuffer[] = new byte[bytesPerLine()];
-
-        encodeBufferPrefix(outStream);
-
-        while (true) {
-            numBytes = readFully(inStream, tmpbuffer);
-            if (numBytes == 0) {
-                break;
-            }
-            encodeLinePrefix(outStream, numBytes);
-            for (j = 0; j < numBytes; j += bytesPerAtom()) {
-                if ((j + bytesPerAtom()) <= numBytes) {
-                    encodeAtom(outStream, tmpbuffer, j, bytesPerAtom());
-                } else {
-                    encodeAtom(outStream, tmpbuffer, j, (numBytes)- j);
-                }
-            }
-            encodeLineSuffix(outStream);
-            if (numBytes < bytesPerLine()) {
-                break;
-            }
-        }
-        encodeBufferSuffix(outStream);
-    }
-
-    /**
-     * Encode the buffer in <i>aBuffer</i> and write the encoded
-     * result to the OutputStream <i>aStream</i>.
-     */
-    public void encodeBuffer(byte aBuffer[], OutputStream aStream)
-    throws IOException {
-        ByteArrayInputStream inStream = new ByteArrayInputStream(aBuffer);
-        encodeBuffer(inStream, aStream);
-    }
-
-    /**
-     * A 'streamless' version of encode that simply takes a buffer of
-     * bytes and returns a string containing the encoded buffer.
-     */
-    public String encodeBuffer(byte aBuffer[]) {
-        ByteArrayOutputStream   outStream = new ByteArrayOutputStream();
-        ByteArrayInputStream    inStream = new ByteArrayInputStream(aBuffer);
-        try {
-            encodeBuffer(inStream, outStream);
-        } catch (Exception IOException) {
-            // This should never happen.
-            throw new Error("CharacterEncoder.encodeBuffer internal error");
-        }
-        return (outStream.toString());
-    }
-
-    /**
-     * Encode the <i>aBuffer</i> ByteBuffer and write the encoded
-     * result to the OutputStream <i>aStream</i>.
-     * <P>
-     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
-     */
-    public void encodeBuffer(ByteBuffer aBuffer, OutputStream aStream)
-        throws IOException {
-        byte [] buf = getBytes(aBuffer);
-        encodeBuffer(buf, aStream);
-    }
-
-    /**
-     * A 'streamless' version of encode that simply takes a ByteBuffer
-     * and returns a string containing the encoded buffer.
-     * <P>
-     * The ByteBuffer's position will be advanced to ByteBuffer's limit.
-     */
-    public String encodeBuffer(ByteBuffer aBuffer) {
-        byte [] buf = getBytes(aBuffer);
-        return encodeBuffer(buf);
-    }
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/HexDumpEncoder.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright 1995-1997 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-import java.io.PrintStream;
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * This class encodes a buffer into the classic: "Hexadecimal Dump" format of
- * the past. It is useful for analyzing the contents of binary buffers.
- * The format produced is as follows:
- * <pre>
- * xxxx: 00 11 22 33 44 55 66 77   88 99 aa bb cc dd ee ff ................
- * </pre>
- * Where xxxx is the offset into the buffer in 16 byte chunks, followed
- * by ascii coded hexadecimal bytes followed by the ASCII representation of
- * the bytes or '.' if they are not valid bytes.
- *
- * @author      Chuck McManis
- */
-
-public class HexDumpEncoder extends CharacterEncoder {
-
-    private int offset;
-    private int thisLineLength;
-    private int currentByte;
-    private byte thisLine[] = new byte[16];
-
-    static void hexDigit(PrintStream p, byte x) {
-        char c;
-
-        c = (char) ((x >> 4) & 0xf);
-        if (c > 9)
-            c = (char) ((c-10) + 'A');
-        else
-            c = (char)(c + '0');
-        p.write(c);
-        c = (char) (x & 0xf);
-        if (c > 9)
-            c = (char)((c-10) + 'A');
-        else
-            c = (char)(c + '0');
-        p.write(c);
-    }
-
-    protected int bytesPerAtom() {
-        return (1);
-    }
-
-    protected int bytesPerLine() {
-        return (16);
-    }
-
-    protected void encodeBufferPrefix(OutputStream o) throws IOException {
-        offset = 0;
-        super.encodeBufferPrefix(o);
-    }
-
-    protected void encodeLinePrefix(OutputStream o, int len) throws IOException {
-        hexDigit(pStream, (byte)((offset >>> 8) & 0xff));
-        hexDigit(pStream, (byte)(offset & 0xff));
-        pStream.print(": ");
-        currentByte = 0;
-        thisLineLength = len;
-    }
-
-    protected void encodeAtom(OutputStream o, byte buf[], int off, int len) throws IOException {
-        thisLine[currentByte] = buf[off];
-        hexDigit(pStream, buf[off]);
-        pStream.print(" ");
-        currentByte++;
-        if (currentByte == 8)
-            pStream.print("  ");
-    }
-
-    protected void encodeLineSuffix(OutputStream o) throws IOException {
-        if (thisLineLength < 16) {
-            for (int i = thisLineLength; i < 16; i++) {
-                pStream.print("   ");
-                if (i == 7)
-                    pStream.print("  ");
-            }
-        }
-        pStream.print(" ");
-        for (int i = 0; i < thisLineLength; i++) {
-            if ((thisLine[i] < ' ') || (thisLine[i] > 'z')) {
-                pStream.print(".");
-            } else {
-                pStream.write(thisLine[i]);
-            }
-        }
-        pStream.println();
-        offset += thisLineLength;
-    }
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarRunner.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-package net.sourceforge.jnlp.tools;
-
-import net.sourceforge.jnlp.tools.JarSigner;
-public class JarRunner {
-
-
-	public static void main(String[] args) throws Exception{
-		
-
-		//JarSigner.main(args);
-		JarSigner js = new JarSigner();
-		js.verifyJar(args[0]);
-	}
-
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSigner.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,544 +0,0 @@
-/*
- * Copyright 1997-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-import java.util.jar.*;
-import java.text.Collator;
-import java.text.MessageFormat;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.security.cert.CertPath;
-import java.security.*;
-import sun.security.x509.*;
-import sun.security.util.*;
-
-import net.sourceforge.jnlp.*;
-import net.sourceforge.jnlp.cache.*;
-import net.sourceforge.jnlp.runtime.*;
-import net.sourceforge.jnlp.security.*;
-
-/**
- * <p>The jarsigner utility.
- *
- * @author Roland Schemers
- * @author Jan Luehe
- */
-
-public class JarSigner implements CertVerifier {
-
-    private static String R(String key) {
-        return JNLPRuntime.getMessage(key);
-    }
-
-    private static final Collator collator = Collator.getInstance();
-    static {
-        // this is for case insensitive string comparisions
-        collator.setStrength(Collator.PRIMARY);
-    }
-
-    private static final String META_INF = "META-INF/";
-
-    // prefix for new signature-related files in META-INF directory
-    private static final String SIG_PREFIX = META_INF + "SIG-";
-
-
-    private static final long SIX_MONTHS = 180*24*60*60*1000L; //milliseconds
-
-    static final String VERSION = "1.0";
-
-    static final int IN_KEYSTORE = 0x01;
-    static final int IN_SCOPE = 0x02;
-
-    // signer's certificate chain (when composing)
-    X509Certificate[] certChain;
-
-    /*
-     * private key
-     */
-    PrivateKey privateKey;
-    KeyStore store;
-
-    IdentityScope scope;
-
-    String keystore; // key store file
-    boolean nullStream = false; // null keystore input stream (NONE)
-    boolean token = false; // token-based keystore
-    String jarfile;  // jar file to sign
-    String alias;    // alias to sign jar with
-    char[] storepass; // keystore password
-    boolean protectedPath; // protected authentication path
-    String storetype; // keystore type
-    String providerName; // provider name
-    Vector<String> providers = null; // list of providers
-    HashMap<String,String> providerArgs = new HashMap<String, String>(); // arguments for provider constructors
-    char[] keypass; // private key password
-    String sigfile; // name of .SF file
-    String sigalg; // name of signature algorithm
-    String digestalg = "SHA1"; // name of digest algorithm
-    String signedjar; // output filename
-    String tsaUrl; // location of the Timestamping Authority
-    String tsaAlias; // alias for the Timestamping Authority's certificate
-    boolean verify = false; // verify the jar
-    boolean verbose = false; // verbose output when signing/verifying
-    boolean showcerts = false; // show certs when verifying
-    boolean debug = false; // debug
-    boolean signManifest = true; // "sign" the whole manifest
-    boolean externalSF = true; // leave the .SF out of the PKCS7 block
-
-    private boolean hasExpiredCert = false;
-    private boolean hasExpiringCert = false;
-    private boolean notYetValidCert = false;
-
-    private boolean badKeyUsage = false;
-    private boolean badExtendedKeyUsage = false;
-    private boolean badNetscapeCertType = false;
-
-    private boolean alreadyTrustPublisher = false;
-    private boolean rootInCacerts = false;
-    
-    /**
-     * The single certPath used in this JarSiging. We're only keeping
-     * track of one here, since in practice there's only one signer
-     * for a JNLP Application.
-     */
-    private CertPath certPath = null;
-    
-    private boolean noSigningIssues = true;
-
-    private boolean anyJarsSigned = false;
-
-    /** all of the jar files that were verified */
-    private ArrayList<String> verifiedJars = null;
-
-    /** all of the jar files that were not verified */
-    private ArrayList<String> unverifiedJars = null;
-
-    /** the certificates used for jar verification */
-    private ArrayList<CertPath> certs = null;
-
-    /** details of this signing */
-    private ArrayList<String> details = new ArrayList<String>();
-
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getAlreadyTrustPublisher()
-     */
-    public boolean getAlreadyTrustPublisher() {
-    	return alreadyTrustPublisher;
-    }
-    
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getRootInCacerts()
-     */
-    public boolean getRootInCacerts() {
-    	return rootInCacerts;
-    }
-    
-    public CertPath getCertPath() {
-    	return certPath;
-    }
-    
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#hasSigningIssues()
-     */
-    public boolean hasSigningIssues() {
-        return hasExpiredCert || notYetValidCert || badKeyUsage
-               || badExtendedKeyUsage || badNetscapeCertType;
-    }
-
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#noSigningIssues()
-     */
-    public boolean noSigningIssues() {
-        return noSigningIssues;
-    }
-
-    public boolean anyJarsSigned() {
-        return anyJarsSigned;
-    }
-
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getDetails()
-     */
-    public ArrayList<String> getDetails() {
-        return details;
-    }
-
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getCerts()
-     */
-    public ArrayList<CertPath> getCerts() {
-        return certs;
-    }
-
-    public void verifyJars(List<JARDesc> jars, ResourceTracker tracker)
-    throws Exception {
-
-	certs = new ArrayList<CertPath>();
-        for (int i = 0; i < jars.size(); i++) {
-
-            JARDesc jar = (JARDesc) jars.get(i);
-            verifiedJars = new ArrayList<String>();
-            unverifiedJars = new ArrayList<String>();
-
-            try {
-                
-                File jarFile = tracker.getCacheFile(jar.getLocation());
-                
-                // some sort of resource download/cache error. Nothing to add 
-                // in that case ... but don't fail here
-                if (jarFile == null) {
-                    return;
-                }
-
-                String localFile = jarFile.getAbsolutePath();
-                boolean result = verifyJar(localFile);
-
-                if (!result) {
-                    //allVerified is true until we encounter a problem
-                    //with one or more jars
-                    noSigningIssues = false;
-                    unverifiedJars.add(localFile);
-                } else {
-                    verifiedJars.add(localFile);
-                }
-            } catch (Exception e){
-                // We may catch exceptions from using verifyJar()
-            	// or from checkTrustedCerts	
-                throw e;
-            }
-        }
-    }
-
-    public boolean verifyJar(String jarName) throws Exception {
-        boolean anySigned = false;
-        boolean hasUnsignedEntry = false;
-        JarInputStream jis = null;
-
-        // certs could be uninitialized if one calls this method directly
-        if (certs == null)
-            certs = new ArrayList<CertPath>();
-        
-        try {
-            jis = new JarInputStream(new FileInputStream(jarName), true);
-            Vector<JarEntry> entriesVec = new Vector<JarEntry>();
-            byte[] buffer = new byte[8192];
-
-            JarEntry je;
-            while ((je = jis.getNextJarEntry()) != null) {
-                entriesVec.addElement(je);
-                InputStream is = null;
-                try {
-                    int n;
-                    while ((n = jis.read(buffer, 0, buffer.length)) != -1) {
-                        // we just read. this will throw a SecurityException
-                        // if  a signature/digest check fails.
-                    }
-                } finally {
-                    if (is != null) {
-                        is.close();
-                    }
-                }
-            }
-
-            Manifest man = jis.getManifest();
-
-            if (man != null) {
-                if (verbose) System.out.println();
-                Enumeration<JarEntry> e = entriesVec.elements();
-
-                long now = System.currentTimeMillis();
-
-                while (e.hasMoreElements()) {
-                    je = e.nextElement();
-                    String name = je.getName();
-                    CodeSigner[] signers = je.getCodeSigners();
-                    boolean isSigned = (signers != null);
-                    anySigned |= isSigned;
-                    hasUnsignedEntry |= !je.isDirectory() && !isSigned
-                                        && !signatureRelated(name);
-                    if (isSigned) {
-                    	// TODO: Perhaps we should check here that
-                    	// signers.length is only of size 1, and throw an
-                    	// exception if it's not?
-                        for (int i = 0; i < signers.length; i++) {
-                            CertPath certPath = signers[i].getSignerCertPath();
-                            if (!certs.contains(certPath))
-                                certs.add(certPath);
-                            
-                            //we really only want the first certPath
-                            if (!certPath.equals(this.certPath)){
-                            	this.certPath = certPath;
-                            }
-                            
-                            Certificate cert = signers[i].getSignerCertPath()
-                                .getCertificates().get(0);
-                            if (cert instanceof X509Certificate) {
-                                checkCertUsage((X509Certificate)cert, null);
-                                if (!showcerts) {
-                                    long notAfter = ((X509Certificate)cert)
-                                                    .getNotAfter().getTime();
-
-                                    if (notAfter < now) {
-                                        hasExpiredCert = true;
-                                    } else if (notAfter < now + SIX_MONTHS) {
-                                        hasExpiringCert = true;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                } //while e has more elements
-            } //if man not null
-
-            //Alert the user if any of the following are true.
-            if (!anySigned) {
-
-            } else {
-                anyJarsSigned = true;
-
-                //warnings
-                if (hasUnsignedEntry || hasExpiredCert || hasExpiringCert ||
-                        badKeyUsage || badExtendedKeyUsage || badNetscapeCertType ||
-                        notYetValidCert) {
-
-                    addToDetails(R("SRunWithoutRestrictions"));
-
-                    if (badKeyUsage)
-                        addToDetails(R("SBadKeyUsage"));
-                    if (badExtendedKeyUsage)
-                        addToDetails(R("SBadExtendedKeyUsage"));
-                    if (badNetscapeCertType)
-                        addToDetails(R("SBadNetscapeCertType"));
-                    if (hasUnsignedEntry)
-                        addToDetails(R("SHasUnsignedEntry"));
-                    if (hasExpiredCert)
-                        addToDetails(R("SHasExpiredCert"));
-                    if (hasExpiringCert)
-                        addToDetails(R("SHasExpiringCert"));
-                    if (notYetValidCert)
-                        addToDetails(R("SNotYetValidCert"));
-                }
-            }
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw e;
-        } finally { // close the resource
-            if (jis != null) {
-                jis.close();
-            }
-        }
-
-        // check if the certs added above are in the trusted path
-        checkTrustedCerts();
-        
-        //anySigned does not guarantee that all files were signed.
-        return anySigned && !(hasUnsignedEntry || hasExpiredCert
-                              || badKeyUsage || badExtendedKeyUsage || badNetscapeCertType
-                              || notYetValidCert);
-    }
-
-    /**
-     * Checks the user's trusted.certs file and the cacerts file to see
-     * if a publisher's and/or CA's certificate exists there.
-     */
-    private void checkTrustedCerts() throws Exception {
-    	if (certPath != null) {
-    		try {
-    			KeyTool kt = new KeyTool();
-    			alreadyTrustPublisher = kt.isTrusted(getPublisher());
-   				rootInCacerts = kt.checkCacertsForCertificate(getRoot());
-    		} catch (Exception e) {
-    			// TODO: Warn user about not being able to
-    			// look through their cacerts/trusted.certs
-    			// file depending on exception.
-    			throw e;
-    		}
-    		
-    		if (!rootInCacerts)
-    			addToDetails(R("SUntrustedCertificate"));
-    		else 
-    			addToDetails(R("STrustedCertificate"));
-    	}
-    }
-    
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getPublisher()
-     */
-    public Certificate getPublisher() {
-    	if (certPath != null) {
-    		List<? extends Certificate> certList 
-			= certPath.getCertificates();
-    		if (certList.size() > 0) {
-    			return (Certificate)certList.get(0);
-    		} else {
-    			return null;
-    		}
-    	} else {
-    		return null;
-    	}
-    }
-    
-    /* (non-Javadoc)
-     * @see net.sourceforge.jnlp.tools.CertVerifier2#getRoot()
-     */
-    public Certificate getRoot() {
-    	if (certPath != null) {
-    		List<? extends Certificate> certList 
-			= certPath.getCertificates();
-    		if (certList.size() > 0) {
-    			return (Certificate)certList.get(
-    				certList.size() - 1);
-    		} else {
-    			return null;
-    		}
-    	} else {
-    		return null;
-    	}
-    }
-    
-	private void addToDetails(String detail) {
-		if (!details.contains(detail))
-			details.add(detail);
-	}
-
-    Hashtable<Certificate, String> storeHash =
-        new Hashtable<Certificate, String>();
-
-    /**
-     * signature-related files include:
-     * . META-INF/MANIFEST.MF
-     * . META-INF/SIG-*
-     * . META-INF/*.SF
-     * . META-INF/*.DSA
-     * . META-INF/*.RSA
-     *
-     * Required for verifyJar()
-     */
-    private boolean signatureRelated(String name) {
-        String ucName = name.toUpperCase();
-        if (ucName.equals(JarFile.MANIFEST_NAME) ||
-                ucName.equals(META_INF) ||
-                (ucName.startsWith(SIG_PREFIX) &&
-                 ucName.indexOf("/") == ucName.lastIndexOf("/"))) {
-            return true;
-        }
-
-        if (ucName.startsWith(META_INF) &&
-                SignatureFileVerifier.isBlockOrSF(ucName)) {
-            // .SF/.DSA/.RSA files in META-INF subdirs
-            // are not considered signature-related
-            return (ucName.indexOf("/") == ucName.lastIndexOf("/"));
-        }
-
-        return false;
-    }
-
-    /**
-     * Check if userCert is designed to be a code signer
-     * @param userCert the certificate to be examined
-     * @param bad 3 booleans to show if the KeyUsage, ExtendedKeyUsage,
-     *            NetscapeCertType has codeSigning flag turned on.
-     *            If null, the class field badKeyUsage, badExtendedKeyUsage,
-     *            badNetscapeCertType will be set.
-     *
-     * Required for verifyJar()
-     */
-    void checkCertUsage(X509Certificate userCert, boolean[] bad) {
-
-        // Can act as a signer?
-        // 1. if KeyUsage, then [0] should be true
-        // 2. if ExtendedKeyUsage, then should contains ANY or CODE_SIGNING
-        // 3. if NetscapeCertType, then should contains OBJECT_SIGNING
-        // 1,2,3 must be true
-
-        if (bad != null) {
-            bad[0] = bad[1] = bad[2] = false;
-        }
-
-        boolean[] keyUsage = userCert.getKeyUsage();
-        if (keyUsage != null) {
-            if (keyUsage.length < 1 || !keyUsage[0]) {
-                if (bad != null) {
-                    bad[0] = true;
-                } else {
-                    badKeyUsage = true;
-                }
-            }
-        }
-
-        try {
-            List<String> xKeyUsage = userCert.getExtendedKeyUsage();
-            if (xKeyUsage != null) {
-                if (!xKeyUsage.contains("2.5.29.37.0") // anyExtendedKeyUsage
-                        && !xKeyUsage.contains("1.3.6.1.5.5.7.3.3")) {  // codeSigning
-                    if (bad != null) {
-                        bad[1] = true;
-                    } else {
-                        badExtendedKeyUsage = true;
-                    }
-                }
-            }
-        } catch (java.security.cert.CertificateParsingException e) {
-            // shouldn't happen
-        }
-
-        try {
-            // OID_NETSCAPE_CERT_TYPE
-            byte[] netscapeEx = userCert.getExtensionValue
-                                ("2.16.840.1.113730.1.1");
-            if (netscapeEx != null) {
-                DerInputStream in = new DerInputStream(netscapeEx);
-                byte[] encoded = in.getOctetString();
-                encoded = new DerValue(encoded).getUnalignedBitString()
-                .toByteArray();
-
-                NetscapeCertTypeExtension extn =
-                    new NetscapeCertTypeExtension(encoded);
-
-                Boolean val = (Boolean)extn.get(
-                                  NetscapeCertTypeExtension.OBJECT_SIGNING);
-                if (!val) {
-                    if (bad != null) {
-                        bad[2] = true;
-                    } else {
-                        badNetscapeCertType = true;
-                    }
-                }
-            }
-        } catch (IOException e) {
-            //
-        }
-    }
-
-}
-
-
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/JarSignerResources.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-/**
- * <p> This class represents the <code>ResourceBundle</code>
- * for JarSigner.
- *
- */
-public class JarSignerResources extends java.util.ListResourceBundle {
-
-    private static final Object[][] contents = {
-
-        // shared (from jarsigner)
-        {" ", " "},
-        {"  ", "  "},
-        {"      ", "      "},
-        {", ", ", "},
-
-        {"provName not a provider", "{0} not a provider"},
-        {"signerClass is not a signing mechanism", "{0} is not a signing mechanism"},
-        {"jarsigner error: ", "jarsigner error: "},
-        {"Illegal option: ", "Illegal option: "},
-        {"-keystore must be NONE if -storetype is {0}",
-                "-keystore must be NONE if -storetype is {0}"},
-        {"-keypass can not be specified if -storetype is {0}",
-                "-keypass can not be specified if -storetype is {0}"},
-        {"If -protected is specified, then -storepass and -keypass must not be specified",
-                "If -protected is specified, then -storepass and -keypass must not be specified"},
-        {"If keystore is not password protected, then -storepass and -keypass must not be specified",
-                 "If keystore is not password protected, then -storepass and -keypass must not be specified"},
-        {"Usage: jarsigner [options] jar-file alias",
-                "Usage: jarsigner [options] jar-file alias"},
-        {"       jarsigner -verify [options] jar-file",
-                "       jarsigner -verify [options] jar-file"},
-        {"[-keystore <url>]           keystore location",
-                "[-keystore <url>]           keystore location"},
-        {"[-storepass <password>]     password for keystore integrity",
-            "[-storepass <password>]     password for keystore integrity"},
-        {"[-storetype <type>]         keystore type",
-                "[-storetype <type>]         keystore type"},
-        {"[-keypass <password>]       password for private key (if different)",
-                "[-keypass <password>]       password for private key (if different)"},
-        {"[-sigfile <file>]           name of .SF/.DSA file",
-                "[-sigfile <file>]           name of .SF/.DSA file"},
-        {"[-signedjar <file>]         name of signed JAR file",
-                "[-signedjar <file>]         name of signed JAR file"},
-        {"[-digestalg <algorithm>]    name of digest algorithm",
-                "[-digestalg <algorithm>]    name of digest algorithm"},
-        {"[-sigalg <algorithm>]       name of signature algorithm",
-                "[-sigalg <algorithm>]       name of signature algorithm"},
-        {"[-verify]                   verify a signed JAR file",
-                "[-verify]                   verify a signed JAR file"},
-        {"[-verbose]                  verbose output when signing/verifying",
-                "[-verbose]                  verbose output when signing/verifying"},
-        {"[-certs]                    display certificates when verbose and verifying",
-                "[-certs]                    display certificates when verbose and verifying"},
-        {"[-tsa <url>]                location of the Timestamping Authority",
-                "[-tsa <url>]                location of the Timestamping Authority"},
-        {"[-tsacert <alias>]          public key certificate for Timestamping Authority",
-                "[-tsacert <alias>]          public key certificate for Timestamping Authority"},
-        {"[-altsigner <class>]        class name of an alternative signing mechanism",
-                "[-altsigner <class>]        class name of an alternative signing mechanism"},
-        {"[-altsignerpath <pathlist>] location of an alternative signing mechanism",
-                "[-altsignerpath <pathlist>] location of an alternative signing mechanism"},
-        {"[-internalsf]               include the .SF file inside the signature block",
-                "[-internalsf]               include the .SF file inside the signature block"},
-        {"[-sectionsonly]             don't compute hash of entire manifest",
-                "[-sectionsonly]             don't compute hash of entire manifest"},
-        {"[-protected]                keystore has protected authentication path",
-                "[-protected]                keystore has protected authentication path"},
-        {"[-providerName <name>]      provider name",
-                "[-providerName <name>]      provider name"},
-        {"[-providerClass <class>     name of cryptographic service provider's",
-                "[-providerClass <class>     name of cryptographic service provider's"},
-        {"  [-providerArg <arg>]] ... master class file and constructor argument",
-                "  [-providerArg <arg>]] ... master class file and constructor argument"},
-        {"s", "s"},
-        {"m", "m"},
-        {"k", "k"},
-        {"i", "i"},
-        {"  s = signature was verified ",
-                "  s = signature was verified "},
-        {"  m = entry is listed in manifest",
-                "  m = entry is listed in manifest"},
-        {"  k = at least one certificate was found in keystore",
-                "  k = at least one certificate was found in keystore"},
-        {"  i = at least one certificate was found in identity scope",
-                "  i = at least one certificate was found in identity scope"},
-        {"no manifest.", "no manifest."},
-        {"jar is unsigned. (signatures missing or not parsable)",
-                "jar is unsigned. (signatures missing or not parsable)"},
-        {"jar verified.", "jar verified."},
-        {"jarsigner: ", "jarsigner: "},
-        {"signature filename must consist of the following characters: A-Z, 0-9, _ or -",
-                "signature filename must consist of the following characters: A-Z, 0-9, _ or -"},
-        {"unable to open jar file: ", "unable to open jar file: "},
-        {"unable to create: ", "unable to create: "},
-        {"   adding: ", "   adding: "},
-        {" updating: ", " updating: "},
-        {"  signing: ", "  signing: "},
-        {"attempt to rename signedJarFile to jarFile failed",
-                "attempt to rename {0} to {1} failed"},
-        {"attempt to rename jarFile to origJar failed",
-                "attempt to rename {0} to {1} failed"},
-        {"unable to sign jar: ", "unable to sign jar: "},
-        {"Enter Passphrase for keystore: ", "Enter Passphrase for keystore: "},
-        {"keystore load: ", "keystore load: "},
-        {"certificate exception: ", "certificate exception: "},
-        {"unable to instantiate keystore class: ",
-                "unable to instantiate keystore class: "},
-        {"Certificate chain not found for: alias.  alias must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.",
-                "Certificate chain not found for: {0}.  {1} must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."},
-        {"found non-X.509 certificate in signer's chain",
-                "found non-X.509 certificate in signer's chain"},
-        {"incomplete certificate chain", "incomplete certificate chain"},
-        {"Enter key password for alias: ", "Enter key password for {0}: "},
-        {"unable to recover key from keystore",
-                "unable to recover key from keystore"},
-        {"key associated with alias not a private key",
-                "key associated with {0} not a private key"},
-        {"you must enter key password", "you must enter key password"},
-        {"unable to read password: ", "unable to read password: "},
-        {"certificate is valid from", "certificate is valid from {0} to {1}"},
-        {"certificate expired on", "certificate expired on {0}"},
-        {"certificate is not valid until",
-                "certificate is not valid until {0}"},
-        {"certificate will expire on", "certificate will expire on {0}"},
-        {"requesting a signature timestamp",
-                "requesting a signature timestamp"},
-        {"TSA location: ", "TSA location: "},
-        {"TSA certificate: ", "TSA certificate: "},
-        {"no response from the Timestamping Authority. ",
-                "no response from the Timestamping Authority. "},
-        {"When connecting from behind a firewall then an HTTP proxy may need to be specified. ",
-                "When connecting from behind a firewall then an HTTP proxy may need to be specified. "},
-        {"Supply the following options to jarsigner: ",
-                "Supply the following options to jarsigner: "},
-        {"Certificate not found for: alias.  alias must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority.",
-                "Certificate not found for: {0}.  {1} must reference a valid KeyStore entry containing an X.509 public key certificate for the Timestamping Authority."},
-        {"using an alternative signing mechanism",
-                "using an alternative signing mechanism"},
-        {"entry was signed on", "entry was signed on {0}"},
-        {"Warning: ", "Warning: "},
-        {"This jar contains unsigned entries which have not been integrity-checked. ",
-                "This jar contains unsigned entries which have not been integrity-checked. "},
-        {"This jar contains entries whose signer certificate has expired. ",
-                "This jar contains entries whose signer certificate has expired. "},
-        {"This jar contains entries whose signer certificate will expire within six months. ",
-                "This jar contains entries whose signer certificate will expire within six months. "},
-        {"This jar contains entries whose signer certificate is not yet valid. ",
-                "This jar contains entries whose signer certificate is not yet valid. "},
-        {"Re-run with the -verbose option for more details.",
-                "Re-run with the -verbose option for more details."},
-        {"Re-run with the -verbose and -certs options for more details.",
-                "Re-run with the -verbose and -certs options for more details."},
-        {"The signer certificate has expired.",
-                "The signer certificate has expired."},
-        {"The signer certificate will expire within six months.",
-                "The signer certificate will expire within six months."},
-        {"The signer certificate is not yet valid.",
-                "The signer certificate is not yet valid."},
-        {"The signer certificate's KeyUsage extension doesn't allow code signing.",
-                 "The signer certificate's KeyUsage extension doesn't allow code signing."},
-        {"The signer certificate's ExtendedKeyUsage extension doesn't allow code signing.",
-                 "The signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
-        {"The signer certificate's NetscapeCertType extension doesn't allow code signing.",
-                 "The signer certificate's NetscapeCertType extension doesn't allow code signing."},
-         {"This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing.",
-                  "This jar contains entries whose signer certificate's KeyUsage extension doesn't allow code signing."},
-         {"This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing.",
-                  "This jar contains entries whose signer certificate's ExtendedKeyUsage extension doesn't allow code signing."},
-         {"This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing.",
-                  "This jar contains entries whose signer certificate's NetscapeCertType extension doesn't allow code signing."},
-        {"[{0} extension does not support code signing]",
-                 "[{0} extension does not support code signing]"},
-    };
-
-    /**
-     * Returns the contents of this <code>ResourceBundle</code>.
-     *
-     * <p>
-     *
-     * @return the contents of this <code>ResourceBundle</code>.
-     */
-    public Object[][] getContents() {
-        return contents;
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyStoreUtil.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-/**
- * <p> This class provides several utilities to <code>KeyStore</code>.
- *
- * @since 1.6.0
- */
-public class KeyStoreUtil {
-
-    // Class and methods marked as public so that they can be
-    // accessed by JarSigner, which although lies in a package
-    // with the same name, but bundled in tools.jar and loaded
-    // by another class loader, hence in a different *runtime*
-    // package.
-    //
-    // See JVM Spec, 5.3 and 5.4.4
-
-    private KeyStoreUtil() {
-        // this class is not meant to be instantiated
-    }
-
-
-    /**
-     * Returns true if KeyStore has a password. This is true except for
-     * MSCAPI KeyStores
-     */
-    public static boolean isWindowsKeyStore(String storetype) {
-        return storetype.equalsIgnoreCase("Windows-MY")
-                || storetype.equalsIgnoreCase("Windows-ROOT");
-    }
-
-    /**
-     * Returns standard-looking names for storetype
-     */
-    public static String niceStoreTypeName(String storetype) {
-        if (storetype.equalsIgnoreCase("Windows-MY")) {
-            return "Windows-MY";
-        } else if(storetype.equalsIgnoreCase("Windows-ROOT")) {
-            return "Windows-ROOT";
-        } else {
-            return storetype.toUpperCase();
-        }
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/tools/KeyTool.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,478 +0,0 @@
-/*
- * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package net.sourceforge.jnlp.tools;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.security.KeyStore;
-import java.security.MessageDigest;
-import java.security.PublicKey;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Random;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import net.sourceforge.jnlp.security.SecurityUtil;
-
-import sun.misc.BASE64Encoder;
-import sun.security.provider.X509Factory;
-
-/**
- * This tool manages the user's trusted certificates
- *
- * @author Jan Luehe
- * @author Joshua Sumali
- */
-public class KeyTool {
-
-	// The user's keystore.
-	private KeyStore usercerts = null;
-	// JDK cacerts
-	private KeyStore cacerts = null;
-	// System ca-bundle.crt
-	private KeyStore systemcerts = null;
-	
-	private String fullCertPath = SecurityUtil.getTrustedCertsFilename();
-
-	private FileOutputStream fos = null;
-
-	/**
-	 * Whether we trust the system cacerts file.
-	 */
-	private boolean trustcacerts = true;
-	
-	/**
-	 * Whether we print certificates in rfc, base64 encoding.
-	 */
-	private boolean rfc = true;
-	
-	private final char[] password = "changeit".toCharArray();
-
-	/**
-	 * Whether we prompt for user input.
-	 */
-	private boolean noprompt = true;
-	
-	public KeyTool() throws Exception {
-
-		// Initialize all the keystores.
-		usercerts = SecurityUtil.getUserKeyStore();
-		cacerts = SecurityUtil.getCacertsKeyStore(); 
-		systemcerts = SecurityUtil.getSystemCertStore();
-	}
-
-	/**
-	 * Adds a trusted certificate to the user's keystore.
-	 * @return true if the add was successful, false otherwise.
-	 */
-	public boolean importCert(File file) throws Exception {
-	
-		BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
-		CertificateFactory cf = CertificateFactory.getInstance("X509");
-		X509Certificate cert = null;
-		
-		if (bis.available() >= 1) {
-			try {
-			cert = (X509Certificate)cf.generateCertificate(bis);
-			} catch (ClassCastException cce) {
-				throw new Exception("Input file is not an X509 Certificate");
-			} catch (CertificateException ce) {
-				throw new Exception("Input file is not an X509 Certificate");
-			}
-		}
-	
-		return importCert((Certificate)cert);
-	}
-	
-	/**
-	 * Adds a trusted certificate to the user's keystore.
-	 * @return true if the add was successful, false otherwise.
-	 */
-	public boolean importCert(Certificate cert) throws Exception {
-
-		String alias = usercerts.getCertificateAlias(cert);
-
-		if (alias != null) { //cert already exists
-			return true;
-		} else {
-			String newAlias = getRandomAlias();
-			//check to make sure this alias doesn't exist
-			while (usercerts.getCertificate(newAlias) != null)
-				newAlias = getRandomAlias();
-			return addTrustedCert(newAlias, cert);
-		}
-	}
-
-	/**
-	 * Generates a random alias for storing a trusted Certificate.
-	 */
-	private String getRandomAlias() {
-		Random r = new Random();
-		String token = Long.toString(Math.abs(r.nextLong()), 36);
-		return "trustedCert-" + token;
-	}
-	
-	/**
-     * Prints all keystore entries.
-     */
-	private void doPrintEntries(PrintStream out) throws Exception {
-
-		out.println("KeyStore type: " + usercerts.getType());
-		out.println("KeyStore provider: " + usercerts.getProvider().toString());
-		out.println();
-		
-		for (Enumeration<String> e = usercerts.aliases(); e.hasMoreElements();) {
-			String alias = e.nextElement();
-			doPrintEntry(alias, out, false);
-		}
-	}
-	
-    /**
-     * Prints a single keystore entry.
-     */
-	private void doPrintEntry(String alias, PrintStream out,
-			boolean printWarning) throws Exception {
-
-		if (usercerts.containsAlias(alias) == false) {
-			throw new Exception("Alias does not exist");
-		}
-
-		if (usercerts.entryInstanceOf(alias, 
-				KeyStore.TrustedCertificateEntry.class)) {
-			Certificate cert = usercerts.getCertificate(alias);
-
-			out.println("Alias: " + alias);
-			out.println("Date Created: " + usercerts.getCreationDate(alias));
-			out.println("Subject: " + getCN(((X509Certificate)usercerts
-				.getCertificate(alias)).getSubjectX500Principal().getName()));
-			out.println("Certificate fingerprint (MD5): "
-					+ getCertFingerPrint("MD5", cert));
-			out.println();
-		}
-	}
-
-	/**
-	 * Extracts the CN field from a Certificate principal string.
-	 */
-	private String getCN(String principal) {
-		int start = principal.indexOf("CN=");
-		int end = principal.indexOf(",", start);
-
-		if (end == -1) {
-			end = principal.length();
-		}
-
-		if (start >= 0)
-			return principal.substring(start+3, end);
-		else
-			return principal;
-    }
-
-    /**
-     * Gets the requested finger print of the certificate.
-     */
-	private String getCertFingerPrint(String mdAlg, Certificate cert)
-		throws Exception {
-		byte[] encCertInfo = cert.getEncoded();
-		MessageDigest md = MessageDigest.getInstance(mdAlg);
-		byte[] digest = md.digest(encCertInfo);
-		return toHexString(digest);
-	}
-
-    /**
-     * Converts a byte to hex digit and writes to the supplied buffer
-     */
-    private void byte2hex(byte b, StringBuffer buf) {
-        char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
-                            '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-        int high = ((b & 0xf0) >> 4);
-        int low = (b & 0x0f);
-        buf.append(hexChars[high]);
-        buf.append(hexChars[low]);
-    }
-
-    /**
-     * Converts a byte array to hex string
-     */
-    private String toHexString(byte[] block) {
-        StringBuffer buf = new StringBuffer();
-        int len = block.length;
-        for (int i = 0; i < len; i++) {
-             byte2hex(block[i], buf);
-             if (i < len-1) {
-                 buf.append(":");
-             }
-        }
-        return buf.toString();
-    }
-
-	/**
-	 * Adds a certificate to the keystore, and writes new keystore to disk.
-	 */
-    private boolean addTrustedCert(String alias, Certificate cert)
-    	throws Exception {
-    	
-    	if (isSelfSigned((X509Certificate)cert)) {
-			//will throw exception if this fails
-    		cert.verify(cert.getPublicKey());
-		}
-    
-    	if (noprompt) {
-    		usercerts.setCertificateEntry(alias, cert);
-			fos = new FileOutputStream(fullCertPath);
-			usercerts.store(fos, password);
-			fos.close();
-    		return true;
-    	}
-    	
-    	return false;
-    }    
-    
-    /**
-     * Returns true if the given certificate is trusted, false otherwise.
-     */
-    public boolean isTrusted(Certificate cert) throws Exception {
-    	if (cert != null) {
-    		if (usercerts.getCertificateAlias(cert) != null) {
-    			return true; // found in own keystore
-    		}
-    		return false;
-    	} else {
-    		return false;
-    	}
-    }
-    
-    /**
-     * Returns true if the certificate is self-signed, false otherwise.
-     */
-    private boolean isSelfSigned(X509Certificate cert) {
-        return cert.getSubjectDN().equals(cert.getIssuerDN());
-    }
-
-    /**
-     * Checks if a given certificate is part of the user's cacerts
-     * keystore.
-     * @param c the certificate to check
-     * @returns true if the certificate is in the user's cacerts and
-     * false otherwise
-     */
-    public boolean checkCacertsForCertificate(Certificate c) throws Exception {
-    	if (c != null) {
-
-			String alias = null;
-
-			//first try jdk cacerts.
-			if (cacerts != null) {
-    			alias = cacerts.getCertificateAlias(c);
-
-				//if we can't find it here, try the system certs.
-				if (alias == null && systemcerts != null)
-					alias = systemcerts.getCertificateAlias(c);
-			} 
-			//otherwise try the system certs if you can't use the jdk certs.
-			else if (systemcerts != null)
-				alias = systemcerts.getCertificateAlias(c);
-
-    		return (alias != null);
-    	} else 
-    		return false;
-    }
-    
-    /**
-     * Establishes a certificate chain (using trusted certificates in the
-     * keystore), starting with the user certificate
-     * and ending at a self-signed certificate found in the keystore.
-     *
-     * @param userCert the user certificate of the alias
-     * @param certToVerify the single certificate provided in the reply
-     */
-    public boolean establishCertChain(Certificate userCert,
-                                             Certificate certToVerify)
-        throws Exception
-    {
-        if (userCert != null) {
-            // Make sure that the public key of the certificate reply matches
-            // the original public key in the keystore
-            PublicKey origPubKey = userCert.getPublicKey();
-            PublicKey replyPubKey = certToVerify.getPublicKey();
-            if (!origPubKey.equals(replyPubKey)) {
-            	// TODO: something went wrong -- throw exception
-                throw new Exception(
-                	"Public keys in reply and keystore don't match");
-            }
-
-            // If the two certs are identical, we're done: no need to import
-            // anything
-            if (certToVerify.equals(userCert)) {
-                throw new Exception(
-                	"Certificate reply and certificate in keystore are identical");
-            }
-        }
-
-        // Build a hash table of all certificates in the keystore.
-        // Use the subject distinguished name as the key into the hash table.
-        // All certificates associated with the same subject distinguished
-        // name are stored in the same hash table entry as a vector.
-        Hashtable<Principal, Vector<Certificate>> certs = null;
-        if (usercerts.size() > 0) {
-            certs = new Hashtable<Principal, Vector<Certificate>>(11);
-            keystorecerts2Hashtable(usercerts, certs);
-        }
-        if (trustcacerts) { //if we're trusting the cacerts
-        	KeyStore caks = SecurityUtil.getCacertsKeyStore();
-            if (caks!=null && caks.size()>0) {
-                if (certs == null) {
-                    certs = new Hashtable<Principal, Vector<Certificate>>(11);
-                }
-                keystorecerts2Hashtable(caks, certs);
-            }
-        }
-
-        // start building chain
-        Vector<Certificate> chain = new Vector<Certificate>(2);
-        if (buildChain((X509Certificate)certToVerify, chain, certs)) {
-            Certificate[] newChain = new Certificate[chain.size()];
-            // buildChain() returns chain with self-signed root-cert first and
-            // user-cert last, so we need to invert the chain before we store
-            // it
-            int j=0;
-            for (int i=chain.size()-1; i>=0; i--) {
-                newChain[j] = chain.elementAt(i);
-                j++;
-            }
-            //return newChain;
-            return newChain != null;
-        } else {
-            throw new Exception("Failed to establish chain from reply");
-        }
-    }
-    
-    /**
-     * Stores the (leaf) certificates of a keystore in a hashtable.
-     * All certs belonging to the same CA are stored in a vector that
-     * in turn is stored in the hashtable, keyed by the CA's subject DN
-     */
-    private void keystorecerts2Hashtable(KeyStore ks,
-                Hashtable<Principal, Vector<Certificate>> hash)
-        throws Exception {
-
-        for (Enumeration<String> aliases = ks.aliases();
-                                        aliases.hasMoreElements(); ) {
-            String alias = aliases.nextElement();
-            Certificate cert = ks.getCertificate(alias);
-            if (cert != null) {
-                Principal subjectDN = ((X509Certificate)cert).getSubjectDN();
-                Vector<Certificate> vec = hash.get(subjectDN);
-                if (vec == null) {
-                    vec = new Vector<Certificate>();
-                    vec.addElement(cert);
-                } else {
-                    if (!vec.contains(cert)) {
-                        vec.addElement(cert);
-                    }
-                }
-                hash.put(subjectDN, vec);
-            }
-        }
-    }
-    
-    /**
-     * Recursively tries to establish chain from pool of trusted certs.
-     *
-     * @param certToVerify the cert that needs to be verified.
-     * @param chain the chain that's being built.
-     * @param certs the pool of trusted certs
-     *
-     * @return true if successful, false otherwise.
-     */
-    private boolean buildChain(X509Certificate certToVerify,
-                        Vector<Certificate> chain,
-                        Hashtable<Principal, Vector<Certificate>> certs) {
-        Principal subject = certToVerify.getSubjectDN();
-        Principal issuer = certToVerify.getIssuerDN();
-        if (subject.equals(issuer)) {
-            // reached self-signed root cert;
-            // no verification needed because it's trusted.
-            chain.addElement(certToVerify);
-            return true;
-        }
-
-        // Get the issuer's certificate(s)
-        Vector<Certificate> vec = certs.get(issuer);
-        if (vec == null) {
-            return false;
-        }
-
-        // Try out each certificate in the vector, until we find one
-        // whose public key verifies the signature of the certificate
-        // in question.
-        for (Enumeration<Certificate> issuerCerts = vec.elements();
-             issuerCerts.hasMoreElements(); ) {
-            X509Certificate issuerCert
-                = (X509Certificate)issuerCerts.nextElement();
-            PublicKey issuerPubKey = issuerCert.getPublicKey();
-            try {
-                certToVerify.verify(issuerPubKey);
-            } catch (Exception e) {
-                continue;
-            }
-            if (buildChain(issuerCert, chain, certs)) {
-                chain.addElement(certToVerify);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static void dumpCert(Certificate cert, PrintStream out)
-    	throws IOException, CertificateException {
-    	
-    	boolean printRfc = true;
-        if (printRfc) {
-            BASE64Encoder encoder = new BASE64Encoder();
-            out.println(X509Factory.BEGIN_CERT);
-            encoder.encodeBuffer(cert.getEncoded(), out);
-            out.println(X509Factory.END_CERT);
-        } else {
-            out.write(cert.getEncoded()); // binary
-        }
-    }
-    
-	public static void main(String[] args) throws Exception {
-		KeyTool kt = new KeyTool();
-		kt.doPrintEntries(System.out);
-	}
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/PropertiesFile.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.util;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.*;
-
-/**
- * A properties object backed by a specified file without throwing
- * exceptions.  The properties are automatically loaded from the
- * file when the first property is requested, but the save method
- * must be called before changes are saved to the file.<p>
- *
- * This class does not report IO exceptions.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.4 $ 
- */
-public class PropertiesFile extends Properties {
-
-    /** the file to save to */
-    File file;
-
-    /** the header string */
-    String header = "netx file";
-
-    /** lazy loaded on getProperty */
-    boolean loaded = false;
-
-
-    /** 
-     * Create a properties object backed by the specified file. 
-     *
-     * @param file the file to save and load to
-     */
-    public PropertiesFile(File file) {
-        this.file = file;
-    }
-
-    /** 
-     * Create a properties object backed by the specified file. 
-     *
-     * @param file the file to save and load to
-     * @param header the file header
-     */
-    public PropertiesFile(File file, String header) {
-        this.file = file;
-        this.header = header;
-    }
-
-    /**
-     * Returns the value of the specified key, or null if the key
-     * does not exist.
-     */
-    public String getProperty(String key) {
-        if (!loaded)
-            load();
-
-        return super.getProperty(key);
-    }
-
-    /**
-     * Returns the value of the specified key, or the default value
-     * if the key does not exist.
-     */
-    public String getProperty(String key, String defaultValue) {
-        if (!loaded)
-            load();
-
-        return super.getProperty(key, defaultValue);
-    }
-
-    /**
-     * Sets the value for the specified key.
-     *
-     * @return the previous value
-     */
-    public Object setProperty(String key, String value) {
-        if (!loaded)
-            load();
-
-        return super.setProperty(key, value);
-    }
-
-    /**
-     * Returns the file backing this properties object.
-     */
-    public File getStoreFile() {
-        return file;
-    }
-
-    /**
-     * Ensures that the file backing these properties has been
-     * loaded; call this method before calling any method defined by
-     * a superclass.
-     */
-    public void load() {
-        loaded = true;
-
-        try {
-            if (!file.exists())
-                return;
-
-            InputStream s = new FileInputStream(file);
-            load(s);
-        }
-        catch (IOException ex) {
-            // eat
-        }
-    }
-
-    /**
-     * Saves the properties to the file.
-     */
-    public void store() {
-        if (!loaded)
-            return; // nothing could have changed so save unnecessary load/save
-
-        try {
-            OutputStream s = new FileOutputStream(file);
-            store(s, header);
-        }
-        catch (IOException ex) {
-            // eat
-        }
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/Reflect.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-// Copyright (C) 2003 Jon A. Maxwell (JAM)
-// 
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-package net.sourceforge.jnlp.util;
-
-import java.util.*;
-import java.lang.reflect.*;
-
-
-/**
- * Provides simply, convenient methods to invoke methods by
- * name.  This class is used to consolidate reflection needed to
- * access methods specific to Sun's JVM or to remain backward
- * compatible while supporting method in newer JVMs.<p>
- *
- * Most methods of this class invoke the first method on the
- * specified object that matches the name and number of
- * parameters.  The type of the parameters are not considered, so
- * do not attempt to use this class to invoke overloaded
- * methods.<p>
- *
- * Instances of this class are not synchronized.<p>
- *
- * @author <a href="mailto:jon.maxwell@acm.org">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.1 $ 
- */
-public class Reflect {
-
-    // todo: check non-null parameter types, try to send to proper
-    // method if overloaded ones exist on the target object
-
-    // todo: optimize slightly using hashtable of Methods
-
-    private boolean accessible;
-
-    private static Object zero[] = new Object[0];
-
-    
-    /**
-     * Create a new Reflect instance.
-     */
-    public Reflect() {
-        //
-    }
-
-    /**
-     * Create a new Reflect instance.
-     *
-     * @param accessible whether to bypass access permissions
-     */
-    public Reflect(boolean accessible) {
-        this.accessible = accessible;
-    }
-
-    /**
-     * Invoke a zero-parameter static method by name.
-     */
-    public Object invokeStatic(String className, String method) {
-        return invokeStatic(className, method, zero);
-    }
-
-    /**
-     * Invoke the static method using the specified parameters.
-     */
-    public Object invokeStatic(String className, String method, Object args[]) {
-        try {
-            Class c = Class.forName(className, true, Reflect.class.getClassLoader());
-
-            Method m = getMethod(c, method, args);
-            if (m.isAccessible() != accessible)
-                m.setAccessible(accessible);
-
-            return m.invoke(null, args);
-        }
-        catch (Exception ex) { // eat
-            return null;
-        }
-    }
-
-    /**
-     * Invoke a zero-parameter method by name on the specified
-     * object.
-     */
-    public Object invoke(Object object, String method) {
-        return invoke(object, method, zero);
-    }
-
-    /**
-     * Invoke a method by name with the specified parameters.
-     *
-     * @return the result of the method, or null on exception.
-     */
-    public Object invoke(Object object, String method, Object args[]) {
-        try {
-            Method m = getMethod(object.getClass(), method, args);
-            if (m.isAccessible() != accessible)
-                m.setAccessible(accessible);
-
-            return m.invoke(object, args);
-        }
-        catch (Exception ex) { // eat
-            ex.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * Return the Method matching the specified name and number of
-     * arguments.
-     */
-    public Method getMethod(Class type, String method, Object args[]) {
-        try {
-            for (Class c = type; c != null; c = c.getSuperclass()) {
-                Method methods[] = c.getMethods();
-
-                for (int i=0; i < methods.length; i++) {
-                    if (methods[i].getName().equals(method)) {
-                        Class parameters[] = methods[i].getParameterTypes();
-
-                        if (parameters.length == args.length)
-                            return methods[i];
-                    }
-                }
-            }
-        }
-        catch (Exception ex) { // eat
-            ex.printStackTrace();
-        }
-
-        return null;
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/jnlp/util/WeakList.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-// Copyright (C) 2002-2003 Jon A. Maxwell (JAM)
-// 
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// 
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-// 
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-
-package net.sourceforge.jnlp.util;
-
-import java.lang.ref.*;
-import java.util.*;
-
-
-/**
- * This list stores objects automatically using weak references.
- * Objects are added and removed from the list as normal, but may
- * turn to null at any point (ie, indexOf(x) followed by get(x)
- * may return null).  The weak references are only removed when
- * the trimToSize method is called so that the indices remain
- * constant otherwise.<p>
- *
- * @author <a href="mailto:jmaxwell@users.sourceforge.net">Jon A. Maxwell (JAM)</a> - initial author
- * @version $Revision: 1.3 $ 
- */
-public class WeakList extends AbstractList {
-
-    /* list of weak references */
-    private ArrayList refs = new ArrayList();
-
-
-    /** 
-     * Create a weak random-access list.
-     */
-    public WeakList() {
-    }
-
-    /**
-     * Extract the hard reference out of a weak reference.
-     */
-    private Object deref(Object o) {
-        if (o != null && o instanceof WeakReference)
-            return ((WeakReference)o).get();
-        else
-            return null;
-    }
-
-    /**
-     * Returns the object at the specified index, or null if the
-     * object has been collected.
-     */
-    public Object get(int index) {
-        return deref(refs.get(index));
-    }
-
-    /**
-     * Returns the size of the list, including already collected
-     * objects.
-     */
-    public int size() {
-        return refs.size();
-    }
-
-    /**
-     * Sets the object at the specified position and returns the
-     * previous object at that position or null if it was already
-     * collected.
-     */
-    public Object set(int index, Object element) {
-        return deref(refs.set(index, new WeakReference(element)));
-    }
-
-    /**
-     * Inserts the object at the specified position in the list.
-     * Automatically creates a weak reference to the object.
-     */
-    public void add(int index, Object element) {
-        refs.add(index, new WeakReference(element));
-    }
-
-    /**
-     * Removes the object at the specified position and returns it
-     * or returns null if it was already collected.
-     */
-    public Object remove(int index) {
-        return deref(refs.remove(index));
-    }
-
-    /**
-     * Returns a list of hard references to the objects.  The
-     * returned list does not include the collected elements, so its
-     * indices do not necessarily correlate with those of this list.
-     */
-    public List hardList() {
-        List result = new ArrayList();
-
-        for (int i=0; i < size(); i++) {
-            Object tmp = get(i);
-
-            if (tmp != null)
-                result.add(tmp);
-        }
-
-        return result;
-    }
-
-    /**
-     * Compacts the list by removing references to collected
-     * objects.
-     */
-    public void trimToSize() {
-        for (int i=size(); i-->0;)
-            if (get(i)==null)
-                remove(i);
-    }
-
-}
-
-
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLElement.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1334 +0,0 @@
-/* XMLElement.java
- *
- * $Revision: 1.2 $
- * $Date: 2002/08/03 04:36:34 $
- * $Name:  $
- *
- * This file is part of NanoXML 2 Lite.
- * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
- *
- * This software is provided 'as-is', without any express or implied warranty.
- * In no event will the authors be held liable for any damages arising from the
- * use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- *  1. The origin of this software must not be misrepresented; you must not
- *     claim that you wrote the original software. If you use this software in
- *     a product, an acknowledgment in the product documentation would be
- *     appreciated but is not required.
- *
- *  2. Altered source versions must be plainly marked as such, and must not be
- *     misrepresented as being the original software.
- *
- *  3. This notice may not be removed or altered from any source distribution.
- *****************************************************************************/
-
-/* JAM: hacked the source to remove unneeded methods and comments. */
-
-package net.sourceforge.nanoxml;
-
-import java.io.*;
-import java.util.*;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-
-/**
- * XMLElement is a representation of an XML object. The object is able to parse
- * XML code.
- * <P><DL>
- * <DT><B>Parsing XML Data</B></DT>
- * <DD>
- * You can parse XML data using the following code:
- * <UL><CODE>
- * XMLElement xml = new XMLElement();<BR>
- * FileReader reader = new FileReader("filename.xml");<BR>
- * xml.parseFromReader(reader);
- * </CODE></UL></DD></DL>
- * <DL><DT><B>Retrieving Attributes</B></DT>
- * <DD>
- * You can enumerate the attributes of an element using the method
- * {@link #enumerateAttributeNames() enumerateAttributeNames}.
- * The attribute values can be retrieved using the method
- * {@link #getStringAttribute(java.lang.String) getStringAttribute}.
- * The following example shows how to list the attributes of an element:
- * <UL><CODE>
- * XMLElement element = ...;<BR>
- * Enumeration enum = element.getAttributeNames();<BR>
- * while (enum.hasMoreElements()) {<BR>
- * &nbsp;&nbsp;&nbsp;&nbsp;String key = (String) enum.nextElement();<BR>
- * &nbsp;&nbsp;&nbsp;&nbsp;String value = element.getStringAttribute(key);<BR>
- * &nbsp;&nbsp;&nbsp;&nbsp;System.out.println(key + " = " + value);<BR>
- * }
- * </CODE></UL></DD></DL>
- * <DL><DT><B>Retrieving Child Elements</B></DT>
- * <DD>
- * You can enumerate the children of an element using
- * {@link #enumerateChildren() enumerateChildren}.
- * The number of child elements can be retrieved using
- * {@link #countChildren() countChildren}.
- * </DD></DL>
- * <DL><DT><B>Elements Containing Character Data</B></DT>
- * <DD>
- * If an elements contains character data, like in the following example:
- * <UL><CODE>
- * &lt;title&gt;The Title&lt;/title&gt;
- * </CODE></UL>
- * you can retrieve that data using the method
- * {@link #getContent() getContent}.
- * </DD></DL>
- * <DL><DT><B>Subclassing XMLElement</B></DT>
- * <DD>
- * When subclassing XMLElement, you need to override the method
- * {@link #createAnotherElement() createAnotherElement}
- * which has to return a new copy of the receiver.
- * </DD></DL>
- * <P>
- *
- * @see net.sourceforge.nanoxml.XMLParseException
- *
- * @author Marc De Scheemaecker
- *         &lt;<A href="mailto:cyberelf@mac.com">cyberelf@mac.com</A>&gt;
- * @version $Name:  $, $Revision: 1.2 $
- */
-public class XMLElement
-{
-
-    /**
-     * The attributes given to the element.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field can be empty.
-     *     <li>The field is never <code>null</code>.
-     *     <li>The keys and the values are strings.
-     * </ul></dd></dl>
-     */
-    private Hashtable attributes;
-
-
-    /**
-     * Child elements of the element.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field can be empty.
-     *     <li>The field is never <code>null</code>.
-     *     <li>The elements are instances of <code>XMLElement</code>
-     *         or a subclass of <code>XMLElement</code>.
-     * </ul></dd></dl>
-     */
-    private Vector children;
-
-
-    /**
-     * The name of the element.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field is <code>null</code> iff the element is not
-     *         initialized by either parse or setName.
-     *     <li>If the field is not <code>null</code>, it's not empty.
-     *     <li>If the field is not <code>null</code>, it contains a valid
-     *         XML identifier.
-     * </ul></dd></dl>
-     */
-    private String name;
-
-
-    /**
-     * The #PCDATA content of the object.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field is <code>null</code> iff the element is not a
-     *         #PCDATA element.
-     *     <li>The field can be any string, including the empty string.
-     * </ul></dd></dl>
-     */
-    private String contents;
-
-
-    /**
-     * Conversion table for &amp;...; entities. The keys are the entity names
-     * without the &amp; and ; delimiters.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field is never <code>null</code>.
-     *     <li>The field always contains the following associations:
-     *         "lt"&nbsp;=&gt;&nbsp;"&lt;", "gt"&nbsp;=&gt;&nbsp;"&gt;",
-     *         "quot"&nbsp;=&gt;&nbsp;"\"", "apos"&nbsp;=&gt;&nbsp;"'",
-     *         "amp"&nbsp;=&gt;&nbsp;"&amp;"
-     *     <li>The keys are strings
-     *     <li>The values are char arrays
-     * </ul></dd></dl>
-     */
-    private Hashtable entities;
-
-
-    /**
-     * The line number where the element starts.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li><code>lineNr &gt= 0</code>
-     * </ul></dd></dl>
-     */
-    private int lineNr;
-
-
-    /**
-     * <code>true</code> if the case of the element and attribute names
-     * are case insensitive.
-     */
-    private boolean ignoreCase;
-
-
-    /**
-     * <code>true</code> if the leading and trailing whitespace of #PCDATA
-     * sections have to be ignored.
-     */
-    private boolean ignoreWhitespace;
-
-
-    /**
-     * Character read too much.
-     * This character provides push-back functionality to the input reader
-     * without having to use a PushbackReader.
-     * If there is no such character, this field is '\0'.
-     */
-    private char charReadTooMuch;
-
-    /**
-     * Character read too much for the comment remover.
-     */
-    private char sanitizeCharReadTooMuch;
-
-    /**
-     * The reader provided by the caller of the parse method.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>The field is not <code>null</code> while the parse method
-     *         is running.
-     * </ul></dd></dl>
-     */
-    private Reader reader;
-
-
-    /**
-     * The current line number in the source content.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li>parserLineNr &gt; 0 while the parse method is running.
-     * </ul></dd></dl>
-     */
-    private int parserLineNr;
-
-
-    /**
-     * Creates and initializes a new XML element.
-     * Calling the construction is equivalent to:
-     * <ul><code>new XMLElement(new Hashtable(), false, true)
-     * </code></ul>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>countChildren() => 0
-     *     <li>enumerateChildren() => empty enumeration
-     *     <li>enumeratePropertyNames() => empty enumeration
-     *     <li>getChildren() => empty vector
-     *     <li>getContent() => ""
-     *     <li>getLineNr() => 0
-     *     <li>getName() => null
-     * </ul></dd></dl>
-     *
-     */
-    public XMLElement()
-    {
-        this(new Hashtable(), false, true, true);
-    }
-    
-
-    /**
-     * Creates and initializes a new XML element.
-     * <P>
-     * This constructor should <I>only</I> be called from
-     * {@link #createAnotherElement() createAnotherElement}
-     * to create child elements.
-     *
-     * @param entities
-     *     The entity conversion table.
-     * @param skipLeadingWhitespace
-     *     <code>true</code> if leading and trailing whitespace in PCDATA
-     *     content has to be removed.
-     * @param fillBasicConversionTable
-     *     <code>true</code> if the basic entities need to be added to
-     *     the entity list (client code calling this constructor).
-     * @param ignoreCase
-     *     <code>true</code> if the case of element and attribute names have
-     *     to be ignored.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>entities != null</code>
-     *     <li>if <code>fillBasicConversionTable == false</code>
-     *         then <code>entities</code> contains at least the following
-     *         entries: <code>amp</code>, <code>lt</code>, <code>gt</code>,
-     *         <code>apos</code> and <code>quot</code>
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>countChildren() => 0
-     *     <li>enumerateChildren() => empty enumeration
-     *     <li>enumeratePropertyNames() => empty enumeration
-     *     <li>getChildren() => empty vector
-     *     <li>getContent() => ""
-     *     <li>getLineNr() => 0
-     *     <li>getName() => null
-     * </ul></dd></dl><dl>
-     *
-     */
-    protected XMLElement(Hashtable entities,
-                         boolean   skipLeadingWhitespace,
-                         boolean   fillBasicConversionTable,
-                         boolean   ignoreCase)
-    {
-        this.ignoreWhitespace = skipLeadingWhitespace;
-        this.ignoreCase = ignoreCase;
-        this.name = null;
-        this.contents = "";
-        this.attributes = new Hashtable();
-        this.children = new Vector();
-        this.entities = entities;
-        this.lineNr = 0;
-        Enumeration e = this.entities.keys();
-        while (e.hasMoreElements()) {
-            Object key = e.nextElement();
-            Object value = this.entities.get(key);
-            if (value instanceof String) {
-                value = ((String) value).toCharArray();
-                this.entities.put(key, value);
-            }
-        }
-        if (fillBasicConversionTable) {
-            this.entities.put("amp", new char[] { '&' });
-            this.entities.put("quot", new char[] { '"' });
-            this.entities.put("apos", new char[] { '\'' });
-            this.entities.put("lt", new char[] { '<' });
-            this.entities.put("gt", new char[] { '>' });
-        }
-    }
-
-
-    /**
-     * Adds a child element.
-     *
-     * @param child
-     *     The child element to add.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>child != null</code>
-     *     <li><code>child.getName() != null</code>
-     *     <li><code>child</code> does not have a parent element
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>countChildren() => old.countChildren() + 1
-     *     <li>enumerateChildren() => old.enumerateChildren() + child
-     *     <li>getChildren() => old.enumerateChildren() + child
-     * </ul></dd></dl><dl>
-     *
-     */
-    public void addChild(XMLElement child)
-    {
-        this.children.addElement(child);
-    }
-
-
-    /**
-     * Adds or modifies an attribute.
-     *
-     * @param name
-     *     The name of the attribute.
-     * @param value
-     *     The value of the attribute.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     *     <li><code>name</code> is a valid XML identifier
-     *     <li><code>value != null</code>
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>enumerateAttributeNames()
-     *         => old.enumerateAttributeNames() + name
-     *     <li>getAttribute(name) => value
-     * </ul></dd></dl><dl>
-     *
-     */
-    public void setAttribute(String name,
-                             Object value)
-    {
-        if (this.ignoreCase) {
-            name = name.toUpperCase();
-        }
-        this.attributes.put(name, value.toString());
-    }
-
-
-    /**
-     * Returns the number of child elements of the element.
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li><code>result >= 0</code>
-     * </ul></dd></dl>
-     *
-     */
-    public int countChildren()
-    {
-        return this.children.size();
-    }
-
-
-    /**
-     * Enumerates the attribute names.
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li><code>result != null</code>
-     * </ul></dd></dl>
-     *
-     */
-    public Enumeration enumerateAttributeNames()
-    {
-        return this.attributes.keys();
-    }
-
-
-    /**
-     * Enumerates the child elements.
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li><code>result != null</code>
-     * </ul></dd></dl>
-     *
-     */
-    public Enumeration enumerateChildren()
-    {
-        return this.children.elements();
-    }
-
-
-    /**
-     * Returns the PCDATA content of the object. If there is no such content,
-     * <CODE>null</CODE> is returned.
-     *
-     */
-    public String getContent()
-    {
-        return this.contents;
-    }
-
-
-    /**
-     * Returns the line nr in the source data on which the element is found.
-     * This method returns <code>0</code> there is no associated source data.
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li><code>result >= 0</code>
-     * </ul></dd></dl>
-     */
-    public int getLineNr()
-    {
-        return this.lineNr;
-    }
-
-
-    /**
-     * Returns an attribute of the element.
-     * If the attribute doesn't exist, <code>null</code> is returned.
-     *
-     * @param name The name of the attribute.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     *     <li><code>name</code> is a valid XML identifier
-     * </ul></dd></dl><dl>
-     *
-     */
-    public Object getAttribute(String name)
-    {
-        if (this.ignoreCase) {
-            name = name.toUpperCase();
-        }
-        Object value = this.attributes.get(name);
-        return value;
-    }
-
-
-    /**
-     * Returns the name of the element.
-     *
-     */
-    public String getName()
-    {
-        return this.name;
-    }
-
-
-    /**
-     * Reads one XML element from a java.io.Reader and parses it.
-     *
-     * @param reader
-     *     The reader from which to retrieve the XML data.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>reader != null</code>
-     *     <li><code>reader</code> is not closed
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>the state of the receiver is updated to reflect the XML element
-     *         parsed from the reader
-     *     <li>the reader points to the first character following the last
-     *         '&gt;' character of the XML element
-     * </ul></dd></dl><dl>
-     *
-     * @throws java.io.IOException
-     *     If an error occured while reading the input.
-     * @throws net.sourceforge.nanoxml.XMLParseException
-     *     If an error occured while parsing the read data.
-     */
-    public void parseFromReader(Reader reader)
-    throws IOException, XMLParseException
-    {
-        this.parseFromReader(reader, /*startingLineNr*/ 1);
-    }
-
-
-    /**
-     * Reads one XML element from a java.io.Reader and parses it.
-     *
-     * @param reader
-     *     The reader from which to retrieve the XML data.
-     * @param startingLineNr
-     *     The line number of the first line in the data.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>reader != null</code>
-     *     <li><code>reader</code> is not closed
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>the state of the receiver is updated to reflect the XML element
-     *         parsed from the reader
-     *     <li>the reader points to the first character following the last
-     *         '&gt;' character of the XML element
-     * </ul></dd></dl><dl>
-     *
-     * @throws java.io.IOException
-     *     If an error occured while reading the input.
-     * @throws net.sourceforge.nanoxml.XMLParseException
-     *     If an error occured while parsing the read data.
-     */
-    public void parseFromReader(Reader reader,
-                                int    startingLineNr)
-        throws IOException, XMLParseException
-    {
-        this.charReadTooMuch = '\0';
-        this.reader = reader;
-        this.parserLineNr = startingLineNr;
-
-        for (;;) {
-            char ch = this.scanWhitespace();
-
-            if (ch != '<') {
-                throw this.expectedInput("<", ch);
-            }
-
-            ch = this.readChar();
-
-            if ((ch == '!') || (ch == '?')) {
-                this.skipSpecialTag(0);
-            } else {
-                this.unreadChar(ch);
-                this.scanElement(this);
-                return;
-            }
-        }
-    }
-
-
-    /**
-     * Creates a new similar XML element.
-     * <P>
-     * You should override this method when subclassing XMLElement.
-     */
-    protected XMLElement createAnotherElement()
-    {
-        return new XMLElement(this.entities,
-                              this.ignoreWhitespace,
-                              false,
-                              this.ignoreCase);
-    }
-
-
-    /**
-     * Changes the content string.
-     *
-     * @param content
-     *     The new content string.
-     */
-    public void setContent(String content)
-    {
-        this.contents = content;
-    }
-
-
-    /**
-     * Changes the name of the element.
-     *
-     * @param name
-     *     The new name.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     *     <li><code>name</code> is a valid XML identifier
-     * </ul></dd></dl>
-     *
-     */
-    public void setName(String name)
-    {
-        this.name = name;
-    }
-
-
-    /**
-     * Scans an identifier from the current reader.
-     * The scanned identifier is appended to <code>result</code>.
-     *
-     * @param result
-     *     The buffer in which the scanned identifier will be put.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>result != null</code>
-     *     <li>The next character read from the reader is a valid first
-     *         character of an XML identifier.
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>The next character read from the reader won't be an identifier
-     *         character.
-     * </ul></dd></dl><dl>
-     */
-    protected void scanIdentifier(StringBuffer result)
-        throws IOException
-    {
-        for (;;) {
-            char ch = this.readChar();
-            if (((ch < 'A') || (ch > 'Z')) && ((ch < 'a') || (ch > 'z'))
-                && ((ch < '0') || (ch > '9')) && (ch != '_') && (ch != '.')
-                && (ch != ':') && (ch != '-') && (ch <= '\u007E')) {
-                this.unreadChar(ch);
-                return;
-            }
-            result.append(ch);
-        }
-    }
-
-
-    /**
-     * This method scans an identifier from the current reader.
-     *
-     * @return the next character following the whitespace.
-     */
-    protected char scanWhitespace()
-        throws IOException
-    {
-        for (;;) {
-            char ch = this.readChar();
-            switch (ch) {
-                case ' ':
-                case '\t':
-                case '\n':
-                case '\r':
-                    break;
-                default:
-                    return ch;
-            }
-        }
-    }
-
-
-    /**
-     * This method scans an identifier from the current reader.
-     * The scanned whitespace is appended to <code>result</code>.
-     *
-     * @return the next character following the whitespace.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>result != null</code>
-     * </ul></dd></dl>
-     */
-    protected char scanWhitespace(StringBuffer result)
-        throws IOException
-    {
-        for (;;) {
-            char ch = this.readChar();
-            switch (ch) {
-                case ' ':
-                case '\t':
-                case '\n':
-                    result.append(ch);
-                case '\r':
-                    break;
-                default:
-                    return ch;
-            }
-        }
-    }
-
-
-    /**
-     * This method scans a delimited string from the current reader.
-     * The scanned string without delimiters is appended to
-     * <code>string</code>.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>string != null</code>
-     *     <li>the next char read is the string delimiter
-     * </ul></dd></dl>
-     */
-    protected void scanString(StringBuffer string)
-        throws IOException
-    {
-        char delimiter = this.readChar();
-        if ((delimiter != '\'') && (delimiter != '"')) {
-            throw this.expectedInput("' or \"");
-        }
-        for (;;) {
-            char ch = this.readChar();
-            if (ch == delimiter) {
-                return;
-            } else if (ch == '&') {
-                this.resolveEntity(string);
-            } else {
-                string.append(ch);
-            }
-        }
-    }
-
-
-    /**
-     * Scans a #PCDATA element. CDATA sections and entities are resolved.
-     * The next &lt; char is skipped.
-     * The scanned data is appended to <code>data</code>.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>data != null</code>
-     * </ul></dd></dl>
-     */
-    protected void scanPCData(StringBuffer data)
-        throws IOException
-    {
-        for (;;) {
-            char ch = this.readChar();
-            if (ch == '<') {
-                ch = this.readChar();
-                if (ch == '!') {
-                    this.checkCDATA(data);
-                } else {
-                    this.unreadChar(ch);
-                    return;
-                }
-            } else if (ch == '&') {
-                this.resolveEntity(data);
-            } else {
-                data.append(ch);
-            }
-        }
-    }
-
-
-    /**
-     * Scans a special tag and if the tag is a CDATA section, append its
-     * content to <code>buf</code>.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>buf != null</code>
-     *     <li>The first &lt; has already been read.
-     * </ul></dd></dl>
-     */
-    protected boolean checkCDATA(StringBuffer buf)
-        throws IOException
-    {
-        char ch = this.readChar();
-        if (ch != '[') {
-            this.unreadChar(ch);
-            this.skipSpecialTag(0);
-            return false;
-        } else if (! this.checkLiteral("CDATA[")) {
-            this.skipSpecialTag(1); // one [ has already been read
-            return false;
-        } else {
-            int delimiterCharsSkipped = 0;
-            while (delimiterCharsSkipped < 3) {
-                ch = this.readChar();
-                switch (ch) {
-                    case ']':
-                        if (delimiterCharsSkipped < 2) {
-                            delimiterCharsSkipped += 1;
-                        } else {
-                            buf.append(']');
-                            buf.append(']');
-                            delimiterCharsSkipped = 0;
-                        }
-                        break;
-                    case '>':
-                        if (delimiterCharsSkipped < 2) {
-                            for (int i = 0; i < delimiterCharsSkipped; i++) {
-                                buf.append(']');
-                            }
-                            delimiterCharsSkipped = 0;
-                            buf.append('>');
-                        } else {
-                            delimiterCharsSkipped = 3;
-                        }
-                        break;
-                    default:
-                        for (int i = 0; i < delimiterCharsSkipped; i += 1) {
-                            buf.append(']');
-                        }
-                        buf.append(ch);
-                        delimiterCharsSkipped = 0;
-                }
-            }
-            return true;
-        }
-    }
-
-
-    /**
-     * Skips a comment.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li>The first &lt;!-- has already been read.
-     * </ul></dd></dl>
-     */
-    protected void skipComment()
-        throws IOException
-    {
-        int dashesToRead = 2;
-        while (dashesToRead > 0) {
-            char ch = this.readChar();
-            if (ch == '-') {
-                dashesToRead -= 1;
-            } else {
-                dashesToRead = 2;
-            }
-
-            // Be more tolerant of extra -- (double dashes)
-            // in comments.
-            if (dashesToRead == 0) {
-                ch = this.readChar();
-                if (ch == '>') {
-                    return;
-                } else {
-                    dashesToRead = 2;
-                    this.unreadChar(ch);
-                }
-            }
-        }
-        /*
-        if (this.readChar() != '>') {
-            throw this.expectedInput(">");
-        }
-        */
-    }
-
-
-    /**
-     * Skips a special tag or comment.
-     *
-     * @param bracketLevel The number of open square brackets ([) that have
-     *                     already been read.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li>The first &lt;! has already been read.
-     *     <li><code>bracketLevel >= 0</code>
-     * </ul></dd></dl>
-     */
-    protected void skipSpecialTag(int bracketLevel)
-        throws IOException
-    {
-        int tagLevel = 1; // <
-        char stringDelimiter = '\0';
-        if (bracketLevel == 0) {
-            char ch = this.readChar();
-            if (ch == '[') {
-                bracketLevel += 1;
-            } else if (ch == '-') {
-                ch = this.readChar();
-                if (ch == '[') {
-                    bracketLevel += 1;
-                } else if (ch == ']') {
-                    bracketLevel -= 1;
-                } else if (ch == '-') {
-                    this.skipComment();
-                    return;
-                }
-            }
-        }
-        while (tagLevel > 0) {
-            char ch = this.readChar();
-            if (stringDelimiter == '\0') {
-                if ((ch == '"') || (ch == '\'')) {
-                    stringDelimiter = ch;
-                } else if (bracketLevel <= 0) {
-                    if (ch == '<') {
-                        tagLevel += 1;
-                    } else if (ch == '>') {
-                        tagLevel -= 1;
-                    }
-                }
-                if (ch == '[') {
-                    bracketLevel += 1;
-                } else if (ch == ']') {
-                    bracketLevel -= 1;
-                }
-            } else {
-                if (ch == stringDelimiter) {
-                    stringDelimiter = '\0';
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Scans the data for literal text.
-     * Scanning stops when a character does not match or after the complete
-     * text has been checked, whichever comes first.
-     *
-     * @param literal the literal to check.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>literal != null</code>
-     * </ul></dd></dl>
-     */
-    protected boolean checkLiteral(String literal)
-        throws IOException
-    {
-        int length = literal.length();
-        for (int i = 0; i < length; i += 1) {
-            if (this.readChar() != literal.charAt(i)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-
-    /**
-     * Reads a character from a reader.
-     */
-    protected char readChar()
-        throws IOException
-    {
-        if (this.charReadTooMuch != '\0') {
-            char ch = this.charReadTooMuch;
-            this.charReadTooMuch = '\0';
-            return ch;
-        } else {
-            int i = this.reader.read();
-            if (i < 0) {
-                throw this.unexpectedEndOfData();
-            } else if (i == 10) {
-                this.parserLineNr += 1;
-                return '\n';
-            } else {
-                return (char) i;
-            }
-        }
-    }
-
-
-    /**
-     * Scans an XML element.
-     *
-     * @param elt The element that will contain the result.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li>The first &lt; has already been read.
-     *     <li><code>elt != null</code>
-     * </ul></dd></dl>
-     */
-    protected void scanElement(XMLElement elt)
-        throws IOException
-    {
-        StringBuffer buf = new StringBuffer();
-        this.scanIdentifier(buf);
-        String name = buf.toString();
-        elt.setName(name);
-        char ch = this.scanWhitespace();
-        while ((ch != '>') && (ch != '/')) {
-            buf.setLength(0);
-            this.unreadChar(ch);
-            this.scanIdentifier(buf);
-            String key = buf.toString();
-            ch = this.scanWhitespace();
-            if (ch != '=') {
-                throw this.expectedInput("=");
-            }
-            this.unreadChar(this.scanWhitespace());
-            buf.setLength(0);
-            this.scanString(buf);
-            elt.setAttribute(key, buf);
-            ch = this.scanWhitespace();
-        }
-        if (ch == '/') {
-            ch = this.readChar();
-            if (ch != '>') {
-                throw this.expectedInput(">");
-            }
-            return;
-        }
-        buf.setLength(0);
-        ch = this.scanWhitespace(buf);
-        if (ch != '<') {
-            this.unreadChar(ch);
-            this.scanPCData(buf);
-        } else {
-            for (;;) {
-                ch = this.readChar();
-                if (ch == '!') {
-                    if (this.checkCDATA(buf)) {
-                        this.scanPCData(buf);
-                        break;
-                    } else {
-                        ch = this.scanWhitespace(buf);
-                        if (ch != '<') {
-                            this.unreadChar(ch);
-                            this.scanPCData(buf);
-                            break;
-                        }
-                    }
-                } else {
-                    buf.setLength(0);
-                    break;
-                }
-            }
-        }
-        if (buf.length() == 0) {
-            while (ch != '/') {
-                if (ch == '!') {
-                    ch = this.readChar();
-                    if (ch != '-') {
-                        throw this.expectedInput("Comment or Element");
-                    }
-                    ch = this.readChar();
-                    if (ch != '-') {
-                        throw this.expectedInput("Comment or Element");
-                    }
-                    this.skipComment();
-                } else {
-                    this.unreadChar(ch);
-                    XMLElement child = this.createAnotherElement();
-                    this.scanElement(child);
-                    elt.addChild(child);
-                }
-                ch = this.scanWhitespace();
-                if (ch != '<') {
-                    throw this.expectedInput("<");
-                }
-                ch = this.readChar();
-            }
-            this.unreadChar(ch);
-        } else {
-            if (this.ignoreWhitespace) {
-                elt.setContent(buf.toString().trim());
-            } else {
-                elt.setContent(buf.toString());
-            }
-        }
-        ch = this.readChar();
-        if (ch != '/') {
-            throw this.expectedInput("/");
-        }
-        this.unreadChar(this.scanWhitespace());
-        if (! this.checkLiteral(name)) {
-            throw this.expectedInput(name);
-        }
-        if (this.scanWhitespace() != '>') {
-            throw this.expectedInput(">");
-        }
-    }
-
-
-    /**
-     * Resolves an entity. The name of the entity is read from the reader.
-     * The value of the entity is appended to <code>buf</code>.
-     *
-     * @param buf Where to put the entity value.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li>The first &amp; has already been read.
-     *     <li><code>buf != null</code>
-     * </ul></dd></dl>
-     */
-    protected void resolveEntity(StringBuffer buf)
-        throws IOException
-    {
-        char ch = '\0';
-        StringBuffer keyBuf = new StringBuffer();
-        for (;;) {
-            ch = this.readChar();
-            if (ch == ';') {
-                break;
-            }
-            keyBuf.append(ch);
-        }
-        String key = keyBuf.toString();
-        if (key.charAt(0) == '#') {
-            try {
-                if (key.charAt(1) == 'x') {
-                    ch = (char) Integer.parseInt(key.substring(2), 16);
-                } else {
-                    ch = (char) Integer.parseInt(key.substring(1), 10);
-                }
-            } catch (NumberFormatException e) {
-                throw this.unknownEntity(key);
-            }
-            buf.append(ch);
-        } else {
-            char[] value = (char[]) this.entities.get(key);
-            if (value == null) {
-                throw this.unknownEntity(key);
-            }
-            buf.append(value);
-        }
-    }
-
-
-    /**
-     * Pushes a character back to the read-back buffer.
-     *
-     * @param ch The character to push back.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li>The read-back buffer is empty.
-     *     <li><code>ch != '\0'</code>
-     * </ul></dd></dl>
-     */
-    protected void unreadChar(char ch)
-    {
-        this.charReadTooMuch = ch;
-    }
-
-
-    /**
-     * Creates a parse exception for when an invalid valueset is given to
-     * a method.
-     *
-     * @param name The name of the entity.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException invalidValueSet(String name)
-    {
-        String msg = "Invalid value set (entity name = \"" + name + "\")";
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-
-    /**
-     * Creates a parse exception for when an invalid value is given to a
-     * method.
-     *
-     * @param name  The name of the entity.
-     * @param value The value of the entity.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     *     <li><code>value != null</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException invalidValue(String name,
-                                             String value)
-    {
-        String msg = "Attribute \"" + name + "\" does not contain a valid "
-                   + "value (\"" + value + "\")";
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-
-    /**
-     * Creates a parse exception for when the end of the data input has been
-     * reached.
-     */
-    protected XMLParseException unexpectedEndOfData()
-    {
-        String msg = "Unexpected end of data reached";
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-
-    /**
-     * Creates a parse exception for when a syntax error occured.
-     *
-     * @param context The context in which the error occured.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>context != null</code>
-     *     <li><code>context.length() &gt; 0</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException syntaxError(String context)
-    {
-        String msg = "Syntax error while parsing " + context;
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-
-    /**
-     * Creates a parse exception for when the next character read is not
-     * the character that was expected.
-     *
-     * @param charSet The set of characters (in human readable form) that was
-     *                expected.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>charSet != null</code>
-     *     <li><code>charSet.length() &gt; 0</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException expectedInput(String charSet)
-    {
-        String msg = "Expected: " + charSet;
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-    /**
-     * Creates a parse exception for when the next character read is not
-     * the character that was expected.
-     *
-     * @param charSet The set of characters (in human readable form) that was
-     *                expected.
-     * @param ch The character that was received instead.
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>charSet != null</code>
-     *     <li><code>charSet.length() &gt; 0</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException expectedInput(String charSet, char ch)
-    {
-        String msg = "Expected: '" + charSet +"'" + " but got: '" + ch + "'";
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-    /**
-     * Creates a parse exception for when an entity could not be resolved.
-     *
-     * @param name The name of the entity.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>name != null</code>
-     *     <li><code>name.length() &gt; 0</code>
-     * </ul></dd></dl>
-     */
-    protected XMLParseException unknownEntity(String name)
-    {
-        String msg = "Unknown or invalid entity: &" + name + ";";
-        return new XMLParseException(this.getName(), this.parserLineNr, msg);
-    }
-
-    /**
-     * Reads an xml file and removes the comments, leaving only relevant
-     * xml code.
-     *
-     * @param isr The reader of the InputStream containing the xml.
-     * @param pout The PipedOutputStream that will be receiving the filtered
-     *             xml file.
-     */
-    public void sanitizeInput(InputStreamReader isr, PipedOutputStream pout) {
-        try {
-            PrintStream out = new PrintStream(pout);
-
-            this.sanitizeCharReadTooMuch = '\0';
-            this.reader = isr;
-            this.parserLineNr = 0;
-            int newline = 2;
-	    char prev = ' ';
-
-            while(true) {
-                char ch;
-                if (this.sanitizeCharReadTooMuch != '\0') {
-                    ch = this.sanitizeCharReadTooMuch;
-                    this.sanitizeCharReadTooMuch = '\0';
-                } else {
-
-                    int i = this.reader.read();
-                    if (i == -1) {
-                        // no character in buffer, and nothing read
-                        out.flush();
-                        break;
-                    } else if (i == 10) {
-                        ch = '\n';
-                    } else {
-                        ch = (char) i;
-                    }
-                }
-
-                char next;
-                int i = this.reader.read();
-                if (i == -1) {
-                    // character in buffer and nothing read. write out
-                    // what's in the buffer
-                    out.print(ch);
-                    out.flush();
-                    if (JNLPRuntime.isDebug()) {
-                        if (ch == 10) {
-                            System.out.println();
-                            System.out.print("line: " + newline + " ");
-                            newline++;
-                        } else {
-                            System.out.print(ch);
-                        }
-                    }
-                    break;
-                } else if (i == 10) {
-                    next = '\n';
-                } else {
-                    next = (char) i;
-                }
-
-                this.sanitizeCharReadTooMuch = next;
-
-                // If the next char is a ? or !, then we've hit a special tag,
-                // and should skip it.
-                if (prev == '<' && (next == '!' || next == '?')) {
-                    this.skipSpecialTag(0);
-                    this.sanitizeCharReadTooMuch = '\0';
-                }
-                // Otherwise we haven't hit a comment, and we should write ch.
-                else {
-                    out.print(ch);
-                    if (JNLPRuntime.isDebug()) {
-                        if (ch == 10) {
-                            System.out.println();
-                            System.out.print("line: " + newline + " ");
-                            newline++;
-                        } else {
-                            System.out.print(ch);
-                        }
-                    }
-                }
-		prev = next;
-            }
-
-            out.close();
-            isr.close();
-        } catch (Exception e) {
-            // Print the stack trace here -- xml.parseFromReader() will
-            // throw the ParseException if something goes wrong.
-            e.printStackTrace();
-        }
-    }
-}
--- a/overlays/openjdk/jdk/src/share/classes/net/sourceforge/nanoxml/XMLParseException.java	Wed May 27 20:20:48 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/* XMLParseException.java
- *
- * $Revision: 1.1 $
- * $Date: 2002/08/03 04:05:32 $
- * $Name:  $
- *
- * This file is part of NanoXML 2 Lite.
- * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
- *
- * This software is provided 'as-is', without any express or implied warranty.
- * In no event will the authors be held liable for any damages arising from the
- * use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- *  1. The origin of this software must not be misrepresented; you must not
- *     claim that you wrote the original software. If you use this software in
- *     a product, an acknowledgment in the product documentation would be
- *     appreciated but is not required.
- *
- *  2. Altered source versions must be plainly marked as such, and must not be
- *     misrepresented as being the original software.
- *
- *  3. This notice may not be removed or altered from any source distribution.
- *****************************************************************************/
-
-
-package net.sourceforge.nanoxml;
-
-
-/**
- * An XMLParseException is thrown when an error occures while parsing an XML
- * string.
- * <P>
- * $Revision: 1.1 $<BR>
- * $Date: 2002/08/03 04:05:32 $<P>
- *
- * @see net.sourceforge.nanoxml.XMLElement
- *
- * @author Marc De Scheemaecker
- * @version $Name:  $, $Revision: 1.1 $
- */
-public class XMLParseException
-    extends RuntimeException
-{
-
-    /**
-     * Indicates that no line number has been associated with this exception.
-     */
-    public static final int NO_LINE = -1;
-
-
-    /**
-     * The line number in the source code where the error occurred, or
-     * <code>NO_LINE</code> if the line number is unknown.
-     *
-     * <dl><dt><b>Invariants:</b></dt><dd>
-     * <ul><li><code>lineNr &gt 0 || lineNr == NO_LINE</code>
-     * </ul></dd></dl>
-     */
-    private int lineNr;
-
-
-    /**
-     * Creates an exception.
-     *
-     * @param name    The name of the element where the error is located.
-     * @param message A message describing what went wrong.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>message != null</code>
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>getLineNr() => NO_LINE
-     * </ul></dd></dl><dl>
-     */
-    public XMLParseException(String name,
-                             String message)
-    {
-        super("XML Parse Exception during parsing of "
-              + ((name == null) ? "the XML definition"
-                                : ("a " + name + " element"))
-              + ": " + message);
-        this.lineNr = XMLParseException.NO_LINE;
-    }
-
-
-    /**
-     * Creates an exception.
-     *
-     * @param name    The name of the element where the error is located.
-     * @param lineNr  The number of the line in the input.
-     * @param message A message describing what went wrong.
-     *
-     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
-     * <ul><li><code>message != null</code>
-     *     <li><code>lineNr &gt; 0</code>
-     * </ul></dd></dl>
-     *
-     * <dl><dt><b>Postconditions:</b></dt><dd>
-     * <ul><li>getLineNr() => lineNr
-     * </ul></dd></dl><dl>
-     */
-    public XMLParseException(String name,
-                             int    lineNr,
-                             String message)
-    {
-        super("XML Parse Exception during parsing of "
-              + ((name == null) ? "the XML definition"
-                                : ("a " + name + " element"))
-              + " at line " + lineNr + ": " + message);
-        this.lineNr = lineNr;
-    }
-
-
-    /**
-     * Where the error occurred, or <code>NO_LINE</code> if the line number is
-     * unknown.
-     *
-     * @see net.sourceforge.nanoxml.XMLParseException#NO_LINE
-     */
-    public int getLineNr()
-    {
-        return this.lineNr;
-    }
-
-}
--- a/patches/ecj/icedtea.patch	Wed May 27 20:20:48 2009 +0100
+++ b/patches/ecj/icedtea.patch	Thu May 28 10:18:19 2009 +0100
@@ -1,6 +1,6 @@
 diff -Nru openjdk-ecj.orig/corba/make/com/sun/corba/se/Makefile openjdk-ecj/corba/make/com/sun/corba/se/Makefile
---- openjdk-ecj.orig/corba/make/com/sun/corba/se/Makefile	2009-03-20 11:54:59.000000000 +0000
-+++ openjdk-ecj/corba/make/com/sun/corba/se/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/corba/make/com/sun/corba/se/Makefile	2009-03-30 17:13:01.000000000 +0100
++++ openjdk-ecj/corba/make/com/sun/corba/se/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -42,7 +42,7 @@
  # the rmic iiop backend needs some classes that are part of the impl/util
  # package.  These classes use log wrappers, so they must be built after
@@ -12,7 +12,7 @@
  
 diff -Nru openjdk-ecj.orig/corba/make/com/sun/corba/se/org/Makefile openjdk-ecj/corba/make/com/sun/corba/se/org/Makefile
 --- openjdk-ecj.orig/corba/make/com/sun/corba/se/org/Makefile	1970-01-01 01:00:00.000000000 +0100
-+++ openjdk-ecj/corba/make/com/sun/corba/se/org/Makefile	2009-04-16 18:21:48.000000000 +0100
++++ openjdk-ecj/corba/make/com/sun/corba/se/org/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -0,0 +1,38 @@
 +#
 +# Copyright 2001-2005 Sun Microsystems, Inc.  All Rights Reserved.
@@ -53,8 +53,8 @@
 +#
 +include $(BUILDDIR)/common/Classes.gmk
 diff -Nru openjdk-ecj.orig/corba/make/common/Defs.gmk openjdk-ecj/corba/make/common/Defs.gmk
---- openjdk-ecj.orig/corba/make/common/Defs.gmk	2009-03-20 11:54:59.000000000 +0000
-+++ openjdk-ecj/corba/make/common/Defs.gmk	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/corba/make/common/Defs.gmk	2009-03-30 17:13:01.000000000 +0100
++++ openjdk-ecj/corba/make/common/Defs.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -53,6 +53,13 @@
  
  _OUTPUTDIR=$(TOPDIR)/build/$(PLATFORM)-$(ARCH)
@@ -88,8 +88,8 @@
  vpath %.java $(VPATH.java)
  vpath %.class $(CLASSBINDIR)
 diff -Nru openjdk-ecj.orig/corba/make/common/Defs-linux.gmk openjdk-ecj/corba/make/common/Defs-linux.gmk
---- openjdk-ecj.orig/corba/make/common/Defs-linux.gmk	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/corba/make/common/Defs-linux.gmk	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/corba/make/common/Defs-linux.gmk	2009-05-28 03:44:57.000000000 +0100
++++ openjdk-ecj/corba/make/common/Defs-linux.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -276,7 +276,7 @@
  		    fi; \
  		  done)
@@ -100,8 +100,8 @@
  #
  # We want to privatize JVM symbols on Solaris. This is so the user can
 diff -Nru openjdk-ecj.orig/corba/make/common/Rules.gmk openjdk-ecj/corba/make/common/Rules.gmk
---- openjdk-ecj.orig/corba/make/common/Rules.gmk	2009-04-14 15:55:17.000000000 +0100
-+++ openjdk-ecj/corba/make/common/Rules.gmk	2009-04-16 18:35:11.000000000 +0100
+--- openjdk-ecj.orig/corba/make/common/Rules.gmk	2009-03-30 23:07:09.000000000 +0100
++++ openjdk-ecj/corba/make/common/Rules.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -201,8 +201,10 @@
  	  $(ECHO) "# Java sources to be compiled: (listed in file $(JAVA_SOURCE_LIST))"; \
  	  $(CAT) $(JAVA_SOURCE_LIST); \
@@ -116,8 +116,8 @@
  	@$(java-vm-cleanup)
  
 diff -Nru openjdk-ecj.orig/corba/make/common/shared/Defs-java.gmk openjdk-ecj/corba/make/common/shared/Defs-java.gmk
---- openjdk-ecj.orig/corba/make/common/shared/Defs-java.gmk	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/corba/make/common/shared/Defs-java.gmk	2009-04-16 18:32:43.000000000 +0100
+--- openjdk-ecj.orig/corba/make/common/shared/Defs-java.gmk	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/corba/make/common/shared/Defs-java.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -113,31 +113,14 @@
  JAVACFLAGS  += $(OTHER_JAVACFLAGS)
  
@@ -157,8 +157,8 @@
  # Override of what javac to use (see deploy workspace)
  ifdef JAVAC
 diff -Nru openjdk-ecj.orig/corba/make/org/omg/sources/Makefile openjdk-ecj/corba/make/org/omg/sources/Makefile
---- openjdk-ecj.orig/corba/make/org/omg/sources/Makefile	2009-03-20 11:54:59.000000000 +0000
-+++ openjdk-ecj/corba/make/org/omg/sources/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/corba/make/org/omg/sources/Makefile	2009-03-30 17:13:01.000000000 +0100
++++ openjdk-ecj/corba/make/org/omg/sources/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -93,8 +93,6 @@
  POAHELHOLFILES =    $(POA_GENERATED_HELP_HOL_java:%=$(GENSRCDIR)/%)
  
@@ -236,8 +236,8 @@
  pi.compile: $(PIGENERATEDFILES)
  
 diff -Nru openjdk-ecj.orig/corba/make/sun/rmi/corbalogsources/Makefile openjdk-ecj/corba/make/sun/rmi/corbalogsources/Makefile
---- openjdk-ecj.orig/corba/make/sun/rmi/corbalogsources/Makefile	2009-04-14 15:55:18.000000000 +0100
-+++ openjdk-ecj/corba/make/sun/rmi/corbalogsources/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/corba/make/sun/rmi/corbalogsources/Makefile	2009-03-30 23:07:09.000000000 +0100
++++ openjdk-ecj/corba/make/sun/rmi/corbalogsources/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -172,7 +172,6 @@
  ACTIVATIONFILES = $(com_sun_corba_se_spi_activation_java:%=$(GENSRCDIR)/%)
  
@@ -255,8 +255,8 @@
  portableactivation.idl.compile: $(PORTABLEACTIVATIONFILES)
  
 diff -Nru openjdk-ecj.orig/jaxp/make/build.xml openjdk-ecj/jaxp/make/build.xml
---- openjdk-ecj.orig/jaxp/make/build.xml	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jaxp/make/build.xml	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jaxp/make/build.xml	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jaxp/make/build.xml	2009-05-28 09:03:57.000000000 +0100
 @@ -71,7 +71,10 @@
        <mkdir dir="${build.toolclasses.dir}"/>
        <javac srcdir="${make.tools.dir}/StripProperties"
@@ -279,8 +279,8 @@
           <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
           <compilerarg line="${javac.version.opt}"/>
 diff -Nru openjdk-ecj.orig/jaxp/make/Makefile openjdk-ecj/jaxp/make/Makefile
---- openjdk-ecj.orig/jaxp/make/Makefile	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jaxp/make/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jaxp/make/Makefile	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jaxp/make/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -75,7 +75,7 @@
  endif
  
@@ -291,8 +291,8 @@
  
  ifdef ALT_OUTPUTDIR
 diff -Nru openjdk-ecj.orig/jaxws/make/build.properties openjdk-ecj/jaxws/make/build.properties
---- openjdk-ecj.orig/jaxws/make/build.properties	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jaxws/make/build.properties	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jaxws/make/build.properties	2009-05-28 03:44:57.000000000 +0100
++++ openjdk-ecj/jaxws/make/build.properties	2009-05-28 09:03:57.000000000 +0100
 @@ -37,7 +37,7 @@
  # set the following to -version to verify the versions of javac being used
  javac.version.opt = 
@@ -303,9 +303,9 @@
  # JVM memory size
  javac.memoryInitialSize = 128m
 diff -Nru openjdk-ecj.orig/jaxws/make/build.xml openjdk-ecj/jaxws/make/build.xml
---- openjdk-ecj.orig/jaxws/make/build.xml	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jaxws/make/build.xml	2009-04-16 18:21:48.000000000 +0100
-@@ -84,7 +84,10 @@
+--- openjdk-ecj.orig/jaxws/make/build.xml	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jaxws/make/build.xml	2009-05-28 09:05:20.000000000 +0100
+@@ -93,7 +93,10 @@
        <mkdir dir="${build.toolclasses.dir}"/>
        <javac srcdir="${make.tools.dir}/StripProperties"
  		destdir="${build.toolclasses.dir}/"
@@ -317,7 +317,7 @@
        <taskdef name="pstrip"
  		 classname="StripPropertiesTask"
  		 classpath="${build.toolclasses.dir}/"/>
-@@ -96,12 +99,14 @@
+@@ -105,11 +108,14 @@
        <javac fork="true"
               srcdir="${src.classes.dir}"
               destdir="${build.classes.dir}"
@@ -327,7 +327,6 @@
               target="${javac.target}"
  	     debug="${javac.debug}"
 -             excludes="com/sun/tools/internal/txw2/**">
--	 <compilerarg line="-bootclasspath ${build.dir}/../../jaxp/build/classes:${build.classes.dir}:../../../generated:${plugs}/jre/lib/tools.jar:${plugs}/jre/lib/rt-closed.jar"/>
 +             excludes="com/sun/tools/internal/txw2/**"
 + 	     source="1.5">
 +	 <compilerarg line="-bootclasspath ${build.dir}/../../jaxp/build/classes:${build.classes.dir}:../../../generated:${boot.java.home}/jre/lib/tools.jar:${boot.java.home}/jre/lib/rt.jar:${boot.java.home}/jre/lib/rt-system.jar"/>
@@ -335,8 +334,8 @@
           <compilerarg line="${javac.version.opt}"/>
           <compilerarg line="${javac.no.jdk.warnings}"/>
 diff -Nru openjdk-ecj.orig/jaxws/make/Makefile openjdk-ecj/jaxws/make/Makefile
---- openjdk-ecj.orig/jaxws/make/Makefile	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jaxws/make/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jaxws/make/Makefile	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jaxws/make/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -75,8 +75,8 @@
  endif
  
@@ -349,8 +348,8 @@
  
  ifdef ALT_OUTPUTDIR
 diff -Nru openjdk-ecj.orig/jdk/make/common/BuildToolJar.gmk openjdk-ecj/jdk/make/common/BuildToolJar.gmk
---- openjdk-ecj.orig/jdk/make/common/BuildToolJar.gmk	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/common/BuildToolJar.gmk	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/common/BuildToolJar.gmk	2009-03-30 17:23:03.000000000 +0100
++++ openjdk-ecj/jdk/make/common/BuildToolJar.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -43,7 +43,8 @@
  	@$(prep-target)
  	@$(MKDIR) -p $(BUILDTOOLCLASSDIR)
@@ -362,9 +361,9 @@
  	    -C $(BUILDTOOLCLASSDIR) $(PKGDIR) \
  	    $(BOOT_JAR_JFLAGS) || $(RM) $@
 diff -Nru openjdk-ecj.orig/jdk/make/common/Release.gmk openjdk-ecj/jdk/make/common/Release.gmk
---- openjdk-ecj.orig/jdk/make/common/Release.gmk	2009-04-16 15:16:31.000000000 +0100
-+++ openjdk-ecj/jdk/make/common/Release.gmk	2009-04-16 18:21:48.000000000 +0100
-@@ -651,10 +651,23 @@
+--- openjdk-ecj.orig/jdk/make/common/Release.gmk	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jdk/make/common/Release.gmk	2009-05-28 09:03:57.000000000 +0100
+@@ -654,10 +654,23 @@
  $(RES_JAR_ARGLIST): $(RES_JAR_FILELIST)
  	$(prep-target)
  	$(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@
@@ -390,7 +389,7 @@
  	@$(java-vm-cleanup)
  
  # Create jsse.jar containing SunJSSE implementation classes
-@@ -710,10 +723,18 @@
+@@ -713,10 +726,18 @@
  $(RT_JAR_ARGLIST): $(RT_JAR_FILELIST)
  	$(prep-target)
  	$(SED) -e "s@^@-C $(CLASSBINDIR) @" $< > $@
@@ -411,7 +410,7 @@
  	@$(java-vm-cleanup)
  
  # Meta-index construction to make core class loaders lazier
-@@ -944,19 +965,6 @@
+@@ -947,19 +968,6 @@
  	@$(java-vm-cleanup)
  	$(CP) $(LIBDIR)/tools.jar $(JDK_IMAGE_DIR)/lib/tools.jar
  	@#
@@ -431,7 +430,7 @@
  	@# CORBA supported orb.idl and ir.idl should be copied to lib
  	@#
  	$(CP) $(LIBDIR)/orb.idl $(JDK_IMAGE_DIR)/lib/orb.idl
-@@ -1033,16 +1041,6 @@
+@@ -1036,16 +1044,6 @@
  	$(CP) $(PLATFORM_SRC)/bin/java_md.h $(JDK_IMAGE_DIR)/src/launcher
  	$(CD) $(JDK_IMAGE_DIR)/src && $(ZIPEXE) -qr ../src.zip *
  	$(RM) -r $(JDK_IMAGE_DIR)/src
@@ -449,8 +448,8 @@
  	$(call copy-man-pages,$(JDK_IMAGE_DIR),$(JDK_MAN_PAGES))
  endif # !windows
 diff -Nru openjdk-ecj.orig/jdk/make/common/Rules.gmk openjdk-ecj/jdk/make/common/Rules.gmk
---- openjdk-ecj.orig/jdk/make/common/Rules.gmk	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/common/Rules.gmk	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/common/Rules.gmk	2009-03-30 17:23:03.000000000 +0100
++++ openjdk-ecj/jdk/make/common/Rules.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -237,8 +237,9 @@
  	  $(ECHO) "# Java sources to be compiled: (listed in file $<)"; \
  	  $(CAT) $<.filtered; \
@@ -477,8 +476,8 @@
  	@$(TOUCH) $@
  
 diff -Nru openjdk-ecj.orig/jdk/make/common/shared/Defs-java.gmk openjdk-ecj/jdk/make/common/shared/Defs-java.gmk
---- openjdk-ecj.orig/jdk/make/common/shared/Defs-java.gmk	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jdk/make/common/shared/Defs-java.gmk	2009-04-16 18:28:27.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/common/shared/Defs-java.gmk	2009-05-28 03:44:57.000000000 +0100
++++ openjdk-ecj/jdk/make/common/shared/Defs-java.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -129,33 +129,22 @@
  JAVACFLAGS  += $(OTHER_JAVACFLAGS)
  
@@ -515,8 +514,8 @@
  
  # Override of what javac to use (see deploy workspace)
 diff -Nru openjdk-ecj.orig/jdk/make/java/nio/Makefile openjdk-ecj/jdk/make/java/nio/Makefile
---- openjdk-ecj.orig/jdk/make/java/nio/Makefile	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/jdk/make/java/nio/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/java/nio/Makefile	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jdk/make/java/nio/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -31,7 +31,7 @@
  PACKAGE = java.nio
  LIBRARY = nio
@@ -527,9 +526,9 @@
  
  NIO_SRC = $(SHARE_SRC)/classes/java/nio
 diff -Nru openjdk-ecj.orig/jdk/make/java/text/Makefile openjdk-ecj/jdk/make/java/text/Makefile
---- openjdk-ecj.orig/jdk/make/java/text/Makefile	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/java/text/Makefile	2009-04-16 18:21:48.000000000 +0100
-@@ -80,8 +80,8 @@
+--- openjdk-ecj.orig/jdk/make/java/text/Makefile	2009-05-08 16:10:43.000000000 +0100
++++ openjdk-ecj/jdk/make/java/text/Makefile	2009-05-28 09:03:57.000000000 +0100
+@@ -81,8 +81,8 @@
  		-sourcepath $(TEXT_SRCDIR) \
  		$(TEXT_SOURCES)
  	$(MKDIR) -p  $(TEXT_CLASSDIR)
@@ -541,8 +540,8 @@
  		-spec $(UNICODEDATA)/UnicodeData.txt
  	@$(java-vm-cleanup)
 diff -Nru openjdk-ecj.orig/jdk/make/Makefile openjdk-ecj/jdk/make/Makefile
---- openjdk-ecj.orig/jdk/make/Makefile	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/Makefile	2009-05-08 16:10:43.000000000 +0100
++++ openjdk-ecj/jdk/make/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -239,7 +239,7 @@
  
  all build:: sanity-all post-sanity-all
@@ -553,18 +552,18 @@
  	$(SUBDIRS-loop)
  
 diff -Nru openjdk-ecj.orig/jdk/make/sun/awt/FILES_export_unix.gmk openjdk-ecj/jdk/make/sun/awt/FILES_export_unix.gmk
---- openjdk-ecj.orig/jdk/make/sun/awt/FILES_export_unix.gmk	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/sun/awt/FILES_export_unix.gmk	2009-04-16 18:21:48.000000000 +0100
-@@ -188,3 +188,5 @@
+--- openjdk-ecj.orig/jdk/make/sun/awt/FILES_export_unix.gmk	2009-05-08 16:10:44.000000000 +0100
++++ openjdk-ecj/jdk/make/sun/awt/FILES_export_unix.gmk	2009-05-28 09:03:57.000000000 +0100
+@@ -189,3 +189,5 @@
  	java/awt/dnd/DnDConstants.java \
  	sun/awt/CausedFocusEvent.java
  
 +EXPORTED_inner = \
 +    sun.java2d.opengl.OGLContext$$OGLContextCaps
 diff -Nru openjdk-ecj.orig/jdk/make/sun/awt/Makefile openjdk-ecj/jdk/make/sun/awt/Makefile
---- openjdk-ecj.orig/jdk/make/sun/awt/Makefile	2009-04-14 15:55:52.000000000 +0100
-+++ openjdk-ecj/jdk/make/sun/awt/Makefile	2009-04-16 18:21:48.000000000 +0100
-@@ -400,10 +400,9 @@
+--- openjdk-ecj.orig/jdk/make/sun/awt/Makefile	2009-05-08 16:10:44.000000000 +0100
++++ openjdk-ecj/jdk/make/sun/awt/Makefile	2009-05-28 09:03:57.000000000 +0100
+@@ -401,10 +401,9 @@
  COMPILEFONTCONFIG_JARFILE = $(BUILDTOOLJARDIR)/compilefontconfig.jar
  
  $(LIBDIR)/%.bfc: $(FONTCONFIGS_SRC)/$(FONTCONFIGS_SRC_PREFIX)%.properties \
@@ -579,8 +578,8 @@
  
  fontconfigs.clean :
 diff -Nru openjdk-ecj.orig/jdk/make/sun/javazic/Makefile openjdk-ecj/jdk/make/sun/javazic/Makefile
---- openjdk-ecj.orig/jdk/make/sun/javazic/Makefile	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/sun/javazic/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/sun/javazic/Makefile	2009-03-30 17:23:03.000000000 +0100
++++ openjdk-ecj/jdk/make/sun/javazic/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -62,7 +62,8 @@
  $(WORKDIR)/$(MAPFILE): $(BUILDTOOLJARDIR)/javazic.jar $(TZFILES)
  	$(RM) -r $(@D)
@@ -592,8 +591,8 @@
  
  $(INSTALLDIR)/$(MAPFILE): $(WORKDIR)/$(MAPFILE)
 diff -Nru openjdk-ecj.orig/jdk/make/sun/text/Makefile openjdk-ecj/jdk/make/sun/text/Makefile
---- openjdk-ecj.orig/jdk/make/sun/text/Makefile	2009-03-20 11:58:37.000000000 +0000
-+++ openjdk-ecj/jdk/make/sun/text/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/sun/text/Makefile	2009-03-30 17:23:03.000000000 +0100
++++ openjdk-ecj/jdk/make/sun/text/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -85,8 +85,9 @@
  	$(BOOT_JAVAC_CMD) -d $(TEXT_CLASSES) \
  		-sourcepath $(TEXT_SRCDIR) \
@@ -607,9 +606,9 @@
  		-spec $(UNICODEDATA)/UnicodeData.txt \
  		-language th
 diff -Nru openjdk-ecj.orig/jdk/make/sun/xawt/Makefile openjdk-ecj/jdk/make/sun/xawt/Makefile
---- openjdk-ecj.orig/jdk/make/sun/xawt/Makefile	2009-04-16 15:16:31.000000000 +0100
-+++ openjdk-ecj/jdk/make/sun/xawt/Makefile	2009-04-16 18:21:48.000000000 +0100
-@@ -276,11 +276,7 @@
+--- openjdk-ecj.orig/jdk/make/sun/xawt/Makefile	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/jdk/make/sun/xawt/Makefile	2009-05-28 09:03:57.000000000 +0100
+@@ -294,11 +294,7 @@
  
  TEMPDIR_CLASSES = $(TEMPDIR)/classes
  
@@ -622,7 +621,7 @@
  	$(prep-target)
  	for i in $(ICONS); do \
              filename=`basename $$i`; \
-@@ -290,20 +286,14 @@
+@@ -308,20 +304,14 @@
  	    $(ECHO) "package sun.awt.X11;" >> $$classname ; \
  	    $(ECHO) "public class XAWTIcon32_$$name {" >> $$classname; \
  	    $(ECHO) "public static int[] $$name = { " >> $$classname;  \
@@ -646,8 +645,8 @@
  	done
  	$(TOUCH) $@
 diff -Nru openjdk-ecj.orig/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java openjdk-ecj/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java
---- openjdk-ecj.orig/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	2009-04-16 15:15:29.000000000 +0100
-+++ openjdk-ecj/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	2009-05-28 03:44:01.000000000 +0100
++++ openjdk-ecj/jdk/make/tools/src/build/tools/generatecharacter/GenerateCharacter.java	2009-05-28 09:03:57.000000000 +0100
 @@ -647,9 +647,6 @@
              throws FileNotFoundException, IOException {
          BufferedReader in = new BufferedReader(new FileReader(theTemplateFileName));
@@ -667,8 +666,8 @@
                  if (plane == 0 && bLatin1 == false) {
              genCaseMapTableDeclaration(result);
 diff -Nru openjdk-ecj.orig/jdk/src/share/classes/java/lang/Double.java openjdk-ecj/jdk/src/share/classes/java/lang/Double.java
---- openjdk-ecj.orig/jdk/src/share/classes/java/lang/Double.java	2009-04-16 15:15:12.000000000 +0100
-+++ openjdk-ecj/jdk/src/share/classes/java/lang/Double.java	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/src/share/classes/java/lang/Double.java	2009-05-28 03:43:50.000000000 +0100
++++ openjdk-ecj/jdk/src/share/classes/java/lang/Double.java	2009-05-28 09:03:57.000000000 +0100
 @@ -76,7 +76,7 @@
       * {@code 0x1.fffffffffffffP+1023} and also equal to
       * {@code Double.longBitsToDouble(0x7fefffffffffffffL)}.
@@ -697,8 +696,8 @@
      /**
       * Maximum exponent a finite {@code double} variable may have.
 diff -Nru openjdk-ecj.orig/jdk/src/share/classes/java/lang/Float.java openjdk-ecj/jdk/src/share/classes/java/lang/Float.java
---- openjdk-ecj.orig/jdk/src/share/classes/java/lang/Float.java	2009-04-16 15:15:12.000000000 +0100
-+++ openjdk-ecj/jdk/src/share/classes/java/lang/Float.java	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/src/share/classes/java/lang/Float.java	2009-05-28 03:43:50.000000000 +0100
++++ openjdk-ecj/jdk/src/share/classes/java/lang/Float.java	2009-05-28 09:03:57.000000000 +0100
 @@ -76,7 +76,7 @@
       * {@code 0x1.fffffeP+127f} and also equal to
       * {@code Float.intBitsToFloat(0x7f7fffff)}.
@@ -727,8 +726,8 @@
      /**
       * Maximum exponent a finite {@code float} variable may have.  It
 diff -Nru openjdk-ecj.orig/jdk/src/share/native/sun/java2d/opengl/OGLContext.h openjdk-ecj/jdk/src/share/native/sun/java2d/opengl/OGLContext.h
---- openjdk-ecj.orig/jdk/src/share/native/sun/java2d/opengl/OGLContext.h	2009-03-20 11:58:43.000000000 +0000
-+++ openjdk-ecj/jdk/src/share/native/sun/java2d/opengl/OGLContext.h	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/jdk/src/share/native/sun/java2d/opengl/OGLContext.h	2009-03-30 17:23:07.000000000 +0100
++++ openjdk-ecj/jdk/src/share/native/sun/java2d/opengl/OGLContext.h	2009-05-28 09:03:57.000000000 +0100
 @@ -27,6 +27,7 @@
  #define OGLContext_h_Included
  
@@ -794,8 +793,8 @@
  /**
   * Evaluates to true if the given capability bitmask is present for the
 diff -Nru openjdk-ecj.orig/langtools/make/build.xml openjdk-ecj/langtools/make/build.xml
---- openjdk-ecj.orig/langtools/make/build.xml	2009-03-20 11:58:59.000000000 +0000
-+++ openjdk-ecj/langtools/make/build.xml	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/langtools/make/build.xml	2009-03-30 17:23:27.000000000 +0100
++++ openjdk-ecj/langtools/make/build.xml	2009-05-28 09:03:57.000000000 +0100
 @@ -502,7 +502,9 @@
                         includes="@{includes}"
                         sourcepath=""
@@ -829,8 +828,8 @@
                   classname="CompilePropertiesTask" 
                   classpath="${build.toolclasses.dir}/"/>
 diff -Nru openjdk-ecj.orig/langtools/make/Makefile openjdk-ecj/langtools/make/Makefile
---- openjdk-ecj.orig/langtools/make/Makefile	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/langtools/make/Makefile	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/langtools/make/Makefile	2009-05-28 03:45:02.000000000 +0100
++++ openjdk-ecj/langtools/make/Makefile	2009-05-28 09:03:57.000000000 +0100
 @@ -112,7 +112,7 @@
  
  ifdef ALT_BOOTDIR
@@ -841,8 +840,8 @@
  
  ifdef ALT_OUTPUTDIR
 diff -Nru openjdk-ecj.orig/make/jdk-rules.gmk openjdk-ecj/make/jdk-rules.gmk
---- openjdk-ecj.orig/make/jdk-rules.gmk	2009-04-16 15:16:30.000000000 +0100
-+++ openjdk-ecj/make/jdk-rules.gmk	2009-04-16 18:21:48.000000000 +0100
+--- openjdk-ecj.orig/make/jdk-rules.gmk	2009-05-28 03:44:57.000000000 +0100
++++ openjdk-ecj/make/jdk-rules.gmk	2009-05-28 09:03:57.000000000 +0100
 @@ -58,7 +58,7 @@
  endif
  
--- a/patches/icedtea-ant.patch	Wed May 27 20:20:48 2009 +0100
+++ b/patches/icedtea-ant.patch	Thu May 28 10:18:19 2009 +0100
@@ -21,17 +21,6 @@
  endif
  
  # Default target and expected 'do everything' target
-diff -Nru openjdk.orig/jaxws/make/build.xml openjdk/jaxws/make/build.xml
---- openjdk.orig/jaxws/make/build.xml	2008-09-25 08:41:11.000000000 +0100
-+++ openjdk/jaxws/make/build.xml	2008-09-26 20:58:44.000000000 +0100
-@@ -100,6 +100,7 @@
-              memoryMaximumSize="${javac.memoryMaximumSize}"
-              target="${javac.target}"
-              excludes="com/sun/tools/internal/txw2/**">
-+	 <compilerarg line="-bootclasspath ${build.dir}/../../jaxp/build/classes:${build.classes.dir}:../../../generated:${plugs}/jre/lib/tools.jar:${plugs}/jre/lib/rt-closed.jar"/>
-          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
-          <compilerarg line="${javac.version.opt}"/>
-          <compilerarg line="${javac.no.jdk.warnings}"/>
 diff -Nru openjdk.orig/jaxws/make/Makefile openjdk/jaxws/make/Makefile
 --- openjdk.orig/jaxws/make/Makefile	2008-09-25 08:41:11.000000000 +0100
 +++ openjdk/jaxws/make/Makefile	2008-09-26 20:58:44.000000000 +0100
--- a/patches/icedtea-javac-debuginfo.patch	Wed May 27 20:20:48 2009 +0100
+++ b/patches/icedtea-javac-debuginfo.patch	Thu May 28 10:18:19 2009 +0100
@@ -1,6 +1,6 @@
 diff -Nru openjdk.orig/corba/make/common/shared/Defs-java.gmk openjdk/corba/make/common/shared/Defs-java.gmk
---- openjdk.orig/corba/make/common/shared/Defs-java.gmk	2008-10-20 18:06:13.000000000 +0100
-+++ openjdk/corba/make/common/shared/Defs-java.gmk	2008-10-20 18:07:05.000000000 +0100
+--- openjdk.orig/corba/make/common/shared/Defs-java.gmk	2009-03-30 23:07:09.000000000 +0100
++++ openjdk/corba/make/common/shared/Defs-java.gmk	2009-05-28 03:37:15.000000000 +0100
 @@ -91,15 +91,8 @@
  #  -- Use JAVAC_CMD if you want to take the defaults given to you.
  #
@@ -20,8 +20,8 @@
    JAVACFLAGS  += -Werror
  endif
 diff -Nru openjdk.orig/jaxp/make/build.xml openjdk/jaxp/make/build.xml
---- openjdk.orig/jaxp/make/build.xml	2008-10-20 18:41:39.000000000 +0100
-+++ openjdk/jaxp/make/build.xml	2008-10-20 18:42:12.000000000 +0100
+--- openjdk.orig/jaxp/make/build.xml	2009-03-30 17:16:08.000000000 +0100
++++ openjdk/jaxp/make/build.xml	2009-05-28 03:37:15.000000000 +0100
 @@ -85,7 +85,8 @@
               destdir="${build.classes.dir}"
               memoryInitialSize="${javac.memoryInitialSize}"
@@ -33,8 +33,8 @@
           <compilerarg line="${javac.version.opt}"/>
        </javac>
 diff -Nru openjdk.orig/jaxp/make/Makefile openjdk/jaxp/make/Makefile
---- openjdk.orig/jaxp/make/Makefile	2008-10-20 17:58:09.000000000 +0100
-+++ openjdk/jaxp/make/Makefile	2008-10-20 17:59:19.000000000 +0100
+--- openjdk.orig/jaxp/make/Makefile	2009-05-28 03:31:22.000000000 +0100
++++ openjdk/jaxp/make/Makefile	2009-05-28 03:37:15.000000000 +0100
 @@ -61,13 +61,8 @@
    endif
  endif
@@ -52,19 +52,19 @@
  # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
  # and the somewhat misnamed CLASS_VERSION (-target NN)
 diff -Nru openjdk.orig/jaxws/make/build.xml openjdk/jaxws/make/build.xml
---- openjdk.orig/jaxws/make/build.xml	2008-10-20 18:41:44.000000000 +0100
-+++ openjdk/jaxws/make/build.xml	2008-10-20 18:42:46.000000000 +0100
-@@ -99,6 +99,7 @@
+--- openjdk.orig/jaxws/make/build.xml	2009-05-08 17:49:56.000000000 +0100
++++ openjdk/jaxws/make/build.xml	2009-05-28 03:37:15.000000000 +0100
+@@ -108,6 +108,7 @@
               memoryInitialSize="${javac.memoryInitialSize}"
               memoryMaximumSize="${javac.memoryMaximumSize}"
               target="${javac.target}"
 +	     debug="${javac.debug}"
               excludes="com/sun/tools/internal/txw2/**">
- 	 <compilerarg line="-bootclasspath ${build.dir}/../../jaxp/build/classes:${build.classes.dir}:../../../generated:${plugs}/jre/lib/tools.jar:${plugs}/jre/lib/rt-closed.jar"/>
           <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
+          <compilerarg line="${javac.version.opt}"/>
 diff -Nru openjdk.orig/jaxws/make/Makefile openjdk/jaxws/make/Makefile
---- openjdk.orig/jaxws/make/Makefile	2008-10-20 17:58:18.000000000 +0100
-+++ openjdk/jaxws/make/Makefile	2008-10-20 17:59:03.000000000 +0100
+--- openjdk.orig/jaxws/make/Makefile	2009-05-28 03:31:22.000000000 +0100
++++ openjdk/jaxws/make/Makefile	2009-05-28 03:37:15.000000000 +0100
 @@ -61,13 +61,8 @@
    endif
  endif
@@ -82,9 +82,9 @@
  # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
  # and the somewhat misnamed CLASS_VERSION (-target NN)
 diff -Nru openjdk.orig/langtools/make/Makefile openjdk/langtools/make/Makefile
---- openjdk.orig/langtools/make/Makefile	2008-10-20 18:06:46.000000000 +0100
-+++ openjdk/langtools/make/Makefile	2008-10-20 17:59:54.000000000 +0100
-@@ -93,13 +93,8 @@
+--- openjdk.orig/langtools/make/Makefile	2009-05-28 03:31:22.000000000 +0100
++++ openjdk/langtools/make/Makefile	2009-05-28 03:37:15.000000000 +0100
+@@ -97,13 +97,8 @@
    endif
  endif
  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-netx.patch	Thu May 28 10:18:19 2009 +0100
@@ -0,0 +1,126 @@
+diff -Nru openjdk.orig/jdk/make/common/internal/Defs-liveconnect.gmk openjdk/jdk/make/common/internal/Defs-liveconnect.gmk
+--- openjdk.orig/jdk/make/common/internal/Defs-liveconnect.gmk	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/jdk/make/common/internal/Defs-liveconnect.gmk	2009-05-28 03:24:40.000000000 +0100
+@@ -0,0 +1,27 @@
++#
++# Copyright 2009 Red Hat, Inc.  All Rights Reserved.
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# This code is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License version 2 only, as
++# published by the Free Software Foundation.  Red Hat designates this
++# particular file as subject to the "Classpath" exception as provided
++# by Sun in the LICENSE file that accompanied this code.
++#
++# This code is distributed in the hope that it will be useful, but WITHOUT
++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++# version 2 for more details (a copy is included in the LICENSE file that
++# accompanied this code).
++#
++# You should have received a copy of the GNU General Public License version
++# 2 along with this work; if not, write to the Free Software Foundation,
++# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++#
++
++# The specific packages that come from or go to rt.jar and tools.jar
++IMPORT_RT_PACKAGES += \
++     netscape/javascript
++
++IMPORT_TOOLS_PACKAGES +=
++
+diff -Nru openjdk.orig/jdk/make/common/internal/Defs-netx.gmk openjdk/jdk/make/common/internal/Defs-netx.gmk
+--- openjdk.orig/jdk/make/common/internal/Defs-netx.gmk	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/jdk/make/common/internal/Defs-netx.gmk	2009-05-28 00:58:47.000000000 +0100
+@@ -0,0 +1,38 @@
++#
++# Copyright 2009 Red Hat, Inc.  All Rights Reserved.
++# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++#
++# This code is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License version 2 only, as
++# published by the Free Software Foundation.  Red Hat designates this
++# particular file as subject to the "Classpath" exception as provided
++# by Sun in the LICENSE file that accompanied this code.
++#
++# This code is distributed in the hope that it will be useful, but WITHOUT
++# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++# version 2 for more details (a copy is included in the LICENSE file that
++# accompanied this code).
++#
++# You should have received a copy of the GNU General Public License version
++# 2 along with this work; if not, write to the Free Software Foundation,
++# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
++#
++
++# The specific packages that come from or go to rt.jar and tools.jar
++IMPORT_RT_PACKAGES += \
++     net/sourceforge/jnlp \
++     net/sourceforge/jnlp/tools \
++     net/sourceforge/jnlp/runtime \
++     net/sourceforge/jnlp/util \
++     net/sourceforge/jnlp/services \
++     net/sourceforge/jnlp/security \
++     net/sourceforge/jnlp/security/viewer \
++     net/sourceforge/jnlp/cache \
++     net/sourceforge/jnlp/event \
++     net/sourceforge/jnlp/resources \
++     net/sourceforge/nanoxml \
++     javax/jnlp
++
++IMPORT_TOOLS_PACKAGES +=
++
+diff -Nru openjdk.orig/jdk/make/common/internal/ImportComponents.gmk openjdk/jdk/make/common/internal/ImportComponents.gmk
+--- openjdk.orig/jdk/make/common/internal/ImportComponents.gmk	2009-05-28 00:50:28.000000000 +0100
++++ openjdk/jdk/make/common/internal/ImportComponents.gmk	2009-05-28 03:23:51.000000000 +0100
+@@ -46,6 +46,12 @@
+ ifndef JAXWS_DIST
+   include $(BUILDDIR)/common/internal/Defs-jaxws.gmk
+ endif
++ifndef NETX_DIST
++  include $(BUILDDIR)/common/internal/Defs-netx.gmk
++endif
++ifndef LIVECONNECT_DIST
++  include $(BUILDDIR)/common/internal/Defs-liveconnect.gmk
++endif
+ 
+ # Clean up these lists so empty lists are empty
+ IMPORT_TOOLS_PACKAGES := $(strip $(IMPORT_TOOLS_PACKAGES))
+@@ -119,6 +125,7 @@
+ $(call import-one-sources,CORBA_DIST,$1)
+ $(call import-one-sources,JAXP_DIST,$1)
+ $(call import-one-sources,JAXWS_DIST,$1)
++$(call import-one-sources,NETX_DIST,$1)
+ endef
+ 
+ # Import all component docs into directory $1 (optional)
+@@ -157,6 +164,8 @@
+ $(call import-one-classes,CORBA_DIST,$1)
+ $(call import-one-classes,JAXP_DIST,$1)
+ $(call import-one-classes,JAXWS_DIST,$1)
++$(call import-one-classes,NETX_DIST,$1)
++$(call import-one-classes,LIVECONNECT_DIST,$1)
+ endef
+ 
+ # Clean up import files
+diff -Nru openjdk.orig/jdk/make/common/shared/Defs.gmk openjdk/jdk/make/common/shared/Defs.gmk
+--- openjdk.orig/jdk/make/common/shared/Defs.gmk	2009-05-28 01:00:54.000000000 +0100
++++ openjdk/jdk/make/common/shared/Defs.gmk	2009-05-28 03:23:06.000000000 +0100
+@@ -344,6 +344,16 @@
+ else
+   JAXWS_DIST =
+ endif
++ifdef ALT_NETX_DIST
++  NETX_DIST := $(call FullPath,$(ALT_NETX_DIST))
++else
++  NETX_DIST =
++endif
++ifdef ALT_LIVECONNECT_DIST
++  LIVECONNECT_DIST := $(call FullPath,$(ALT_LIVECONNECT_DIST))
++else
++  LIVECONNECT_DIST =
++endif
+ 
+ # HOTSPOT_DOCS_IMPORT_PATH: Path to hotspot docs files to import into the docs generation
+ ifdef ALT_HOTSPOT_DOCS_IMPORT_PATH