changeset 2043:e3cdadcefb93

Merge
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 29 Mar 2010 02:54:20 +0100
parents c20d20b055cc (current diff) e5871a3b65f7 (diff)
children 832b1c20603a
files ChangeLog IcedTeaPlugin.cc Makefile.am patches/ecj/override.patch patches/icedtea-copy-plugs.patch patches/icedtea-liveconnect.patch patches/icedtea-override.patch patches/icedtea-plugin.patch patches/icedtea-webstart-umask.patch patches/icedtea-webstart.patch plugin/icedtea/netscape/javascript/JSException.java plugin/icedtea/netscape/javascript/JSObject.java plugin/icedtea/netscape/javascript/JSObjectCreatePermission.java plugin/icedtea/netscape/javascript/JSProxy.java plugin/icedtea/netscape/javascript/JSRunnable.java plugin/icedtea/netscape/javascript/JSUtil.java plugin/icedtea/sun/applet/AppletSecurityContextManager.java plugin/icedtea/sun/applet/GetMemberPluginCallRequest.java plugin/icedtea/sun/applet/GetWindowPluginCallRequest.java plugin/icedtea/sun/applet/JavaConsole.java plugin/icedtea/sun/applet/PasswordAuthenticationDialog.java plugin/icedtea/sun/applet/PluginAppletSecurityContext.java plugin/icedtea/sun/applet/PluginAppletViewer.java plugin/icedtea/sun/applet/PluginCallRequest.java plugin/icedtea/sun/applet/PluginCallRequestFactory.java plugin/icedtea/sun/applet/PluginClassLoader.java plugin/icedtea/sun/applet/PluginCookieInfoRequest.java plugin/icedtea/sun/applet/PluginCookieManager.java plugin/icedtea/sun/applet/PluginDebug.java plugin/icedtea/sun/applet/PluginException.java plugin/icedtea/sun/applet/PluginMain.java plugin/icedtea/sun/applet/PluginMessageConsumer.java plugin/icedtea/sun/applet/PluginMessageHandlerWorker.java plugin/icedtea/sun/applet/PluginObjectStore.java plugin/icedtea/sun/applet/PluginProxyInfoRequest.java plugin/icedtea/sun/applet/PluginProxySelector.java plugin/icedtea/sun/applet/PluginStreamHandler.java plugin/icedtea/sun/applet/RequestQueue.java plugin/icedtea/sun/applet/TestEnv.java plugin/icedtea/sun/applet/VoidPluginCallRequest.java plugin/icedteanp/IcedTeaNPPlugin.cc plugin/icedteanp/IcedTeaNPPlugin.h rt/com/sun/jmx/snmp/SnmpDataTypeEnums.java rt/com/sun/jmx/snmp/SnmpDefinitions.java rt/com/sun/jmx/snmp/SnmpOid.java rt/com/sun/jmx/snmp/SnmpOidRecord.java rt/com/sun/jmx/snmp/SnmpOidTable.java rt/com/sun/jmx/snmp/SnmpOidTableSupport.java rt/com/sun/jmx/snmp/SnmpParameters.java rt/com/sun/jmx/snmp/SnmpPduPacket.java rt/com/sun/jmx/snmp/SnmpPeer.java rt/com/sun/jmx/snmp/SnmpSession.java rt/com/sun/jmx/snmp/SnmpTimeticks.java rt/com/sun/jmx/snmp/SnmpVarBind.java rt/com/sun/jmx/snmp/SnmpVarBindList.java rt/com/sun/jmx/snmp/daemon/SnmpInformRequest.java rt/com/sun/jmx/snmp/daemon/SnmpSession.java rt/com/sun/media/sound/AbstractPlayer.java rt/com/sun/media/sound/HeadspaceMixer.java rt/com/sun/media/sound/HeadspaceSoundbank.java rt/com/sun/media/sound/MixerClip.java rt/com/sun/media/sound/MixerMidiChannel.java rt/com/sun/media/sound/MixerSequencer.java rt/com/sun/media/sound/MixerSourceLine.java rt/com/sun/media/sound/MixerSynth.java rt/com/sun/media/sound/MixerThread.java rt/com/sun/media/sound/SimpleInputDevice.java rt/com/sun/media/sound/SimpleInputDeviceProvider.java rt/javax/jnlp/BasicService.java rt/javax/jnlp/ClipboardService.java rt/javax/jnlp/DownloadService.java rt/javax/jnlp/DownloadServiceListener.java rt/javax/jnlp/ExtendedService.java rt/javax/jnlp/ExtensionInstallerService.java rt/javax/jnlp/FileContents.java rt/javax/jnlp/FileOpenService.java rt/javax/jnlp/FileSaveService.java rt/javax/jnlp/JNLPRandomAccessFile.java rt/javax/jnlp/PersistenceService.java rt/javax/jnlp/PrintService.java rt/javax/jnlp/ServiceManager.java rt/javax/jnlp/ServiceManagerStub.java rt/javax/jnlp/SingleInstanceListener.java rt/javax/jnlp/SingleInstanceService.java rt/javax/jnlp/UnavailableServiceException.java rt/net/sourceforge/jnlp/AppletDesc.java rt/net/sourceforge/jnlp/ApplicationDesc.java rt/net/sourceforge/jnlp/AssociationDesc.java rt/net/sourceforge/jnlp/ComponentDesc.java rt/net/sourceforge/jnlp/DefaultLaunchHandler.java rt/net/sourceforge/jnlp/ExtensionDesc.java rt/net/sourceforge/jnlp/IconDesc.java rt/net/sourceforge/jnlp/InformationDesc.java rt/net/sourceforge/jnlp/InstallerDesc.java rt/net/sourceforge/jnlp/JARDesc.java rt/net/sourceforge/jnlp/JNLPFile.java rt/net/sourceforge/jnlp/JNLPSplashScreen.java rt/net/sourceforge/jnlp/JREDesc.java rt/net/sourceforge/jnlp/LaunchException.java rt/net/sourceforge/jnlp/LaunchHandler.java rt/net/sourceforge/jnlp/Launcher.java rt/net/sourceforge/jnlp/MenuDesc.java rt/net/sourceforge/jnlp/NetxPanel.java rt/net/sourceforge/jnlp/Node.java rt/net/sourceforge/jnlp/PackageDesc.java rt/net/sourceforge/jnlp/ParseException.java rt/net/sourceforge/jnlp/Parser.java rt/net/sourceforge/jnlp/PluginBridge.java rt/net/sourceforge/jnlp/PropertyDesc.java rt/net/sourceforge/jnlp/RelatedContentDesc.java rt/net/sourceforge/jnlp/ResourcesDesc.java rt/net/sourceforge/jnlp/SecurityDesc.java rt/net/sourceforge/jnlp/ShortcutDesc.java rt/net/sourceforge/jnlp/StreamEater.java rt/net/sourceforge/jnlp/Version.java rt/net/sourceforge/jnlp/cache/CacheEntry.java rt/net/sourceforge/jnlp/cache/CacheUtil.java rt/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java rt/net/sourceforge/jnlp/cache/DownloadIndicator.java rt/net/sourceforge/jnlp/cache/Resource.java rt/net/sourceforge/jnlp/cache/ResourceTracker.java rt/net/sourceforge/jnlp/cache/UpdatePolicy.java rt/net/sourceforge/jnlp/cache/package.html rt/net/sourceforge/jnlp/event/ApplicationEvent.java rt/net/sourceforge/jnlp/event/ApplicationListener.java rt/net/sourceforge/jnlp/event/DownloadEvent.java rt/net/sourceforge/jnlp/event/DownloadListener.java rt/net/sourceforge/jnlp/event/package.html rt/net/sourceforge/jnlp/package.html rt/net/sourceforge/jnlp/resources/Manifest.mf rt/net/sourceforge/jnlp/resources/Messages.properties rt/net/sourceforge/jnlp/resources/about.jnlp rt/net/sourceforge/jnlp/resources/default.jnlp rt/net/sourceforge/jnlp/resources/info-small.png rt/net/sourceforge/jnlp/resources/install.png rt/net/sourceforge/jnlp/resources/netx-icon.png rt/net/sourceforge/jnlp/resources/warning-small.png rt/net/sourceforge/jnlp/resources/warning.png rt/net/sourceforge/jnlp/runtime/AppThreadGroup.java rt/net/sourceforge/jnlp/runtime/AppletAudioClip.java rt/net/sourceforge/jnlp/runtime/AppletEnvironment.java rt/net/sourceforge/jnlp/runtime/AppletInstance.java rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java rt/net/sourceforge/jnlp/runtime/Boot.java rt/net/sourceforge/jnlp/runtime/Boot13.java rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java rt/net/sourceforge/jnlp/runtime/JNLPPolicy.java rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java rt/net/sourceforge/jnlp/runtime/package.html rt/net/sourceforge/jnlp/security/AccessWarningPane.java rt/net/sourceforge/jnlp/security/AppletWarningPane.java rt/net/sourceforge/jnlp/security/CertVerifier.java rt/net/sourceforge/jnlp/security/CertWarningPane.java rt/net/sourceforge/jnlp/security/CertsInfoPane.java rt/net/sourceforge/jnlp/security/HttpsCertVerifier.java rt/net/sourceforge/jnlp/security/MoreInfoPane.java rt/net/sourceforge/jnlp/security/SecurityDialogUI.java rt/net/sourceforge/jnlp/security/SecurityUtil.java rt/net/sourceforge/jnlp/security/SecurityWarningDialog.java rt/net/sourceforge/jnlp/security/SingleCertInfoPane.java rt/net/sourceforge/jnlp/security/VariableX509TrustManager.java rt/net/sourceforge/jnlp/security/viewer/CertificatePane.java rt/net/sourceforge/jnlp/security/viewer/CertificateViewer.java rt/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java rt/net/sourceforge/jnlp/services/InstanceExistsException.java rt/net/sourceforge/jnlp/services/ServiceUtil.java rt/net/sourceforge/jnlp/services/SingleInstanceLock.java rt/net/sourceforge/jnlp/services/XBasicService.java rt/net/sourceforge/jnlp/services/XClipboardService.java rt/net/sourceforge/jnlp/services/XDownloadService.java rt/net/sourceforge/jnlp/services/XExtendedService.java rt/net/sourceforge/jnlp/services/XExtensionInstallerService.java rt/net/sourceforge/jnlp/services/XFileContents.java rt/net/sourceforge/jnlp/services/XFileOpenService.java rt/net/sourceforge/jnlp/services/XFileSaveService.java rt/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java rt/net/sourceforge/jnlp/services/XPersistenceService.java rt/net/sourceforge/jnlp/services/XPrintService.java rt/net/sourceforge/jnlp/services/XServiceManagerStub.java rt/net/sourceforge/jnlp/services/XSingleInstanceService.java rt/net/sourceforge/jnlp/services/package.html rt/net/sourceforge/jnlp/tools/CharacterEncoder.java rt/net/sourceforge/jnlp/tools/HexDumpEncoder.java rt/net/sourceforge/jnlp/tools/JarRunner.java rt/net/sourceforge/jnlp/tools/JarSigner.java rt/net/sourceforge/jnlp/tools/JarSignerResources.java rt/net/sourceforge/jnlp/tools/KeyStoreUtil.java rt/net/sourceforge/jnlp/tools/KeyTool.java rt/net/sourceforge/jnlp/util/FileUtils.java rt/net/sourceforge/jnlp/util/PropertiesFile.java rt/net/sourceforge/jnlp/util/Reflect.java rt/net/sourceforge/jnlp/util/WeakList.java rt/net/sourceforge/jnlp/util/XDesktopEntry.java rt/net/sourceforge/nanoxml/XMLElement.java rt/net/sourceforge/nanoxml/XMLParseException.java
diffstat 364 files changed, 25303 insertions(+), 40167 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Mar 29 00:25:26 2010 +0100
+++ b/.hgtags	Mon Mar 29 02:54:20 2010 +0100
@@ -17,3 +17,4 @@
 926c38e2b2830971f6ca0dff2ce25f78a694b178 icedtea6-1.5rc3
 9420faca6468e1c75e9bfa73b31246ba0b73a77d icedtea-1.6-branchpoint
 8826d5735e2ca97ecdb35e7c977785d3e5b99556 icedtea-1.7-branchpoint
+9420faca6468e1c75e9bfa73b31246ba0b73a77d icedtea6-1.8-branchpoint
--- a/ChangeLog	Mon Mar 29 00:25:26 2010 +0100
+++ b/ChangeLog	Mon Mar 29 02:54:20 2010 +0100
@@ -4,6 +4,397 @@
 	Remove @Override on interface method
 	in sun/net/www/protocol/https/HttpsClient.java
 
+2010-03-25  Matthias Klose  <doko@ubuntu.com>
+
+	* configure.ac: Bump version to 1.9pre.
+
+2010-03-22  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(start_jvm_if_needed): Change pipe file name format.
+	(NP_Initialize): Put FIFO pipe in a separate per-user directory.
+
+2010-03-19  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	(ICEDTEA_ENV_ECJ): Include ICEDTEA_ENV.
+	Remove duplication between ICEDTEA_ENV
+	and ICEDTEA_ENV_ECJ.
+
+2010-03-19  Deepak Bhole <dbhole@redhat.com>
+
+	* Makefile.am: Change IcedTeaPlugin.o -> IcedTeaNPPlugin.o
+
+2010-03-19  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/cpu/zero/vm/disassembler_zero.hpp
+	(Disassembler::pd_instruction_alignment): Return a usable default.
+	(Disassembler::pd_cpu_opts): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
+	(SharkBlock::do_field_access): Indentation fixes.
+	* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
+	(SharkBuilder::throw_ArithmeticException): New method.
+	(SharkBuilder::throw_ClassCastException): Likewise.
+	(SharkBuilder::frame_address): Likewise.
+	(SharkBuilder::CreateGetFrameAddress): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
+	(SharkBuilder::throw_ArithmeticException): New method.
+	(SharkBuilder::throw_ClassCastException): Likewise.
+	(SharkBuilder::frame_address): Likewise.
+	(SharkBuilder::CreateGetFrameAddress): Likewise.
+	(SharkBuilder::CreateMemoryBarrier): Actually do something on x86.
+	* ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp
+	(SharkNativeWrapper::initialize): Implemented UseMembar code.
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
+	(SharkRuntime::throw_ArithmeticException): New method.
+	(SharkRuntime::throw_ClassCastException): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
+	(SharkRuntime::throw_ArithmeticException): New method.
+	(SharkRuntime::throw_ClassCastException): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkStack.hpp
+	(SharkStack::initialize): Added setup_sp_and_method parameter.
+	(SharkStack::CreateStackOverflowCheck): New method.
+	(SharkStack::CreateCheckStack): Likewise.
+	(SharkStack::interpreter_entry_point): Likewise.
+	(SharkStackWithNormalFrame::interpreter_entry_point): Likewise.
+	(SharkStackWithNativeFrame::interpreter_entry_point): Likewise.
+	(SharkStack::CreateHardStackOverflowCheck): Removed.
+	(SharkStack::CreateSoftStackOverflowCheck): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkStack.cpp
+	(SharkStack::initialize): Added setup_sp_and_method parameter,
+	and changed to use new stack overflow detection code.
+	(SharkStack::CreateStackOverflowCheck): New method.
+	(SharkStack::CreateCheckStack): Likewise.
+	(SharkStack::CreateHardStackOverflowCheck): Removed.
+	(SharkStack::CreateSoftStackOverflowCheck): Likewise.
+	(SharkStackWithNormalFrame::interpreter_entry_point): Likewise.
+	(SharkStackWithNativeFrame::interpreter_entry_point): Likewise.
+	(SharkStackWithNormalFrame::SharkStackWithNormalFrame): Updated.
+	(SharkStackWithNativeFrame::SharkStackWithNativeFrame): Likewise.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
+	(SharkTopLevelBlock::static_field_ok_in_clinit): New method.
+	* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
+	(SharkTopLevelBlock::scan_for_traps): New trap.
+	(SharkTopLevelBlock::static_field_ok_in_clinit): New method.
+	(SharkTopLevelBlock::zero_check_value): Throw arithmetic exception
+	for divide by zero.
+	(SharkTopLevelBlock::do_full_instance_check): Throw class cast
+	exception.
+	(SharkTopLevelBlock::do_monitorexit): Do not handle exceptions.
+	* ports/hotspot/src/share/vm/shark/shark_globals.hpp:
+	Make debugging options available in product builds.
+
+2010-03-19  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(start_jvm_if_needed): Create pipes in a temporary dir instead of users
+	home directory.
+	(plugin_start_appletviewer): Pass pipe names to PluginMain when initializing Java.
+	* plugin/icedteanp/java/sun/applet/PluginMain.java: Receive pipe names
+	during initialization.
+
+2010-03-19  Deepak Bhole <dbhole@redhat.com>
+
+	* Makefile.am: Updated to use the renamed IcedTeaNPPlugin.cc file.
+	* plugin/icedteanp/IcedTeaJavaRequestProcessor.cc: Updated copyright.
+	* plugin/icedteanp/IcedTeaJavaRequestProcessor.h: Update to include
+	IcedTeaNPPlugin.h instead of IcedTeaPlugin.h. Updated copyright.
+	* plugin/icedteanp/IcedTeaNPPlugin.cc: Renamed from IcedTeaPlugin.cc.
+	Updated copyright.
+	* plugin/icedteanp/IcedTeaNPPlugin.h: Renamed from IcedTeaPlugin.h.
+	Updated copyright.
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc: Updated copyright.
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.h: Update to include
+	IcedTeaNPPlugin.h instead of IcedTeaPlugin.h. Updated copyright.
+	* plugin/icedteanp/IcedTeaPluginUtils.cc: Updated copyright.
+	* plugin/icedteanp/IcedTeaPluginUtils.h: Update to include
+	IcedTeaNPPlugin.h instead of IcedTeaPlugin.h. Updated copyright.
+	* plugin/icedteanp/IcedTeaRunnable.cc: Updated copyright.
+	* plugin/icedteanp/IcedTeaRunnable.h: Update to include
+	IcedTeaNPPlugin.h instead of IcedTeaPlugin.h. Updated copyright.
+	* plugin/icedteanp/IcedTeaScriptablePluginObject.cc: Updated copyright.
+	* plugin/icedteanp/IcedTeaScriptablePluginObject.h: Update to include
+	IcedTeaNPPlugin.h instead of IcedTeaPlugin.h. Updated copyright.
+
+2010-03-19  Pavel Tisnovsky <ptisnovs@redhat.com>
+
+	* patches/icedtea-sh4-support.patch: removed duplicated
+	lines causing warning message when this patch is applied
+
+2010-03-18  Andrew John Hughes  <ahughes@redhat.com>
+
+	* NEWS:
+	Update for 1.8.  List OpenJDK6 b18 features
+	and add further details of plugin/NetX build
+	changes.
+
+2010-03-18  Pavel Tisnovsky <ptisnovs@redhat.com>
+
+	* patches/icedtea-jtreg-httpTest.patch: new regression test
+	to check if the cacerts keytool database is configured and
+	created properly and if SSL is really working.
+
+2010-03-18  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp
+	(CppInterpreter::native_entry): Remove unnecessary calls to
+	JavaThread::set_do_not_unlock and JavaThread::clr_do_not_unlock,
+	fixing an issue that caused asynchronous exceptions to be lost.
+
+2010-03-17  Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
+
+	* acinclude.m4 (IT_SET_ARCH_SETTINGS): Define architecture as sh
+	for all sh* variants.
+	* patches/icedtea-sh4-support.patch: Likewise.
+
+2010-03-17  Matthias Klose  <doko@ubuntu.com>
+
+	* NEWS: Add 1.7.1, update for 1.8.
+
+2010-03-16  Andrew John Hughes  <ahughes@redhat.com>
+
+	* IcedTeaPlugin.cc,
+	* plugin/icedtea/netscape/javascript/JSException.java,
+	* plugin/icedtea/netscape/javascript/JSObject.java,
+	* plugin/icedtea/netscape/javascript/JSObjectCreatePermission.java,
+	* plugin/icedtea/netscape/javascript/JSProxy.java,
+	* plugin/icedtea/netscape/javascript/JSRunnable.java,
+	* plugin/icedtea/netscape/javascript/JSUtil.java,
+	* plugin/icedtea/sun/applet/AppletSecurityContextManager.java,
+	* plugin/icedtea/sun/applet/GetMemberPluginCallRequest.java,
+	* plugin/icedtea/sun/applet/GetWindowPluginCallRequest.java,
+	* plugin/icedtea/sun/applet/JavaConsole.java,
+	* plugin/icedtea/sun/applet/PasswordAuthenticationDialog.java,
+	* plugin/icedtea/sun/applet/PluginAppletSecurityContext.java,
+	* plugin/icedtea/sun/applet/PluginAppletViewer.java,
+	* plugin/icedtea/sun/applet/PluginCallRequest.java,
+	* plugin/icedtea/sun/applet/PluginCallRequestFactory.java,
+	* plugin/icedtea/sun/applet/PluginClassLoader.java,
+	* plugin/icedtea/sun/applet/PluginCookieInfoRequest.java,
+	* plugin/icedtea/sun/applet/PluginCookieManager.java,
+	* plugin/icedtea/sun/applet/PluginDebug.java,
+	* plugin/icedtea/sun/applet/PluginException.java,
+	* plugin/icedtea/sun/applet/PluginMain.java,
+	* plugin/icedtea/sun/applet/PluginMessageConsumer.java,
+	* plugin/icedtea/sun/applet/PluginMessageHandlerWorker.java,
+	* plugin/icedtea/sun/applet/PluginObjectStore.java,
+	* plugin/icedtea/sun/applet/PluginProxyInfoRequest.java,
+	* plugin/icedtea/sun/applet/PluginProxySelector.java,
+	* plugin/icedtea/sun/applet/PluginStreamHandler.java,
+	* plugin/icedtea/sun/applet/RequestQueue.java,
+	* plugin/icedtea/sun/applet/TestEnv.java,
+	* plugin/icedtea/sun/applet/VoidPluginCallRequest.java:
+	Remove old plugin code.
+	* Makefile.am:
+	Drop ENABLE_PLUGIN blocks.  Rename ENABLE_NPPLUGIN
+	to ENABLE_PLUGIN and IcedTeaNPPlugin to IcedTeaPlugin.
+	(LIVECONNECT_DIR): Use just names of directories.
+	(EXTRA_DIST): Drop IcedTeaPlugin.cc.
+	(.PHONY): Drop clean-plugs, ICEDTEANPPLUGIN_CLEAN.
+	(clean-patch): Drop old commands to revert plugin code
+	copying.
+	(icedtea.stamp): Remove old plugin references.  Change NPPlugin
+	references to reference Plugin.
+	(icedtea-debug.stamp): Likewise.
+	(PLUGIN_SRC): Renamed from NPPLUGIN_SRC.
+	(PLUGIN_OBJECTS): Renamed from NPPLUGIN_OBJECTS.
+	($(PLUGIN_DIR)/%.o): Change from NPPLUGIN to PLUGIN.
+	($(PLUGIN_DIR)/IcedTeaPlugin.so): Changed from
+	IcedTeaNPPlugin.
+	(clean-IcedTeaPlugin): Moved from clean-IcedTeaNPPlugin.
+	(IcedTeaPlugin.o): Removed.
+	(IcedTeaPlugin.so): Removed.
+	(clean-IcedTeaPlugin): Removed.
+	(plugin.stamp): Remove old plugin dependency.
+	(clean-plugin): Likewise.
+	(liveconnect.stamp): Use LIVECONNECT_DIR rather than
+	hardcoding directory names.
+	(rt.stamp): Drop LIVECONNECT_DIR.
+	(plugs): Drop dead alias.
+	* acinclude.m4:
+	(IT_CHECK_PLUGIN): Renamed from IT_CHECK_OLD_PLUGIN.
+	(IT_CHECK_NEW_PLUGIN): Removed.
+	(IT_CHECK_PLUGIN_DEPENDENCIES): No longer require
+	IT_CHECK_OLD_PLUGIN and IT_CHECK_NEW_PLUGIN.  Require
+	IT_CHECK_PLUGIN.  Remove enable_npplugin tests as now
+	assumed, being the only plugin.
+	(IT_CHECK_XULRUNNER_VERSION): Drop enable_npplugin test.
+	* plugin/icedteanp/IcedTeaJavaRequestProcessor.h:
+	Fix references to IcedTeaNPPlugin.h.
+	* plugin/icedteanp/IcedTeaPlugin.cc: Renamed from
+	IcedTeaNPPlugin.cc.
+	* plugin/icedteanp/IcedTeaPlugin.h: Renamed from
+	IcedTeaNPPlugin.h.
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc,
+	* plugin/icedteanp/IcedTeaPluginUtils.cc,
+	* plugin/icedteanp/IcedTeaPluginUtils.h,
+	* plugin/icedteanp/IcedTeaScriptablePluginObject.h:
+	Fix references to IcedTeaNPPlugin.h.
+
+2010-03-16  Andrew John Hughes  <ahughes@redhat.com>
+	* patches/icedtea-override.patch:
+	Moved to ecj subdirectory.
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Remove override patch.
+	(ICEDTEA_ECJ_PATCHES): Add override patch in ecj
+	directory.
+	* patches/ecj/override.patch:
+	Apply to ecj tree only.
+
+2010-03-16  Andrew John Hughes  <ahughes@redhat.com>
+
+	NetX/plugin build sync (3/3):
+	* patches/icedtea-copy-plugs.patch:
+	Remove plug-related segments and move
+	remainder to patches/ecj/getannotation-cast.patch
+	* rt/com/sun/jmx/snmp/SnmpDataTypeEnums.java,
+	* rt/com/sun/jmx/snmp/SnmpDefinitions.java,
+	* rt/com/sun/jmx/snmp/SnmpOid.java,
+	* rt/com/sun/jmx/snmp/SnmpOidRecord.java,
+	* rt/com/sun/jmx/snmp/SnmpOidTable.java,
+	* rt/com/sun/jmx/snmp/SnmpOidTableSupport.java,
+	* rt/com/sun/jmx/snmp/SnmpParameters.java,
+	* rt/com/sun/jmx/snmp/SnmpPduPacket.java,
+	* rt/com/sun/jmx/snmp/SnmpPeer.java,
+	* rt/com/sun/jmx/snmp/SnmpSession.java,
+	* rt/com/sun/jmx/snmp/SnmpTimeticks.java,
+	* rt/com/sun/jmx/snmp/SnmpVarBind.java,
+	* rt/com/sun/jmx/snmp/SnmpVarBindList.java,
+	* rt/com/sun/jmx/snmp/daemon/SnmpInformRequest.java,
+	* rt/com/sun/jmx/snmp/daemon/SnmpSession.java,
+	* rt/com/sun/media/sound/AbstractPlayer.java,
+	* rt/com/sun/media/sound/HeadspaceMixer.java,
+	* rt/com/sun/media/sound/HeadspaceSoundbank.java,
+	* rt/com/sun/media/sound/MixerClip.java,
+	* rt/com/sun/media/sound/MixerMidiChannel.java,
+	* rt/com/sun/media/sound/MixerSequencer.java,
+	* rt/com/sun/media/sound/MixerSourceLine.java,
+	* rt/com/sun/media/sound/MixerSynth.java,
+	* rt/com/sun/media/sound/MixerThread.java,
+	* rt/com/sun/media/sound/SimpleInputDevice.java,
+	* rt/com/sun/media/sound/SimpleInputDeviceProvider.java:
+	Remove old plug stubs.
+	* Makefile.am:
+	(ICEDTEA_PLUGS): Removed.
+	(ICEDTEA_BOOTSTRAP_DIRS): Drop com/sun/jmx/snmp/agent.
+	(ICEDTEA_BOOTSTRAP_CLASSES): Add javax/management/StandardMBean.java.
+	(ICEDTEA_PATCHES): Remove copy-plugs.patch.
+	(ICEDTEA_ECJ_PATCHES): Add getannotation-cast.patch.
+	(ICEDTEA_ENV): Drop IMPORT_BINARY_PLUGS.
+	(ICEDTEA_ENV_ECJ): Likewise.
+	(icedtea.stamp): Don't depend on plugs.stamp.
+	(icedtea-debug.stamp): Likewise.
+	(icedtea-ecj.stamp): Likewise.
+	(extra-class-files.stamp): Depend on netx.stamp and
+	use netx.build rather than plugs.
+	(rt-source-files.txt): Don't search $(abs_top_srcdir)/rt.
+	(clean-rt): Revert to system rt.jar.
+	(plugs.stamp): Removed.
+	(clean-plugs): Removed.
+	* patches/ecj/getannotation-cast.patch:
+	Remaining part of copy-plugs.patch which
+	provides a cast for getAnnotation for older versions
+	of GNU Classpath.
+
+2010-03-16  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
+	(newMessageOnBus): Added support for finalize.
+	(finalize): New function. Decrements object reference count by one.
+	(queue_processor): Added support for finalize.
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.h: Removed unused
+	function declerations. Added decleration for finalize.
+
+2010-03-15  Andrew John Hughes  <ahughes@redhat.com>
+
+	NetX/plugin build sync (2/3):
+	Have the OpenJDK build extract the
+	built plugin and NetX code as imports,
+	not binary plugs.  File patches that
+	extend OpenJDK (NetX, plugin, Zero/Shark)
+	under a new subdirectory, extensions.
+	* patches/icedtea-liveconnect.patch:
+	Moved to extensions subdirectory and
+	recreated after application of netx.patch.
+	* patches/icedtea-plugin.patch:
+	Removed, unused.
+	* patches/icedtea-webstart-umask.patch,
+	* patches/icedtea-webstart.patch:
+	Moved to extensions subdirectory.
+	* Makefile.am:
+	(ICEDTEANPPLUGIN_TARGET): Add liveconnect-dist.stamp.
+	(ICEDTEAPLUGIN_TARGET): Likewise.
+	(PLUGIN_PATCH): Removed.
+	(ICEDTEA_PATCHES): Add conditional plugin patches in
+	same manner as all other conditional patches.  Fix
+	paths of NetX patches and add new netx-dist patch.
+	Add liveconnect-dist.patch.
+	(ICEDTEA_ENV): Add ALT_NETX_DIST and ALT_LIVECONNECT_DIST
+	to specify locations of NetX and plugin jar files.
+	(ICEDTEA_ECJ_ENV): Likewise.
+	(stamps/patch.stamp): Remove copying of plugin source files.
+	(stamps/icedtea.stamp): Depend on netx-dist.stamp.
+	(stamps/icedtea-debug.stamp): Likewise.
+	(stamps/icedtea-ecj.stamp): Depend on netx-dist.stamp and
+	plugin.stamp.
+	(stamps/plugin-tests.stamp): Depend on stamps/plugin.stamp,
+	not rt-closed.jar.  Surround by ENABLE_PLUGIN rather than
+	using a (now broken) test on lib/rt/netscape.
+	* patches/extensions/liveconnect-dist.patch:
+	Make the OpenJDK build import the plugin code in the same
+	manner as langtools, CORBA, JAXP and JAXWS.
+	* patches/extensions/liveconnect.patch:
+	Was patches/icedtea-liveconnect.patch.
+	* patches/extensions/netx-dist.patch:
+	Same as liveconnect-dist, but for NetX.
+	* patches/extensions/netx-umask.patch:
+	Renamed from patches/icedtea-webstart-umask.patch.
+	* patches/extensions/netx.patch:
+	Renamed from patches/icedtea-webstart.patch.
+
+2010-03-13  Deepak Bhole <dbhole@redhat.com>
+
+	* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+	(requestPluginCookieInfo): Register cookie info as a priority message.
+	(requestPluginProxyInfo): Register proxy info as a priority message.
+	* plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java: Re-designed
+	message consumption to implement priority queuing and parallel
+	initialization limits so that an arbitrary number of applets can load
+	without blocking one another, all in a thread-safe manner.
+	(registerPriorityWait): New method. Registers a string that is
+	considered a "priority" string, which gets delegated to dedicated worker
+	threads.
+	(unRegisterPriorityWait): Unregisters a string so that it is no longer
+	a priority.
+	(PluginMessageConsumer): Do not create any workers when starting.
+	(consume): Remove method. Consumption is now done in a separate dedicated
+	thread to prevent blocking.
+	(getPriorityStrIfPriority):	New method. If the given message is priority,
+	return why (i.e the 'priority string'it matched).
+	(isInInit): New method. Returns if the plugin is currently initializing an
+	applet.
+	(addToInitWorkers): New method. Adds given worker to list of workers
+	currently initializting applets.
+	(okayToProcess): New method. Returns whether or not it is okay to process
+	the given applet.
+	(notifyWorkerIsFree): New method. Notifies this class that a worker has
+	just become free.
+	(queue): Queues the given message for consumption.
+	(ConsumerThread): New protected inner (thread) class. Responsible for
+	consuming messages in the queue, and regueuing them if consumption if not
+	possible.
+	(getFreeWorker): Changed to be non-blocking, and return either a priority
+	worker or a normal worker depending on what is requested.
+	* plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java
+	(PluginMessageHandlerWorker): Set new priority and consumer variables.
+	(busy): Make thread-safe by waiting on same property that free() waits on.
+	(free): Make thread-safe by waiting on same property that busy() waits on.
+	(isPriority): New method. Returns of worker is a priority worker.
+	(isFree): Made thread-safe, and accounts for priority.
+	* plugin/icedteanp/java/sun/applet/PluginStreamHandler.java
+	(startProcessing): Call consumer.queue() instead of consumer.consume().
+	(postMessage): Remove unused method.
+
 2010-03-12  Andrew John Hughes  <ahughes@redhat.com>
 
 	* patches/icedtea-fonts.patch:
@@ -11,6 +402,297 @@
 	http://hg.openjdk.java.net/jdk6/jdk6/jdk/rev/178f954e1fd1
 	* Makefile.am: Drop above patch.
 
+2010-03-12  Andrew John Hughes  <ahughes@redhat.com>
+
+	NetX/plugin build sync (1/3):
+	Build NetX and plugin sources separately.
+	* rt/javax/jnlp/BasicService.java,
+	* rt/javax/jnlp/ClipboardService.java,
+	* rt/javax/jnlp/DownloadService.java,
+	* rt/javax/jnlp/DownloadServiceListener.java,
+	* rt/javax/jnlp/ExtendedService.java,
+	* rt/javax/jnlp/ExtensionInstallerService.java,
+	* rt/javax/jnlp/FileContents.java,
+	* rt/javax/jnlp/FileOpenService.java,
+	* rt/javax/jnlp/FileSaveService.java,
+	* rt/javax/jnlp/JNLPRandomAccessFile.java,
+	* rt/javax/jnlp/PersistenceService.java,
+	* rt/javax/jnlp/PrintService.java,
+	* rt/javax/jnlp/ServiceManager.java,
+	* rt/javax/jnlp/ServiceManagerStub.java,
+	* rt/javax/jnlp/SingleInstanceListener.java,
+	* rt/javax/jnlp/SingleInstanceService.java,
+	* rt/javax/jnlp/UnavailableServiceException.java,
+	* rt/net/sourceforge/jnlp/AppletDesc.java,
+	* rt/net/sourceforge/jnlp/ApplicationDesc.java,
+	* rt/net/sourceforge/jnlp/AssociationDesc.java,
+	* rt/net/sourceforge/jnlp/ComponentDesc.java,
+	* rt/net/sourceforge/jnlp/DefaultLaunchHandler.java,
+	* rt/net/sourceforge/jnlp/ExtensionDesc.java,
+	* rt/net/sourceforge/jnlp/IconDesc.java,
+	* rt/net/sourceforge/jnlp/InformationDesc.java,
+	* rt/net/sourceforge/jnlp/InstallerDesc.java,
+	* rt/net/sourceforge/jnlp/JARDesc.java,
+	* rt/net/sourceforge/jnlp/JNLPFile.java,
+	* rt/net/sourceforge/jnlp/JNLPSplashScreen.java,
+	* rt/net/sourceforge/jnlp/JREDesc.java,
+	* rt/net/sourceforge/jnlp/LaunchException.java,
+	* rt/net/sourceforge/jnlp/LaunchHandler.java,
+	* rt/net/sourceforge/jnlp/Launcher.java,
+	* rt/net/sourceforge/jnlp/MenuDesc.java,
+	* rt/net/sourceforge/jnlp/NetxPanel.java,
+	* rt/net/sourceforge/jnlp/Node.java,
+	* rt/net/sourceforge/jnlp/PackageDesc.java,
+	* rt/net/sourceforge/jnlp/ParseException.java,
+	* rt/net/sourceforge/jnlp/Parser.java,
+	* rt/net/sourceforge/jnlp/PluginBridge.java,
+	* rt/net/sourceforge/jnlp/PropertyDesc.java,
+	* rt/net/sourceforge/jnlp/RelatedContentDesc.java,
+	* rt/net/sourceforge/jnlp/ResourcesDesc.java,
+	* rt/net/sourceforge/jnlp/SecurityDesc.java,
+	* rt/net/sourceforge/jnlp/ShortcutDesc.java,
+	* rt/net/sourceforge/jnlp/StreamEater.java,
+	* rt/net/sourceforge/jnlp/Version.java,
+	* rt/net/sourceforge/jnlp/cache/CacheEntry.java,
+	* rt/net/sourceforge/jnlp/cache/CacheUtil.java,
+	* rt/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java,
+	* rt/net/sourceforge/jnlp/cache/DownloadIndicator.java,
+	* rt/net/sourceforge/jnlp/cache/Resource.java,
+	* rt/net/sourceforge/jnlp/cache/ResourceTracker.java,
+	* rt/net/sourceforge/jnlp/cache/UpdatePolicy.java,
+	* rt/net/sourceforge/jnlp/cache/package.html,
+	* rt/net/sourceforge/jnlp/event/ApplicationEvent.java,
+	* rt/net/sourceforge/jnlp/event/ApplicationListener.java,
+	* rt/net/sourceforge/jnlp/event/DownloadEvent.java,
+	* rt/net/sourceforge/jnlp/event/DownloadListener.java,
+	* rt/net/sourceforge/jnlp/event/package.html,
+	* rt/net/sourceforge/jnlp/package.html,
+	* rt/net/sourceforge/jnlp/resources/Manifest.mf,
+	* rt/net/sourceforge/jnlp/resources/Messages.properties,
+	* rt/net/sourceforge/jnlp/resources/about.jnlp,
+	* rt/net/sourceforge/jnlp/resources/default.jnlp,
+	* rt/net/sourceforge/jnlp/runtime/AppThreadGroup.java,
+	* rt/net/sourceforge/jnlp/runtime/AppletAudioClip.java,
+	* rt/net/sourceforge/jnlp/runtime/AppletEnvironment.java,
+	* rt/net/sourceforge/jnlp/runtime/AppletInstance.java,
+	* rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java,
+	* rt/net/sourceforge/jnlp/runtime/Boot.java,
+	* rt/net/sourceforge/jnlp/runtime/Boot13.java,
+	* rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java,
+	* rt/net/sourceforge/jnlp/runtime/JNLPPolicy.java,
+	* rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java,
+	* rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java,
+	* rt/net/sourceforge/jnlp/runtime/package.html,
+	* rt/net/sourceforge/jnlp/security/AccessWarningPane.java,
+	* rt/net/sourceforge/jnlp/security/AppletWarningPane.java,
+	* rt/net/sourceforge/jnlp/security/CertVerifier.java,
+	* rt/net/sourceforge/jnlp/security/CertWarningPane.java,
+	* rt/net/sourceforge/jnlp/security/CertsInfoPane.java,
+	* rt/net/sourceforge/jnlp/security/HttpsCertVerifier.java,
+	* rt/net/sourceforge/jnlp/security/MoreInfoPane.java,
+	* rt/net/sourceforge/jnlp/security/SecurityDialogUI.java,
+	* rt/net/sourceforge/jnlp/security/SecurityUtil.java,
+	* rt/net/sourceforge/jnlp/security/SecurityWarningDialog.java,
+	* rt/net/sourceforge/jnlp/security/SingleCertInfoPane.java,
+	* rt/net/sourceforge/jnlp/security/VariableX509TrustManager.java,
+	* rt/net/sourceforge/jnlp/security/viewer/CertificatePane.java,
+	* rt/net/sourceforge/jnlp/security/viewer/CertificateViewer.java,
+	* rt/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java,
+	* rt/net/sourceforge/jnlp/services/InstanceExistsException.java,
+	* rt/net/sourceforge/jnlp/services/ServiceUtil.java,
+	* rt/net/sourceforge/jnlp/services/SingleInstanceLock.java,
+	* rt/net/sourceforge/jnlp/services/XBasicService.java,
+	* rt/net/sourceforge/jnlp/services/XClipboardService.java,
+	* rt/net/sourceforge/jnlp/services/XDownloadService.java,
+	* rt/net/sourceforge/jnlp/services/XExtendedService.java,
+	* rt/net/sourceforge/jnlp/services/XExtensionInstallerService.java,
+	* rt/net/sourceforge/jnlp/services/XFileContents.java,
+	* rt/net/sourceforge/jnlp/services/XFileOpenService.java,
+	* rt/net/sourceforge/jnlp/services/XFileSaveService.java,
+	* rt/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java,
+	* rt/net/sourceforge/jnlp/services/XPersistenceService.java,
+	* rt/net/sourceforge/jnlp/services/XPrintService.java,
+	* rt/net/sourceforge/jnlp/services/XServiceManagerStub.java,
+	* rt/net/sourceforge/jnlp/services/XSingleInstanceService.java,
+	* rt/net/sourceforge/jnlp/services/package.html,
+	* rt/net/sourceforge/jnlp/tools/CharacterEncoder.java,
+	* rt/net/sourceforge/jnlp/tools/HexDumpEncoder.java,
+	* rt/net/sourceforge/jnlp/tools/JarRunner.java,
+	* rt/net/sourceforge/jnlp/tools/JarSigner.java,
+	* rt/net/sourceforge/jnlp/tools/JarSignerResources.java,
+	* rt/net/sourceforge/jnlp/tools/KeyStoreUtil.java,
+	* rt/net/sourceforge/jnlp/tools/KeyTool.java,
+	* rt/net/sourceforge/jnlp/util/FileUtils.java,
+	* rt/net/sourceforge/jnlp/util/PropertiesFile.java,
+	* rt/net/sourceforge/jnlp/util/Reflect.java,
+	* rt/net/sourceforge/jnlp/util/WeakList.java,
+	* rt/net/sourceforge/jnlp/util/XDesktopEntry.java,
+	* rt/net/sourceforge/nanoxml/XMLElement.java,
+	* rt/net/sourceforge/nanoxml/XMLParseException.java:
+	Move NetX sources to netx subdirectory.
+	* Makefile.am:
+	(NETX_SRCDIR): Source directory containing NetX sources.
+	(NETX_RESOURCE_DIR): Path to NetX resource files.
+	(NETX_EXTRA_DIR): Path to extra NetX resource files.
+	(SOURCEPATH_DIRS): Renamed from ABS_SOURCE_DIRS. Drop
+	rt source directory (now plugs only) and plugin sources
+	so it only includes OpenJDK sources.
+	(ICEDTEA_BOOTSTRAP_CLASSES): Explicitly compile BasicDirectoryModel
+	due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42003
+	(LIVECONNECT_DIR): Use liveconnect build directory not rt.
+	(distclean-local): Call clean-netx, clean-plugin and clean-liveconnect
+	targets.  Remove duplicate plugin cleanup.
+	(stamps/icedtea.stamp): Use NETX_RESOURCE_DIR for about.jnlp.
+	(stamps/icedtea-debug.stamp): Likewise.
+	(liveconnect-source-files.txt): Compile list of plugin sources.
+	(stamps/liveconnect.stamp): Build the plugin Java source code.
+	(stamps/liveconnect-dist.stamp): Create classes.jar and src.zip
+	for plugin (unused at present).
+	(clean-liveconnect): Remove build of Java plugin code.
+	(netx-source-files.txt): Compile list of NetX sources.
+	(stamps/netx.stamp): Build the NetX source code and copy the
+	resources to the build directory..
+	(stamps/netx-dist.stamp): Create classes.jar and src.zip
+	for NetX (unused at present).
+	(clean-netx): Remove build of NetX code.
+	(stamps/extra-class-files.stamp): Use NETX_EXTRA_DIR.
+	(rt-source-files.txt): Don't search rt directory in build tree
+	or plugin sources.
+	(stamps/rt.stamp): Use SOURCEPATH_DIRS.  Don't copy NetX resources;
+	now part of the NetX build.
+	(stamps/rt.stamp): Depend on liveconnect.stamp as plugin classes
+	are currently included in rt.jar.
+	(stamps/plugs.stamp): Depend on liveconnect.stamp and netx.stamp as
+	plugin and NetX classes are currently included in rt-closed.jar.
+	(liveconnect): New alias.
+	(liveconncet-dist): Likewise.
+	(netx): Likewise.
+	(netx-dist): Likewise.
+	* netx/javax/jnlp/BasicService.java,
+	* netx/javax/jnlp/ClipboardService.java,
+	* netx/javax/jnlp/DownloadService.java,
+	* netx/javax/jnlp/DownloadServiceListener.java,
+	* netx/javax/jnlp/ExtendedService.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/SingleInstanceListener.java,
+	* netx/javax/jnlp/SingleInstanceService.java,
+	* netx/javax/jnlp/UnavailableServiceException.java,
+	* netx/net/sourceforge/jnlp/AppletDesc.java,
+	* netx/net/sourceforge/jnlp/ApplicationDesc.java,
+	* netx/net/sourceforge/jnlp/AssociationDesc.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/MenuDesc.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/RelatedContentDesc.java,
+	* netx/net/sourceforge/jnlp/ResourcesDesc.java,
+	* netx/net/sourceforge/jnlp/SecurityDesc.java,
+	* netx/net/sourceforge/jnlp/ShortcutDesc.java,
+	* netx/net/sourceforge/jnlp/StreamEater.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/ExtendedSingleInstanceService.java,
+	* netx/net/sourceforge/jnlp/services/InstanceExistsException.java,
+	* netx/net/sourceforge/jnlp/services/ServiceUtil.java,
+	* netx/net/sourceforge/jnlp/services/SingleInstanceLock.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/XExtendedService.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/XSingleInstanceService.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/FileUtils.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/jnlp/util/XDesktopEntry.java,
+	* netx/net/sourceforge/nanoxml/XMLElement.java,
+	* netx/net/sourceforge/nanoxml/XMLParseException.java:
+	New location of NetX sources.
+
 2010-03-11  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
--- a/IcedTeaPlugin.cc	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6009 +0,0 @@
-/* IcedTeaPlugin -- implement OJI
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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. */
-
-#include <nsStringAPI.h>
-
-PRThread* current_thread ();
-
-#if PR_BYTES_PER_LONG == 8
-#define PLUGIN_JAVASCRIPT_TYPE jlong
-#define PLUGIN_INITIALIZE_JAVASCRIPT_ARGUMENT(args, obj) args[0].j = obj
-#define PLUGIN_JAVASCRIPT_SIGNATURE "(J)V"
-#else
-#define PLUGIN_JAVASCRIPT_TYPE jint
-#define PLUGIN_INITIALIZE_JAVASCRIPT_ARGUMENT(args, obj) args[0].i = obj
-#define PLUGIN_JAVASCRIPT_SIGNATURE "(I)V"
-#endif
-
-// System includes.
-#include <dlfcn.h>
-#include <errno.h>
-#include <libgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-// GLib includes.
-#include <glib.h>
-#include <glib/gstdio.h>
-
-// GTK includes.
-#include <gtk/gtk.h>
-
-// FIXME: Look into this:
-// #0  nsACString_internal (this=0xbff3016c) at ../../../dist/include/string/nsTSubstring.h:522
-// #1  0x007117c9 in nsDependentCSubstring (this=0xbff3016c, str=@0xab20d00, startPos=0, length=0) at ../../dist/include/string/nsTDependentSubstring.h:68
-// #2  0x0076a9d9 in Substring (str=@0xab20d00, startPos=0, length=0) at ../../dist/include/string/nsTDependentSubstring.h:103
-// #3  0x008333a7 in nsStandardURL::Hostport (this=0xab20ce8) at nsStandardURL.h:338
-// #4  0x008299b8 in nsStandardURL::GetHostPort (this=0xab20ce8, result=@0xbff30210) at nsStandardURL.cpp:1003
-// #5  0x0095b9dc in nsPrincipal::GetOrigin (this=0xab114e0, aOrigin=0xbff30320) at nsPrincipal.cpp:195
-// #6  0x0154232c in nsCSecurityContext::GetOrigin (this=0xab8f410, buf=0xbff30390 "\004", buflen=256) at nsCSecurityContext.cpp:126
-// #7  0x04db377e in CNSAdapter_SecurityContextPeer::GetOrigin () from /opt/jdk1.6.0_03/jre/plugin/i386/ns7/libjavaplugin_oji.so
-// #8  0x05acd59f in getAndPackSecurityInfo () from /opt/jdk1.6.0_03/jre/lib/i386/libjavaplugin_nscp.so
-// #9  0x05acc77f in jni_SecureCallMethod () from /opt/jdk1.6.0_03/jre/lib/i386/libjavaplugin_nscp.so
-// #10 0x05aba88d in CSecureJNIEnv::CallMethod () from /opt/jdk1.6.0_03/jre/lib/i386/libjavaplugin_nscp.so
-// #11 0x04db1be7 in CNSAdapter_SecureJNIEnv::CallMethod () from /opt/jdk1.6.0_03/jre/plugin/i386/ns7/libjavaplugin_oji.so
-// #12 0x0153e62f in ProxyJNIEnv::InvokeMethod (env=0xa8b8040, obj=0x9dad690, method=0xa0ed070, args=0x0) at ProxyJNI.cpp:571
-// #13 0x0153f91c in ProxyJNIEnv::InvokeMethod (env=0xa8b8040, obj=0x9dad690, method=0xa0ed070, args=0xbff3065c "\235\225$") at ProxyJNI.cpp:580
-// #14 0x0153fdbf in ProxyJNIEnv::CallObjectMethod (env=0xa8b8040, obj=0x9dad690, methodID=0xa0ed070) at ProxyJNI.cpp:641
-
-// timeout (in seconds) for various calls to java side
-#define TIMEOUT 180
-
-#define NOT_IMPLEMENTED() \
-  PLUGIN_DEBUG_1ARG ("NOT IMPLEMENTED: %s\n", __PRETTY_FUNCTION__)
-
-#define ID(object) \
-  (object == NULL ? (PRUint32) 0 : reinterpret_cast<JNIReference*> (object)->identifier)
-
-static int plugin_debug = 0;
-
-#if 1
-// Debugging macros.
-
-#define PLUGIN_DEBUG_0ARG(str) \
-  do                                        \
-  {                                         \
-    if (plugin_debug)                       \
-    {                                       \
-      fprintf (stderr, str);                \
-    }                                       \
-  } while (0)
-
-#define PLUGIN_DEBUG_1ARG(str, arg1) \
-  do                                        \
-  {                                         \
-    if (plugin_debug)                       \
-    {                                       \
-      fprintf (stderr, str, arg1);          \
-    }                                       \
-  } while (0)
-
-#define PLUGIN_DEBUG_2ARG(str, arg1, arg2)  \
-  do                                        \
-  {                                         \
-    if (plugin_debug)                       \
-    {                                       \
-      fprintf (stderr, str, arg1, arg2);    \
-    }                                       \
-  } while (0)
-
-#define PLUGIN_DEBUG_3ARG(str, arg1, arg2, arg3) \
-  do                                           \
-  {                                            \
-    if (plugin_debug)                          \
-    {                                          \
-      fprintf (stderr, str, arg1, arg2, arg3); \
-    }                                          \
-  } while (0)
-
-#define PLUGIN_DEBUG_4ARG(str, arg1, arg2, arg3, arg4) \
-  do                                                 \
-  {                                                  \
-    if (plugin_debug)                                \
-    {                                                \
-      fprintf (stderr, str, arg1, arg2, arg3, arg4); \
-    }                                                \
-  } while (0)
-
-#define PLUGIN_DEBUG(message)                                           \
-  PLUGIN_DEBUG_1ARG ("ICEDTEA PLUGIN: %s\n", message)
-
-#define PLUGIN_DEBUG_TWO(first, second)                                 \
-  PLUGIN_DEBUG_2ARG ("ICEDTEA PLUGIN: %s %s\n",      \
-           first, second)
-
-// Tracing.
-class Trace
-{
-public:
-  Trace (char const* name, char const* function)
-  {
-    Trace::name = name;
-    Trace::function = function;
-    PLUGIN_DEBUG_2ARG ("ICEDTEA PLUGIN: %s%s\n",
-             name, function);
-  }
-
-  ~Trace ()
-  {
-    PLUGIN_DEBUG_3ARG ("ICEDTEA PLUGIN: %s%s %s\n",
-             name, function, "return");
-  }
-private:
-  char const* name;
-  char const* function;
-};
-
-// Testing macro.
-#define PLUGIN_TEST(expression, message)  \
-  do                                            \
-    {                                           \
-      if (!(expression))                        \
-        printf ("FAIL: %d: %s\n", __LINE__,     \
-                message);                       \
-    }                                           \
-  while (0);
-
-#include <sys/time.h>
-#include <unistd.h>
-
-inline suseconds_t get_time_in_ms()
-{
-	struct timeval tv;
-	struct timezone tz;
-	gettimeofday(&tv, &tz);
-
-	return tv.tv_usec;
-}
-
-
-inline long get_time_in_s()
-{
-	time_t t;
-	return time(&t);
-}
-
-// __func__ is a variable, not a string literal, so it cannot be
-// concatenated by the preprocessor.
-#define PLUGIN_TRACE_JNIENV() Trace _trace ("JNIEnv::", __func__)
-#define PLUGIN_TRACE_FACTORY() Trace _trace ("Factory::", __func__)
-#define PLUGIN_TRACE_INSTANCE() Trace _trace ("Instance::", __func__)
-#define PLUGIN_TRACE_EVENTSINK() Trace _trace ("EventSink::", __func__)
-#define PLUGIN_TRACE_LISTENER() Trace _trace ("Listener::", __func__)
-//#define PLUGIN_TRACE_RC() Trace _trace ("ResultContainer::", __func__)
-#define PLUGIN_TRACE_RC()
-
-// Error reporting macros.
-#define PLUGIN_ERROR(message)                                       \
-  fprintf (stderr, "%s:%d: Error: %s\n", __FILE__, __LINE__,  \
-           message)
-
-#define PLUGIN_ERROR_TWO(first, second)                                 \
-  fprintf (stderr, "%s:%d: Error: %s: %s\n", __FILE__, __LINE__,  \
-           first, second)
-
-#define PLUGIN_ERROR_THREE(first, second, third)                        \
-  fprintf (stderr, "%s:%d: Error: %s: %s: %s\n", __FILE__,        \
-           __LINE__, first, second, third)
-
-#define PLUGIN_CHECK_RETURN(message, result)           \
-  if (NS_SUCCEEDED (result))                    \
-  {                                             \
-    PLUGIN_DEBUG (message);                     \
-  }                                             \
-  else                                          \
-    {                                           \
-      PLUGIN_ERROR (message);                   \
-      return result;                            \
-    }
-
-#define PLUGIN_CHECK(message, result)           \
-  if (NS_SUCCEEDED (result))                    \
-  {                                             \
-    PLUGIN_DEBUG (message);                     \
-  } else                                        \
-  {                                             \
-    PLUGIN_ERROR (message);                     \
-  }
-
-#else
-
-// Debugging macros.
-#define PLUGIN_DEBUG(message)
-#define PLUGIN_DEBUG_TWO(first, second)
-
-// Testing macros.
-#define PLUGIN_TEST(expression, message)
-#define PLUGIN_TRACE_JNIENV()
-#define PLUGIN_TRACE_FACTORY() Trace _trace ("Factory::", __func__)
-//#define PLUGIN_TRACE_FACTORY()
-#define PLUGIN_TRACE_INSTANCE()
-#define PLUGIN_TRACE_EVENTSINK()
-#define PLUGIN_TRACE_LISTENER()
-
-// Error reporting macros.
-#define PLUGIN_ERROR(message)                                       \
-  fprintf (stderr, "%s:%d: Error: %s\n", __FILE__, __LINE__,  \
-           message)
-
-#define PLUGIN_ERROR_TWO(first, second)                                 \
-  fprintf (stderr, "%s:%d: Error: %s: %s\n", __FILE__, __LINE__,  \
-           first, second)
-
-#define PLUGIN_ERROR_THREE(first, second, third)                        \
-  fprintf (stderr, "%s:%d: Error: %s: %s: %s\n", __FILE__,        \
-           __LINE__, first, second, third)
-#define PLUGIN_CHECK_RETURN(message, result)
-#define PLUGIN_CHECK(message, result)
-#endif
-
-#define PLUGIN_NAME "IcedTea Java Web Browser Plugin (using " PLUGIN_VERSION ")"
-#define PLUGIN_DESCRIPTION "The " PLUGIN_NAME " executes Java applets."
-#define PLUGIN_MIME_DESC                                               \
-  "application/x-java-vm:class,jar:IcedTea;"                           \
-  "application/x-java-applet:class,jar:IcedTea;"                       \
-  "application/x-java-applet;version=1.1:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.1.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.1.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.1.3:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.2:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.2.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.2.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.3:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.3.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.4:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.4.1:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.4.2:class,jar:IcedTea;"         \
-  "application/x-java-applet;version=1.5:class,jar:IcedTea;"           \
-  "application/x-java-applet;version=1.6:class,jar:IcedTea;"           \
-  "application/x-java-applet;jpi-version=1.6.0_00:class,jar:IcedTea;"  \
-  "application/x-java-bean:class,jar:IcedTea;"                         \
-  "application/x-java-bean;version=1.1:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.1.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.1.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.1.3:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.2:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.2.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.2.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.3:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.3.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.4:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.4.1:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.4.2:class,jar:IcedTea;"           \
-  "application/x-java-bean;version=1.5:class,jar:IcedTea;"             \
-  "application/x-java-bean;version=1.6:class,jar:IcedTea;"             \
-  "application/x-java-bean;jpi-version=1.6.0_00:class,jar:IcedTea;"
-
-#define FAILURE_MESSAGE "IcedTeaPluginFactory error: Failed to run %s." \
-  "  For more detail rerun \"firefox -g\" in a terminal window."
-
-// Global instance counter.
-// A global variable for reporting GLib errors.  This must be free'd
-// and set to NULL after each use.
-static GError* channel_error = NULL;
-// Fully-qualified appletviewer executable.
-gchar* data_directory = NULL;
-static char* appletviewer_executable = NULL;
-static char* libjvm_so = NULL;
-
-class IcedTeaPluginFactory;
-
-static PRBool factory_created = PR_FALSE;
-static IcedTeaPluginFactory* factory = NULL;
-
-static PRBool jvm_attached = PR_FALSE;
-
-// Applet viewer input channel (needs to be static because it is used in plugin_in_pipe_callback)
-GIOChannel* in_from_appletviewer = NULL;
-
-// Callback used to monitor input pipe status.
-static gboolean plugin_in_pipe_callback (GIOChannel* source,
-                                         GIOCondition condition,
-                                         gpointer plugin_data);
-
-#include <prmon.h>
-#include <queue>
-#include <nsCOMPtr.h>
-#include <nsIThread.h>
-#include <nspr.h>
-
-PRMonitor *jvmMsgQueuePRMonitor;
-std::queue<nsCString> jvmMsgQueue;
-nsCOMPtr<nsIThread> processThread;
-
-// IcedTeaJNIEnv helpers.
-class JNIReference
-{
-public:
-  JNIReference (PRUint32 identifier);
-  ~JNIReference ();
-  PRUint32 identifier;
-  PRUint32 count;
-};
-
-JNIReference::JNIReference (PRUint32 identifier)
-  : identifier (identifier),
-    count (0)
-{
-  PLUGIN_DEBUG_2ARG ("JNIReference CONSTRUCT: %d %p\n", identifier, this);
-}
-
-JNIReference::~JNIReference ()
-{
-  PLUGIN_DEBUG_2ARG ("JNIReference DECONSTRUCT: %d %p\n", identifier, this);
-}
-
-class JNIID : public JNIReference
-{
-public:
-  JNIID (PRUint32 identifier, char const* signature);
-  ~JNIID ();
-  char const* signature;
-};
-
-JNIID::JNIID (PRUint32 identifier, char const* signature)
-  : JNIReference (identifier),
-    signature (strdup (signature))
-{
-  PLUGIN_DEBUG_2ARG ("JNIID CONSTRUCT: %d %p\n", identifier, this);
-}
-
-JNIID::~JNIID ()
-{
-  PLUGIN_DEBUG_2ARG ("JNIID DECONSTRUCT: %d %p\n", identifier, this);
-}
-
-char const* TYPES[10] = { "Object",
-                          "boolean",
-                          "byte",
-                          "char",
-                          "short",
-                          "int",
-                          "long",
-                          "float",
-                          "double",
-                          "void" };
-
-
-// FIXME: create index from security context.
-#define MESSAGE_CREATE()                                     \
-  nsCString message ("context ");                            \
-  message.AppendInt (0);                                     \
-
-#define MESSAGE_ADD_STACK_REFERENCE(reference) \
-  message += " reference ";                                  \
-  message.AppendInt (reference);                             \
-  if (!factory->result_map.Get(reference, NULL)) {           \
-	   ResultContainer *resultC = new ResultContainer();      \
-	   factory->result_map.Put(reference, resultC);  \
-	   PLUGIN_DEBUG_3ARG ("ResultMap %p created for reference %d found = %d\n", resultC, reference, factory->result_map.Get(reference, NULL)); \
-  } \
-  else                                                      \
-  {                                                         \
-       ResultContainer *resultC;                          \
-       factory->result_map.Get(reference, &resultC);     \
-       resultC->Clear();                                  \
-  }
-
-#define MESSAGE_ADD_SRC(src) \
-	message += " src "; \
-	message += src;
-
-#define MESSAGE_ADD_PRIVILEGES(ctx)             \
-  nsCString privileges("");                     \
-  GetEnabledPrivileges(&privileges, ctx);       \
-  if (privileges.Length() > 0)                  \
-  {                                             \
-    message += " privileges ";                  \
-    message += privileges;                      \
-  }
-
-#define MESSAGE_ADD_FUNC() \
-  message += " ";											 \
-  message += __func__;
-
-#define MESSAGE_ADD_STRING(name)                \
-  message += " ";                               \
-  message += name;
-
-#define MESSAGE_ADD_SIZE(size)                  \
-  message += " ";                               \
-  message.AppendInt ((PRUintn) size);
-
-// Pass character value through socket as an integer.
-#define MESSAGE_ADD_TYPE(type)                  \
-  message += " ";                               \
-  message += TYPES[type];
-
-#define MESSAGE_ADD_REFERENCE(clazz)                    \
-  message += " ";                                       \
-  message.AppendInt (clazz ? ID (clazz) : 0);
-
-#define MESSAGE_ADD_ID(id)                                              \
-  message += " ";                                                       \
-  message.AppendInt (reinterpret_cast<JNIID*> (id)->identifier);
-
-#define MESSAGE_ADD_ARGS(id, args)               \
-  message += " ";                                \
-  char* expandedArgs = ExpandArgs (reinterpret_cast<JNIID*> (id), args); \
-  message += expandedArgs;                                              \
-  free (reinterpret_cast<void*> (expandedArgs));                        \
-  expandedArgs = NULL;
- 
-
-#define MESSAGE_ADD_VALUE(id, val)                      \
-  message += " ";                                       \
-  char* expandedValues =                                \
-    ExpandArgs (reinterpret_cast<JNIID*> (id), &val);   \
-  message += expandedValues;                            \
-  free (expandedValues);                                \
-  expandedValues = NULL;
-
-#define MESSAGE_ADD_STRING_UCS(pointer, length) \
-  for (int i = 0; i < length; i++)              \
-    {                                           \
-      message += " ";                           \
-      message.AppendInt (pointer[i]);           \
-    }
-
-#define MESSAGE_ADD_STRING_UTF(pointer)         \
-  int i = 0;                                    \
-  while (pointer[i] != 0)                       \
-    {                                           \
-      message += " ";                           \
-      message.AppendInt (pointer[i]);           \
-      i++;                                      \
-    }
-
-#define MESSAGE_SEND()                          \
-  factory->SendMessageToAppletViewer (message);
-
-// FIXME: Right now, the macro below will exit only 
-// if error occured and we are in the middle of a 
-// shutdown (so that the permanent loop does not block 
-// proper exit). We need better error handling
-
-#define PROCESS_PENDING_EVENTS_REF(reference) \
-    if (jvm_attached == PR_FALSE) \
-	{ \
-	    PLUGIN_DEBUG_0ARG("Error on Java side detected. Abandoning wait and returning.\n"); \
-		return NS_ERROR_FAILURE; \
-	} \
-	if (g_main_context_pending (NULL)) { \
-	   g_main_context_iteration(NULL, false); \
-	} \
-    PRBool hasPending;  \
-    factory->current->HasPendingEvents(&hasPending); \
-	if (hasPending == PR_TRUE) \
-	{ \
-	  PRBool processed = PR_FALSE; \
-	  factory->current->ProcessNextEvent(PR_TRUE, &processed); \
-	} else \
-	{\
-	    PR_Sleep(PR_INTERVAL_NO_WAIT); \
-	}
-
-#define PROCESS_PENDING_EVENTS \
-	PRBool hasPending;  \
-	factory->current->HasPendingEvents(&hasPending); \
-	if (hasPending == PR_TRUE) { \
-		PRBool processed = PR_FALSE; \
-		factory->current->ProcessNextEvent(PR_TRUE, &processed); \
-	} \
-	if (g_main_context_pending (NULL)) { \
-       g_main_context_iteration(NULL, false); \
-    } else \
-    { \
-		PR_Sleep(PR_INTERVAL_NO_WAIT); \
-	}
-
-#define MESSAGE_RECEIVE_REFERENCE(reference, cast, name)                \
-  nsresult res = NS_OK;                                                 \
-  PLUGIN_DEBUG_0ARG ("RECEIVE 1\n");                                    \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnIdentifier == -1 &&\
-	     resultC->errorOccurred == PR_FALSE)     \
-    {                                                                   \
-      PROCESS_PENDING_EVENTS_REF (reference);                                \
-    }                                                                   \
-  PLUGIN_DEBUG_0ARG ("RECEIVE 3\n"); \
-  if (resultC->returnIdentifier == 0 || \
-	  resultC->errorOccurred == PR_TRUE) \
-  {  \
-	  *name = NULL;                                                     \
-  } else {                                                              \
-  *name =                                                               \
-    reinterpret_cast<cast>                                              \
-    (factory->references.ReferenceObject (resultC->returnIdentifier)); \
-  } \
-  PLUGIN_DEBUG_3ARG ("RECEIVE_REFERENCE: %s result: %x = %d\n",                    \
-          __func__, *name, resultC->returnIdentifier);
-
-// FIXME: track and free JNIIDs.
-#define MESSAGE_RECEIVE_ID(reference, cast, id, signature)              \
-  PRBool processed = PR_FALSE;                                          \
-  nsresult res = NS_OK;                                                 \
-  PLUGIN_DEBUG_0ARG ("RECEIVE ID 1\n");                                             \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnIdentifier == -1 &&\
-	     resultC->errorOccurred == PR_FALSE)     \
-    {                                                                   \
-      PROCESS_PENDING_EVENTS_REF (reference);                                \
-    }                                                                   \
-                                                                        \
-  if (resultC->errorOccurred == PR_TRUE)	 	    \
-  { \
-	  *id = NULL; \
-  } else \
-  { \
-  *id = reinterpret_cast<cast>                                  \
-    (new JNIID (resultC->returnIdentifier, signature));         \
-   PLUGIN_DEBUG_4ARG ("RECEIVE_ID: %s result: %x = %d, %s\n",               \
-           __func__, *id, resultC->returnIdentifier,             \
-           signature); \
-  }
-
-#define MESSAGE_RECEIVE_VALUE(reference, ctype, result)                    \
-  nsresult res = NS_OK;                                                    \
-  PLUGIN_DEBUG_0ARG ("RECEIVE VALUE 1\n");                                             \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnValue.IsVoid() == PR_TRUE && \
-	     resultC->errorOccurred == PR_FALSE)            \
-    {                                                                      \
-      PROCESS_PENDING_EVENTS_REF (reference);                                   \
-    }                                                                      \
-    *result = ParseValue (type, resultC->returnValue);            
-// \
-//   char* valueString = ValueString (type, *result);              \
-//   printf ("RECEIVE_VALUE: %s result: %x = %s\n",                \
-//           __func__, result, valueString);                       \
-//   free (valueString);                                           \
-//   valueString = NULL;
-
-#define MESSAGE_RECEIVE_SIZE(reference, result)                   \
-  PRBool processed = PR_FALSE;                                  \
-  nsresult res = NS_OK;                                         \
-  PLUGIN_DEBUG_0ARG("RECEIVE SIZE 1\n");                                 \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnValue.IsVoid() == PR_TRUE && \
-	     resultC->errorOccurred == PR_FALSE) \
-    {                                                           \
-      PROCESS_PENDING_EVENTS_REF (reference);                        \
-    }                                                           \
-  nsresult conversionResult;                                    \
-  if (resultC->errorOccurred == PR_TRUE) \
-	*result = NULL; \
-  else \
-  { \
-    *result = resultC->returnValue.ToInteger (&conversionResult); \
-    PLUGIN_CHECK ("parse integer", conversionResult);             \
-  }
-// \
-//   printf ("RECEIVE_SIZE: %s result: %x = %d\n",                 \
-//           __func__, result, *result);
-
-// strdup'd string must be freed by calling function.
-#define MESSAGE_RECEIVE_STRING(reference, char_type, result)      \
-  PRBool processed = PR_FALSE;                                  \
-  nsresult res = NS_OK;                                         \
-  PLUGIN_DEBUG_0ARG("RECEIVE STRING 1\n");                                 \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnValue.IsVoid() == PR_TRUE && \
-	     resultC->errorOccurred == PR_FALSE)  \
-    {                                                           \
-      PROCESS_PENDING_EVENTS_REF (reference);                        \
-    }                                                           \
-	if (resultC->errorOccurred == PR_TRUE) \
-		*result = NULL; \
-	else \
-	{\
-	  PLUGIN_DEBUG_1ARG("Setting result to: %s\n", strdup (resultC->returnValue.get ())); \
-      *result = reinterpret_cast<char_type const*>                  \
-                (strdup (resultC->returnValue.get ()));\
-	}
-// \
-//   printf ("RECEIVE_STRING: %s result: %x = %s\n",               \
-//           __func__, result, *result);
-
-// strdup'd string must be freed by calling function.
-#define MESSAGE_RECEIVE_STRING_UCS(reference, result)             \
-  PRBool processed = PR_FALSE;                                  \
-  nsresult res = NS_OK;                                         \
-  PLUGIN_DEBUG_0ARG("RECEIVE STRING UCS 1\n");                                 \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnValueUCS.IsVoid() == PR_TRUE && \
-	     resultC->errorOccurred == PR_FALSE) \
-    {                                                           \
-      PROCESS_PENDING_EVENTS_REF (reference);                        \
-    }                                                           \
-	if (resultC->errorOccurred == PR_TRUE) \
-		*result = NULL; \
-	else \
-	{ \
-	  int length = resultC->returnValueUCS.Length ();               \
-	  jchar* newstring = static_cast<jchar*> (PR_Malloc (length));  \
-	  memset (newstring, 0, length);                                \
-	  memcpy (newstring, resultC->returnValueUCS.get (), length);   \
-	  *result = static_cast<jchar const*> (newstring); \
-	}
-
-// \
-//   printf ("RECEIVE_STRING: %s result: %x = %s\n",               \
-//           __func__, result, *result);
-
-#define MESSAGE_RECEIVE_BOOLEAN(reference, result)                \
-  PRBool processed = PR_FALSE;                                  \
-  nsresult res = NS_OK;                                         \
-  PLUGIN_DEBUG_0ARG("RECEIVE BOOLEAN 1\n");                             \
-  ResultContainer *resultC;                                              \
-  factory->result_map.Get(reference, &resultC);                         \
-  while (resultC->returnIdentifier == -1 && \
-	     resultC->errorOccurred == PR_FALSE)               \
-    {                                                           \
-      PROCESS_PENDING_EVENTS_REF (reference);                        \
-    }                                                           \
-	if (resultC->errorOccurred == PR_TRUE) \
-		*result = NULL; \
-	else \
-	  *result = resultC->returnIdentifier;
-//      res = factory->current->ProcessNextEvent (PR_TRUE,        \
-//                                                &processed);    \
-//      PLUGIN_CHECK_RETURN (__func__, res);                      \
-
-// \
-//   printf ("RECEIVE_BOOLEAN: %s result: %x = %s\n",              \
-//           __func__, result, *result ? "true" : "false");
-
-#include <nsISupports.h>
-#include <nsIFactory.h>
-#include <nscore.h>
-#include <prtypes.h>
-
-// Factory functions.
-extern "C" NS_EXPORT nsresult NSGetFactory (nsISupports* aServMgr,
-                                            nsCID const& aClass,
-                                            char const* aClassName,
-                                            char const* aContractID,
-                                            nsIFactory** aFactory);
-
-
-
-#include <nsIFactory.h>
-#include <nsIPlugin.h>
-#include <nsIJVMManager.h>
-#include <nsIJVMConsole.h>
-#include <nsIJVMPlugin.h>
-#include <nsIInputStream.h>
-#include <nsIAsyncInputStream.h>
-#include <nsISocketTransport.h>
-#include <nsIOutputStream.h>
-#include <nsIAsyncInputStream.h>
-#include <prthread.h>
-#include <nsIThread.h>
-#include <nsILocalFile.h>
-#include <nsIPluginInstance.h>
-#include <nsIPluginInstancePeer.h>
-#include <nsIJVMPluginInstance.h>
-#include <nsIPluginTagInfo2.h>
-#include <nsComponentManagerUtils.h>
-#include <nsILocalFile.h>
-#include <prthread.h>
-#include <nsIEventTarget.h>
-// // FIXME: I had to hack dist/include/xpcom/xpcom-config.h to comment
-// // out this line: #define HAVE_CPP_2BYTE_WCHAR_T 1 so that
-// // nsStringAPI.h would not trigger a compilation assertion failure:
-// //
-// // dist/include/xpcom/nsStringAPI.h:971: error: size of array ‘arg’
-// // is negative
-// #include <nsStringAPI.h>
-
-// FIXME: if about:plugins doesn't show this plugin, try:
-// export LD_LIBRARY_PATH=/home/fitzsim/sources/mozilla/xpcom/build
-
-// FIXME: if the connection spins, printing:
-//
-// ICEDTEA PLUGIN: thread 0x84f4a68: wait for connection: process next event
-// ICEDTEA PLUGIN: thread 0x84f4a68: Instance::IsConnected
-// ICEDTEA PLUGIN: thread 0x84f4a68: Instance::IsConnected return
-//
-// repeatedly, it means there's a problem with pluginappletviewer.
-// Try "make av".
-
-#include <nsClassHashtable.h>
-#include <nsDataHashtable.h>
-#include <nsAutoPtr.h>
-
-class IcedTeaPluginInstance;
-class IcedTeaEventSink;
-
-// TODO:
-//
-// 1) complete test suite for all used functions.
-//
-// 2) audit memory allocation/deallocation on C++ side
-//
-// 3) confirm objects/ids hashmap emptying on Java side
-
-// IcedTeaPlugin cannot be a standard nsIScriptablePlugin.  It must
-// conform to Mozilla's expectations since Mozilla treats Java as a
-// special case.  See dom/src/base/nsDOMClassInfo.cpp:
-// nsHTMLPluginObjElementSH::GetPluginJSObject.
-
-// nsClassHashtable does JNIReference deallocation automatically,
-// using nsAutoPtr.
-class ReferenceHashtable
-  : public nsClassHashtable<nsUint32HashKey, JNIReference>
-{
-public:
-  jobject ReferenceObject (PRUint32);
-  jobject ReferenceObject (PRUint32, char const*);
-  void UnreferenceObject (PRUint32);
-};
-
-jobject
-ReferenceHashtable::ReferenceObject (PRUint32 key)
-{
-  if (key == 0)
-    return 0;
-
-  JNIReference* reference;
-  Get (key, &reference);
-  if (reference == 0)
-    {
-      reference = new JNIReference (key);
-      Put (key, reference);
-    }
-  reference->count++;
-  PLUGIN_DEBUG_3ARG ("INCREMENTED: %d %p to: %d\n", key, reference, reference->count);
-  return reinterpret_cast<jobject> (reference);
-}
-
-jobject
-ReferenceHashtable::ReferenceObject (PRUint32 key, char const* signature)
-{
-  if (key == 0)
-    return 0;
-
-  JNIReference* reference;
-  Get (key, &reference);
-  if (reference == 0)
-    {
-      reference = new JNIID (key, signature);
-      Put (key, reference);
-    }
-  reference->count++;
-  PLUGIN_DEBUG_3ARG ("INCREMENTED: %d %p to: %d\n", key, reference, reference->count);
-  return reinterpret_cast<jobject> (reference);
-}
-
-void
-ReferenceHashtable::UnreferenceObject (PRUint32 key)
-{
-  JNIReference* reference;
-  Get (key, &reference);
-  if (reference != 0)
-    {
-      reference->count--;
-      PLUGIN_DEBUG_3ARG ("DECREMENTED: %d %p to: %d\n", key, reference, reference->count);
-      if (reference->count == 0)
-        Remove (key);
-    }
-}
-
-class ResultContainer 
-{
-	public:
-		ResultContainer();
-		~ResultContainer();
-		void Clear();
-		void start_timer();
-		void stop_timer();
-  		PRUint32 returnIdentifier;
-		nsCString returnValue;
-		nsString returnValueUCS;
-		nsCString errorMessage;
-		PRBool errorOccurred;
-		suseconds_t time;
-};
-
-ResultContainer::ResultContainer () 
-{
-	returnIdentifier = -1;
-	returnValue.Truncate();
-	returnValueUCS.Truncate();
-	returnValue.SetIsVoid(PR_TRUE);
-	returnValueUCS.SetIsVoid(PR_TRUE);
-	errorMessage.Truncate();
-	errorOccurred = PR_FALSE;
-
-	start_timer();
-}
-
-ResultContainer::~ResultContainer ()
-{
-    returnIdentifier = -1;
-	returnValue.Truncate();
-	returnValueUCS.Truncate();
-	errorMessage.Truncate();
-
-	stop_timer();
-}
-
-void
-ResultContainer::Clear()
-{
-	returnIdentifier = -1;
-	returnValue.Truncate();
-	returnValueUCS.Truncate();
-	returnValue.SetIsVoid(PR_TRUE);
-	returnValueUCS.SetIsVoid(PR_TRUE);
-	errorMessage.Truncate();
-	errorOccurred = PR_FALSE;
-
-	start_timer();
-}
-
-void
-ResultContainer::start_timer()
-{
-	time = get_time_in_ms();
-}
-
-
-void
-ResultContainer::stop_timer()
-{
-	PLUGIN_DEBUG_1ARG("Time elapsed = %ld\n", get_time_in_ms() - time);
-}
-
-#include <nsTArray.h>
-#include <nsILiveconnect.h>
-#include <nsICollection.h>
-#include <nsIProcess.h>
-
-#ifndef __STDC_FORMAT_MACROS
-# define __STDC_FORMAT_MACROS
-#endif
-
-#include <inttypes.h>
-
-inline void js_id_to_string(char** str, PLUGIN_JAVASCRIPT_TYPE jsid)
-{
-	if (sizeof(PLUGIN_JAVASCRIPT_TYPE) == 4)
-		sprintf(*str, "%"PRId32, jsid);
-
-	if (sizeof(PLUGIN_JAVASCRIPT_TYPE) == 8)
-		sprintf(*str, "%"PRId64, jsid);
-}
-
-inline PLUGIN_JAVASCRIPT_TYPE string_to_js_id(nsCString str)
-{
-	if (sizeof(PLUGIN_JAVASCRIPT_TYPE) == sizeof(int))
-		return atoi(str.get());
-
-	if (sizeof(PLUGIN_JAVASCRIPT_TYPE) == sizeof(long))
-		return atol(str.get());
-
-	if (sizeof(PLUGIN_JAVASCRIPT_TYPE) == sizeof(long long))
-		return atoll(str.get());
-}
-
-class IcedTeaJNIEnv;
-
-// nsIPlugin inherits from nsIFactory.
-class IcedTeaPluginFactory : public nsIPlugin,
-                             public nsIJVMManager,
-                             public nsIJVMPlugin,
-							 public nsIJVMConsole,
-                             public nsIInputStreamCallback
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIFACTORY
-  NS_DECL_NSIPLUGIN
-  NS_DECL_NSIJVMMANAGER
-  // nsIJVMConsole does not provide an NS_DECL macro.
-public:
-  NS_IMETHOD Show (void);
-  NS_IMETHOD Hide (void);
-  NS_IMETHOD IsVisible (PRBool* result);
-  NS_IMETHOD Print(const char* msg, const char* encodingName = NULL);
-  // nsIJVMPlugin does not provide an NS_DECL macro.
-public:
-  NS_IMETHOD AddToClassPath (char const* dirPath);
-  NS_IMETHOD RemoveFromClassPath (char const* dirPath);
-  NS_IMETHOD GetClassPath (char const** result);
-  NS_IMETHOD GetJavaWrapper (JNIEnv* jenv, PLUGIN_JAVASCRIPT_TYPE obj, jobject* jobj);
-  NS_IMETHOD CreateSecureEnv (JNIEnv* proxyEnv, nsISecureEnv** outSecureEnv);
-  NS_IMETHOD SpendTime (PRUint32 timeMillis);
-  NS_IMETHOD UnwrapJavaWrapper (JNIEnv* jenv, jobject jobj, PLUGIN_JAVASCRIPT_TYPE* obj);
-  NS_DECL_NSIINPUTSTREAMCALLBACK
-
-  IcedTeaPluginFactory();
-  nsresult SendMessageToAppletViewer (nsCString& message);
-  PRUint32 RegisterInstance (IcedTeaPluginInstance* instance);
-  void UnregisterInstance (PRUint32 instance_identifier);
-  NS_IMETHOD GetJavaObject (PRUint32 instance_identifier, jobject* object);
-  void HandleMessage (nsCString const& message);
-  nsresult SetTransport (nsISocketTransport* transport);
-  void Connected ();
-  void Disconnected ();
-  PRBool IsConnected ();
-  nsCOMPtr<nsIAsyncInputStream> async;
-  nsCOMPtr<nsIThread> current;
-  nsCOMPtr<nsIInputStream> input;
-  nsCOMPtr<nsIOutputStream> output;
-  ReferenceHashtable references;
-  PRBool shutting_down;
-  // FIXME: make private?
-  JNIEnv* proxyEnv;
-  nsISecureEnv* secureEnv;
-  nsDataHashtable<nsUint32HashKey,ResultContainer*> result_map;
-
-  void InitializeJava();
-  void GetMember ();
-  void SetMember ();
-  void GetSlot ();
-  void SetSlot ();
-  void Eval ();
-  void RemoveMember ();
-  void Call ();
-  void Finalize ();
-  void ToString ();
-  void MarkInstancesVoid ();
-  nsCOMPtr<nsILiveconnect> liveconnect;
-
-  // normally, we shouldn't have to track unref'd handles, but in some cases, 
-  // we may be in the middle of Eval() when finalize is called and completed. 
-  // At this point, calling liveconnect->Eval causes bad, bad, bad things 
-  // (first observed here after multiple refreshes: 
-  // http://www.jigzone.com/puzzles/daily-jigsaw
-  nsDataHashtable<nsUint32HashKey, PRBool> js_cleared_handles;
-
-private:
-  ~IcedTeaPluginFactory();
-  nsresult TestAppletviewer ();
-  void DisplayFailureDialog ();
-  nsresult StartAppletviewer ();
-  void ProcessMessage();
-  void ConsumeMsgFromJVM();
-  nsresult GetProxyInfo(const char* siteAddr, char** proxyScheme, char** proxyHost, char** proxyPort);
-  nsresult GetCookieInfo(const char* siteAddr, char** cookieString);
-  nsCOMPtr<IcedTeaEventSink> sink;
-  nsCOMPtr<nsISocketTransport> transport;
-  nsCOMPtr<nsIProcess> applet_viewer_process;
-  PRBool connected;
-  PRUint32 next_instance_identifier;
-  PRUint32 object_identifier_return;
-  PRUint32 instance_count;
-  PLUGIN_JAVASCRIPT_TYPE javascript_identifier;
-  int name_identifier;
-  int args_identifier;
-  int string_identifier;
-  int slot_index;
-  int value_identifier;
-  // Does not do construction/deconstruction or reference counting.
-  nsDataHashtable<nsUint32HashKey, IcedTeaPluginInstance*> instances;
-
-  // Applet viewer input pipe name.
-  gchar* in_pipe_name;
-  // Applet viewer input watch source.
-  gint in_watch_source;
-  // Applet viewer output pipe name.
-  gchar* out_pipe_name;
-  // Applet viewer output watch source.
-  gint out_watch_source;
-  // Applet viewer output channel.
-  GIOChannel* out_to_appletviewer;
-};
-
-class IcedTeaEventSink;
-
-class IcedTeaPluginInstance : public nsIPluginInstance,
-                              public nsIJVMPluginInstance
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIPLUGININSTANCE
-  NS_DECL_NSIJVMPLUGININSTANCE
-
-  IcedTeaPluginInstance (IcedTeaPluginFactory* factory);
-  ~IcedTeaPluginInstance ();
-
-  void GetWindow ();
-
-  nsIPluginInstancePeer* peer;
-  PRBool initialized;
-  PRBool fatalErrorOccurred;
-
-private:
-
-  PLUGIN_JAVASCRIPT_TYPE liveconnect_window;
-  gpointer window_handle;
-  guint32 window_width;
-  guint32 window_height;
-  PRBool is_active;
-  // FIXME: nsCOMPtr.
-  IcedTeaPluginFactory* factory;
-  PRUint32 instance_identifier;
-  nsCString instanceIdentifierPrefix;
-};
-
-
-#include <nsISocketProviderService.h>
-#include <nsISocketProvider.h>
-#include <nsIServerSocket.h>
-#include <nsIComponentManager.h>
-#include <nsIPluginInstance.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-class IcedTeaSocketListener : public nsIServerSocketListener
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSISERVERSOCKETLISTENER
-
-  IcedTeaSocketListener (IcedTeaPluginFactory* factory);
-
-private:
-  ~IcedTeaSocketListener ();
-  IcedTeaPluginFactory* factory;
-protected:
-};
-
-#include <nsITransport.h>
-
-class IcedTeaEventSink : public nsITransportEventSink
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSITRANSPORTEVENTSINK
-
-  IcedTeaEventSink();
-
-private:
-  ~IcedTeaEventSink();
-};
-
-#include <nsISupports.h>
-#include <nsISecureEnv.h>
-#include <nsISecurityContext.h>
-#include <nsIServerSocket.h>
-#include <nsNetCID.h>
-#include <nsThreadUtils.h>
-#include <nsIThreadManager.h>
-#include <nsIThread.h>
-#include <nsXPCOMCIDInternal.h>
-
-class IcedTeaJNIEnv : public nsISecureEnv
-{
-  NS_DECL_ISUPPORTS
-
-  // nsISecureEnv does not provide an NS_DECL macro.
-public:
-  IcedTeaJNIEnv (IcedTeaPluginFactory* factory);
-
-  NS_IMETHOD NewObject (jclass clazz,
-                        jmethodID methodID,
-                        jvalue* args,
-                        jobject* result,
-                        nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD CallMethod (jni_type type,
-                         jobject obj,
-                         jmethodID methodID,
-                         jvalue* args,
-                         jvalue* result,
-                         nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD CallNonvirtualMethod (jni_type type,
-                                   jobject obj,
-                                   jclass clazz,
-                                   jmethodID methodID,
-                                   jvalue* args,
-                                   jvalue* result,
-                                   nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD GetField (jni_type type,
-                       jobject obj,
-                       jfieldID fieldID,
-                       jvalue* result,
-                       nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD SetField (jni_type type,
-                       jobject obj,
-                       jfieldID fieldID,
-                       jvalue val,
-                       nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD CallStaticMethod (jni_type type,
-                               jclass clazz,
-                               jmethodID methodID,
-                               jvalue* args,
-                               jvalue* result,
-                               nsISecurityContext* ctx = NULL);
-
-  NS_IMETHOD GetStaticField (jni_type type,
-                             jclass clazz,
-                             jfieldID fieldID,
-                             jvalue* result,
-                             nsISecurityContext* ctx = NULL);
-
-
-  NS_IMETHOD SetStaticField (jni_type type,
-                             jclass clazz,
-                             jfieldID fieldID,
-                             jvalue val,
-                             nsISecurityContext* ctx = NULL);
-
-
-  NS_IMETHOD GetVersion (jint* version);
-
-  NS_IMETHOD DefineClass (char const* name,
-                          jobject loader,
-                          jbyte const* buf,
-                          jsize len,
-                          jclass* clazz);
-
-  NS_IMETHOD FindClass (char const* name,
-                        jclass* clazz);
-
-  NS_IMETHOD GetSuperclass (jclass sub,
-                            jclass* super);
-
-  NS_IMETHOD IsAssignableFrom (jclass sub,
-                               jclass super,
-                               jboolean* result);
-
-  NS_IMETHOD Throw (jthrowable obj,
-                    jint* result);
-
-  NS_IMETHOD ThrowNew (jclass clazz,
-                       char const* msg,
-                       jint* result);
-
-  NS_IMETHOD ExceptionOccurred (jthrowable* result);
-
-  NS_IMETHOD ExceptionDescribe (void);
-
-  NS_IMETHOD ExceptionClear (void);
-
-  NS_IMETHOD FatalError (char const* msg);
-
-  NS_IMETHOD NewGlobalRef (jobject lobj,
-                           jobject* result);
-
-  NS_IMETHOD DeleteGlobalRef (jobject gref);
-
-  NS_IMETHOD DeleteLocalRef (jobject obj);
-
-  NS_IMETHOD IsSameObject (jobject obj1,
-                           jobject obj2,
-                           jboolean* result);
-
-  NS_IMETHOD AllocObject (jclass clazz,
-                          jobject* result);
-
-  NS_IMETHOD GetObjectClass (jobject obj,
-                             jclass* result);
-
-  NS_IMETHOD IsInstanceOf (jobject obj,
-                           jclass clazz,
-                           jboolean* result);
-
-  NS_IMETHOD GetMethodID (jclass clazz,
-                          char const* name,
-                          char const* sig,
-                          jmethodID* id);
-
-  NS_IMETHOD GetFieldID (jclass clazz,
-                         char const* name,
-                         char const* sig,
-                         jfieldID* id);
-
-  NS_IMETHOD GetStaticMethodID (jclass clazz,
-                                char const* name,
-                                char const* sig,
-                                jmethodID* id);
-
-  NS_IMETHOD GetStaticFieldID (jclass clazz,
-                               char const* name,
-                               char const* sig,
-                               jfieldID* id);
-
-  NS_IMETHOD NewString (jchar const* unicode,
-                        jsize len,
-                        jstring* result);
-
-  NS_IMETHOD GetStringLength (jstring str,
-                              jsize* result);
-
-  NS_IMETHOD GetStringChars (jstring str,
-                             jboolean* isCopy,
-                             jchar const** result);
-
-  NS_IMETHOD ReleaseStringChars (jstring str,
-                                 jchar const* chars);
-
-  NS_IMETHOD NewStringUTF (char const* utf,
-                           jstring* result);
-
-  NS_IMETHOD GetStringUTFLength (jstring str,
-                                 jsize* result);
-
-  NS_IMETHOD GetStringUTFChars (jstring str,
-                                jboolean* isCopy,
-                                char const** result);
-
-  NS_IMETHOD ReleaseStringUTFChars (jstring str,
-                                    char const* chars);
-
-  NS_IMETHOD GetArrayLength (jarray array,
-                             jsize* result);
-
-  NS_IMETHOD NewObjectArray (jsize len,
-                             jclass clazz,
-                             jobject init,
-                             jobjectArray* result);
-
-  NS_IMETHOD GetObjectArrayElement (jobjectArray array,
-                                    jsize index,
-                                    jobject* result);
-
-  NS_IMETHOD SetObjectArrayElement (jobjectArray array,
-                                    jsize index,
-                                    jobject val);
-
-  NS_IMETHOD NewArray (jni_type element_type,
-                       jsize len,
-                       jarray* result);
-
-  NS_IMETHOD GetArrayElements (jni_type type,
-                               jarray array,
-                               jboolean* isCopy,
-                               void* result);
-
-  NS_IMETHOD ReleaseArrayElements (jni_type type,
-                                   jarray array,
-                                   void* elems,
-                                   jint mode);
-
-  NS_IMETHOD GetArrayRegion (jni_type type,
-                             jarray array,
-                             jsize start,
-                             jsize len,
-                             void* buf);
-
-  NS_IMETHOD SetArrayRegion (jni_type type,
-                             jarray array,
-                             jsize start,
-                             jsize len,
-                             void* buf);
-
-  NS_IMETHOD RegisterNatives (jclass clazz,
-                              JNINativeMethod const* methods,
-                              jint nMethods,
-                              jint* result);
-
-  NS_IMETHOD UnregisterNatives (jclass clazz,
-                                jint* result);
-
-  NS_IMETHOD MonitorEnter (jobject obj,
-                           jint* result);
-
-  NS_IMETHOD MonitorExit (jobject obj,
-                          jint* result);
-
-  NS_IMETHOD GetJavaVM (JavaVM** vm,
-                        jint* result);
-
-  jvalue ParseValue (jni_type type, nsCString& str);
-  char* ExpandArgs (JNIID* id, jvalue* args);
-  char* ValueString (jni_type type, jvalue value);
-
-private:
-  ~IcedTeaJNIEnv ();
-
-  IcedTeaPluginFactory* factory;
-
-  PRMonitor *contextCounterPRMonitor;
-
-  int IncrementContextCounter();
-  void DecrementContextCounter();
-  nsresult GetCurrentContextAddr(char *addr);
-  nsresult GetCurrentPageAddress(const char **addr);
-  nsresult GetEnabledPrivileges(nsCString *privileges, nsISecurityContext *ctx);
-  int contextCounter;
-};
-
-
-#include <nsIServerSocket.h>
-#include <nsNetError.h>
-#include <nsPIPluginInstancePeer.h>
-#include <nsIPluginInstanceOwner.h>
-#include <nsIRunnable.h>
-
-class IcedTeaRunnable : public nsIRunnable
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIRUNNABLE
-
-  IcedTeaRunnable ();
-
-  ~IcedTeaRunnable ();
-};
-
-NS_IMPL_ISUPPORTS1 (IcedTeaRunnable, nsIRunnable)
-
-IcedTeaRunnable::IcedTeaRunnable ()
-{
-}
-
-IcedTeaRunnable::~IcedTeaRunnable ()
-{
-}
-
-NS_IMETHODIMP
-IcedTeaRunnable::Run ()
-{
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-template <class T>
-class IcedTeaRunnableMethod : public IcedTeaRunnable
-{
-public:
-  typedef void (T::*Method) ();
-
-  IcedTeaRunnableMethod (T* object, Method method);
-  NS_IMETHOD Run ();
-
-  ~IcedTeaRunnableMethod ();
-
-  T* object;
-  Method method;
-};
-
-template <class T>
-IcedTeaRunnableMethod<T>::IcedTeaRunnableMethod (T* object, Method method)
-: object (object),
-  method (method)
-{
-  NS_ADDREF (object);
-}
-
-template <class T>
-IcedTeaRunnableMethod<T>::~IcedTeaRunnableMethod ()
-{
-  NS_RELEASE (object);
-}
-
-template <class T> NS_IMETHODIMP
-IcedTeaRunnableMethod<T>::Run ()
-{
-    (object->*method) ();
-    return NS_OK;
-}
-
-
-// FIXME: Special class just for dispatching GetURL to another 
-// thread.. seriously, a class just for that? there has to be a better way!
-
-class GetURLRunnable : public nsIRunnable
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIRUNNABLE
-
-  GetURLRunnable (nsIPluginInstancePeer* peer, nsCString url, nsCString target);
-
-  ~GetURLRunnable ();
-
-private:
-  nsIPluginInstancePeer* peer;
-  nsCString url;
-  nsCString target;
-};
-
-NS_IMPL_ISUPPORTS1 (GetURLRunnable, nsIRunnable)
-
-GetURLRunnable::GetURLRunnable (nsIPluginInstancePeer* peer, nsCString url, nsCString target)
-: peer(peer),
-  url(url),
-  target(target)
-{
-    NS_ADDREF (peer);
-}
-
-GetURLRunnable::~GetURLRunnable ()
-{
-  NS_RELEASE(peer);
-}
-
-NS_IMETHODIMP
-GetURLRunnable::Run ()
-{
-   nsCOMPtr<nsPIPluginInstancePeer> ownerGetter =
-                do_QueryInterface (peer);
-   nsIPluginInstanceOwner* owner = nsnull;
-   ownerGetter->GetOwner (&owner);
-
-   return owner->GetURL ((const char*) url.get(), (const char*) target.get(),
-                         nsnull, 0, nsnull, 0);
-}
-
-NS_IMPL_ISUPPORTS6 (IcedTeaPluginFactory, nsIFactory, nsIPlugin, nsIJVMManager,
-                    nsIJVMPlugin, nsIJVMConsole, nsIInputStreamCallback)
-
-// IcedTeaPluginFactory functions.
-IcedTeaPluginFactory::IcedTeaPluginFactory ()
-: next_instance_identifier (1),
-  proxyEnv (0),
-  javascript_identifier (0),
-  name_identifier (0),
-  args_identifier (0),
-  string_identifier (0),
-  slot_index (0),
-  value_identifier (0),
-  connected (PR_FALSE),
-  liveconnect (0),
-  instance_count(0),
-  shutting_down(PR_FALSE),
-  in_pipe_name(NULL),
-  in_watch_source(NULL),
-  out_pipe_name(NULL),
-  out_watch_source(NULL),
-  out_to_appletviewer(NULL)
-{
-  plugin_debug = getenv ("ICEDTEAPLUGIN_DEBUG") != NULL;
-  PLUGIN_TRACE_FACTORY ();
-  instances.Init ();
-  references.Init ();
-  js_cleared_handles.Init();
-  result_map.Init();
-  PLUGIN_DEBUG_0ARG ("CONSTRUCTING FACTORY\n");
-  PLUGIN_DEBUG_1ARG("ICEDTEAPLUGIN_DEBUG = %s\n", getenv ("ICEDTEAPLUGIN_DEBUG"));
-}
-
-IcedTeaPluginFactory::~IcedTeaPluginFactory ()
-{
-  // FIXME: why did this crash with threadManager == 0x0 on shutdown?
-  PLUGIN_TRACE_FACTORY ();
-  secureEnv = 0;
-  factory_created = PR_FALSE;
-  factory = NULL;
-  PLUGIN_DEBUG_0ARG ("DECONSTRUCTING FACTORY\n");
-
-  // Removing a source is harmless if it fails since it just means the
-  // source has already been removed.
-  if (in_watch_source)
-    g_source_remove (in_watch_source);
-  in_watch_source = 0;
-
-  // free input channel
-  if (in_from_appletviewer)
-    g_io_channel_unref (in_from_appletviewer);
-  in_from_appletviewer = NULL;
-
-  // cleanup_out_watch_source:
-  if (out_watch_source)
-    g_source_remove (out_watch_source);
-  out_watch_source = 0;
-
-  // free output channel
-  if (out_to_appletviewer)
-    g_io_channel_unref (out_to_appletviewer);
-  out_to_appletviewer = NULL;
-
-  // free its memory
-  if (out_pipe_name)
-  {
-    // Delete output pipe.
-    unlink (out_pipe_name);
-
-    g_free (out_pipe_name);
-    out_pipe_name = NULL;
-  }
-
-  if (in_pipe_name)
-  {
-    // Delete input pipe.
-    unlink (in_pipe_name);
-
-    // free its memory
-    g_free (in_pipe_name);
-    in_pipe_name = NULL;
-  }
-}
-
-// nsIFactory functions.
-NS_IMETHODIMP
-IcedTeaPluginFactory::CreateInstance (nsISupports* aOuter, nsIID const& iid,
-                                      void** result)
-{
-  PLUGIN_TRACE_FACTORY ();
-  if (!result)
-    return NS_ERROR_NULL_POINTER;
-
-  *result = NULL;
-
-  IcedTeaPluginInstance* instance = new IcedTeaPluginInstance (this);
-
-  if (!instance)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  instance_count++;
-  return instance->QueryInterface (iid, result);
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::LockFactory (PRBool lock)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// nsIPlugin functions.
-NS_IMETHODIMP
-IcedTeaPluginFactory::CreatePluginInstance (nsISupports* aOuter,
-                                            nsIID const& aIID,
-                                            char const* aPluginMIMEType,
-                                            void** aResult)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::Initialize ()
-{
-  PLUGIN_TRACE_FACTORY ();
-  nsresult result = NS_OK;
-
-  PLUGIN_DEBUG_TWO ("Factory::Initialize: using", appletviewer_executable);
-
-  nsCOMPtr<nsIComponentManager> manager;
-  result = NS_GetComponentManager (getter_AddRefs (manager));
-
-  jvmMsgQueuePRMonitor = PR_NewMonitor();
-
-  nsCOMPtr<nsIThreadManager> threadManager;
-  result = manager->CreateInstanceByContractID
-    (NS_THREADMANAGER_CONTRACTID, nsnull, NS_GET_IID (nsIThreadManager),
-     getter_AddRefs (threadManager));
-  PLUGIN_CHECK_RETURN ("thread manager", result);
-
-  result = threadManager->GetCurrentThread (getter_AddRefs (current));
-  PLUGIN_CHECK_RETURN ("current thread", result);
-
-  if (jvm_attached == PR_FALSE)
-  {
-    // using printf on purpose.. this should happen rarely
-    PLUGIN_DEBUG_0ARG("Initializing JVM...\n");
-
-    // mark attached right away, in case another initialize() call 
-    //is made (happens if multiple applets are present on the same page)
-    jvm_attached = PR_TRUE;
-    InitializeJava();
-  }
-
-  return NS_OK;
-}
-
-void
-IcedTeaPluginFactory::InitializeJava ()
-{
-
-  PRBool processed;
-  nsresult result;
-
-  // Start appletviewer process for this plugin instance.
-  nsCOMPtr<nsIComponentManager> manager;
-  result = NS_GetComponentManager (getter_AddRefs (manager));
-  PLUGIN_CHECK ("get component manager", result);
-
-  result = manager->CreateInstance
-    (nsILiveconnect::GetCID (),
-     nsnull, NS_GET_IID (nsILiveconnect),
-     getter_AddRefs (liveconnect));
-  PLUGIN_CHECK ("liveconnect", result);
-
-  nsCOMPtr<nsIThreadManager> threadManager;
-  nsCOMPtr<nsIThread> curr_thread;
-  result = manager->CreateInstanceByContractID
-    (NS_THREADMANAGER_CONTRACTID, nsnull, NS_GET_IID (nsIThreadManager),
-     getter_AddRefs (threadManager));
-  PLUGIN_CHECK ("thread manager", result);
-
-  result = threadManager->GetCurrentThread (getter_AddRefs (curr_thread));
-
-  result = StartAppletviewer ();
-  PLUGIN_CHECK ("started appletviewer", result);
-}
-
-void
-IcedTeaPluginFactory::MarkInstancesVoid ()
-{
-      PLUGIN_TRACE_FACTORY ();
-	
-      IcedTeaPluginInstance* instance = NULL;
-
-      int instance_id = 1;
-
-      while (instance_id <= instance_count)
-	  {
-		if (instances.Get(instance_id, &instance))
-		{
-            PLUGIN_DEBUG_2ARG("Marking %d of %d void\n", instance_id, instance_count);
-            instance->fatalErrorOccurred = PR_TRUE;
-	    }
-		instance_id++;
-	  }
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::Shutdown ()
-{
-  shutting_down = PR_TRUE;
-
-  nsCString shutdownStr("shutdown");
-  SendMessageToAppletViewer(shutdownStr);
-
-  // wake up process thread to tell it to shutdown
-  PRThread *prThread;
-  processThread->GetPRThread(&prThread);
-  PLUGIN_DEBUG_0ARG ("Interrupting process thread...");
-  PRStatus res = PR_Interrupt(prThread);
-  PLUGIN_DEBUG_0ARG (" done!\n");
-
-  PRInt32 exitVal;
-  applet_viewer_process->GetExitValue(&exitVal);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetMIMEDescription (char const** aMIMEDescription)
-{
-  PLUGIN_TRACE_FACTORY ();
-  *aMIMEDescription = PLUGIN_MIME_DESC;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetValue (nsPluginVariable aVariable, void* aValue)
-{
-  PLUGIN_TRACE_FACTORY ();
-  nsresult result = NS_OK;
-
-  switch (aVariable)
-    {
-    case nsPluginVariable_NameString:
-      *static_cast<char const**> (aValue) = PLUGIN_NAME;
-      break;
-    case nsPluginVariable_DescriptionString:
-      *static_cast<char const**> (aValue) = PLUGIN_DESCRIPTION;
-      break;
-    default:
-      PLUGIN_ERROR ("Unknown plugin value requested.");
-      result = NS_ERROR_INVALID_ARG;
-      break;
-    }
-
-  return result;
-}
-
-// nsIJVMManager functions.
-NS_IMETHODIMP
-IcedTeaPluginFactory::CreateProxyJNI (nsISecureEnv* secureEnv,
-                                      JNIEnv** outProxyEnv)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetProxyJNI (JNIEnv** outProxyEnv)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::ShowJavaConsole ()
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::IsAllPermissionGranted (char const* lastFingerprint,
-                                              char const* lastCommonName,
-                                              char const* rootFingerprint,
-                                              char const* rootCommonName,
-                                              PRBool* _retval)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::IsAppletTrusted (char const* aRSABuf, PRUint32 aRSABufLen,
-                                       char const* aPlaintext,
-                                       PRUint32 aPlaintextLen,
-                                       PRBool* isTrusted,
-                                       nsIPrincipal**_retval)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetJavaEnabled (PRBool* aJavaEnabled)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-#include <typeinfo>
-
-// nsIJVMConsole functions.
-NS_IMETHODIMP
-IcedTeaPluginFactory::Show (void)
-{
-  nsCString msg("plugin showconsole");
-  this->SendMessageToAppletViewer(msg);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::Hide (void)
-{
-  nsCString msg("plugin hideconsole");
-  this->SendMessageToAppletViewer(msg);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::IsVisible(PRBool* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::AddToClassPath (char const* dirPath)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::RemoveFromClassPath (char const* dirPath)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetClassPath (char const** result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetJavaWrapper (JNIEnv* jenv, PLUGIN_JAVASCRIPT_TYPE obj,
-                                      jobject* jobj)
-{
-  jclass clazz;
-  jmethodID method;
-  jobject newobject;
-  jvalue args[1];
-  secureEnv->FindClass ("netscape.javascript.JSObject", &clazz);
-  secureEnv->GetMethodID (clazz, "<init>",
-                          PLUGIN_JAVASCRIPT_SIGNATURE, &method);
-  PLUGIN_INITIALIZE_JAVASCRIPT_ARGUMENT(args, obj);
-  secureEnv->NewObject (clazz, method, args, &newobject);
-  *jobj = newobject;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::CreateSecureEnv (JNIEnv* proxyEnv,
-                                       nsISecureEnv** outSecureEnv)
-{
-  PLUGIN_TRACE_FACTORY ();
-  *outSecureEnv = new IcedTeaJNIEnv (this);
-  secureEnv = *outSecureEnv;
-  IcedTeaPluginFactory::proxyEnv = proxyEnv;
-
-  jclass clazz;
-  jclass stringclazz;
-  jmethodID method;
-  jfieldID field;
-  jvalue result;
-  jvalue val;
-  jvalue args[1];
-  jarray array;
-  jobjectArray objectarray;
-  jobject newobject;
-  jobject newglobalobject;
-  jsize length;
-  jboolean isCopy;
-  char const* str;
-  jchar const* jstr;
-  jclass superclazz;
-  jclass resultclazz;
-  jboolean resultbool;
-
-  PLUGIN_DEBUG_0ARG ("CREATESECUREENV\n");
-#if 0
-
-  // IcedTeaJNIEnv::AllocObject
-  // IcedTeaJNIEnv::CallMethod
-  // IcedTeaJNIEnv::CallNonvirtualMethod
-  // IcedTeaJNIEnv::CallStaticMethod
-  // IcedTeaJNIEnv::DefineClass
-  // IcedTeaJNIEnv::DeleteGlobalRef
-  // IcedTeaJNIEnv::DeleteLocalRef
-  // IcedTeaJNIEnv::ExceptionClear
-  // IcedTeaJNIEnv::ExceptionDescribe
-  // IcedTeaJNIEnv::ExceptionOccurred
-  // IcedTeaJNIEnv::ExpandArgs
-  // IcedTeaJNIEnv::FatalError
-  // IcedTeaJNIEnv::FindClass
-  // IcedTeaJNIEnv::GetArrayElements
-  // IcedTeaJNIEnv::GetArrayLength
-  // IcedTeaJNIEnv::GetArrayRegion
-  // IcedTeaJNIEnv::GetFieldID
-  // IcedTeaJNIEnv::GetField
-  // IcedTeaJNIEnv::GetJavaVM
-  // IcedTeaJNIEnv::GetMethodID
-  // IcedTeaJNIEnv::GetObjectArrayElement
-  // IcedTeaJNIEnv::GetObjectClass
-  // IcedTeaJNIEnv::GetStaticFieldID
-  // IcedTeaJNIEnv::GetStaticField
-  // IcedTeaJNIEnv::GetStaticMethodID
-  // IcedTeaJNIEnv::GetStringChars
-  // IcedTeaJNIEnv::GetStringLength
-  // IcedTeaJNIEnv::GetStringUTFChars
-  // IcedTeaJNIEnv::GetStringUTFLength
-  // IcedTeaJNIEnv::GetSuperclass
-  // IcedTeaJNIEnv::GetVersion
-  // IcedTeaJNIEnv::~IcedTeaJNIEnv
-  // IcedTeaJNIEnv::IcedTeaJNIEnv
-  // IcedTeaJNIEnv::IsAssignableFrom
-  // IcedTeaJNIEnv::IsInstanceOf
-  // IcedTeaJNIEnv::IsSameObject
-  // IcedTeaJNIEnv::MonitorEnter
-  // IcedTeaJNIEnv::MonitorExit
-  // IcedTeaJNIEnv::NewArray
-  // IcedTeaJNIEnv::NewGlobalRef
-  // IcedTeaJNIEnv::NewObjectArray
-  // IcedTeaJNIEnv::NewObject
-  // IcedTeaJNIEnv::NewString
-  // IcedTeaJNIEnv::NewStringUTF
-  // IcedTeaJNIEnv::ParseValue
-  // IcedTeaJNIEnv::RegisterNatives
-  // IcedTeaJNIEnv::ReleaseArrayElements
-  // IcedTeaJNIEnv::ReleaseStringChars
-  // IcedTeaJNIEnv::ReleaseStringUTFChars
-  // IcedTeaJNIEnv::SetArrayRegion
-  // IcedTeaJNIEnv::SetField
-  // IcedTeaJNIEnv::SetObjectArrayElement
-  // IcedTeaJNIEnv::SetStaticField
-  // IcedTeaJNIEnv::Throw
-  // IcedTeaJNIEnv::ThrowNew
-  // IcedTeaJNIEnv::UnregisterNatives
-  // IcedTeaJNIEnv::ValueString
-
-  (*outSecureEnv)->FindClass ("sun.applet.TestEnv", &clazz);
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestIt", "()V", &method);
-  result.i = -1;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, NULL, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (void)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItBool", "(Z)V", &method);
-  args[0].z = 1;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (bool)");
-  args[0].z = 0;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (bool)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItByte", "(B)V", &method);
-  args[0].b = 0x35;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (byte)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItChar", "(C)V", &method);
-  args[0].c = 'a';
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (char)");
-  args[0].c = 'T';
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (char)");
-  args[0].c = static_cast<jchar> (0x6C34);
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (char)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItShort", "(S)V", &method);
-  args[0].s = 254;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (short)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItInt", "(I)V", &method);
-  args[0].i = 68477325;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (int)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItLong", "(J)V", &method);
-  args[0].j = 268435455;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (long)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItFloat", "(F)V", &method);
-  args[0].f = 2.6843;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (float)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItDouble", "(D)V", &method);
-  args[0].d = 3.6843E32;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (double)");
-
-  (*outSecureEnv)->GetMethodID (clazz, "<init>", "()V", &method);
-  PLUGIN_DEBUG_0ARG ("HERE1\n");
-  (*outSecureEnv)->NewObject (clazz, method, NULL, &newobject);
-  PLUGIN_DEBUG_0ARG ("HERE2\n");
-  (*outSecureEnv)->IsSameObject (newobject, newobject, &resultbool);
-  PLUGIN_TEST (resultbool, "IsSameObject: obj, obj");
-  (*outSecureEnv)->IsSameObject (newobject, NULL, &resultbool);
-  PLUGIN_TEST (!resultbool, "IsSameObject: obj, NULL");
-  (*outSecureEnv)->IsSameObject (NULL, newobject, &resultbool);
-  PLUGIN_TEST (!resultbool, "IsSameObject: NULL, obj");
-  (*outSecureEnv)->IsSameObject (NULL, NULL, &resultbool);
-  PLUGIN_TEST (resultbool, "IsSameObject: NULL, NULL");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObject",
-                                      "(Lsun/applet/TestEnv;)V", &method);
-  args[0].l = newobject;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (object)");
-
-  
-  PLUGIN_DEBUG_0ARG ("HERE3\n");
-  (*outSecureEnv)->NewGlobalRef (newobject, &newglobalobject);
-  PLUGIN_DEBUG_0ARG ("HERE4\n");
-  (*outSecureEnv)->DeleteLocalRef (newobject);
-  PLUGIN_DEBUG_0ARG ("HERE5\n");
-  (*outSecureEnv)->DeleteGlobalRef (newglobalobject);
-  PLUGIN_DEBUG_0ARG ("HERE6\n");
-
-  (*outSecureEnv)->NewArray (jint_type, 10, &array);
-  (*outSecureEnv)->GetArrayLength (array, &length);
-  PLUGIN_TEST (length == 10, "GetArrayLength");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItIntArray", "([I)V",
-                                      &method);
-  args[0].l = array;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (int_array)");
-
-  (*outSecureEnv)->FindClass ("java.lang.String", &stringclazz);
-  (*outSecureEnv)->NewObjectArray (10, stringclazz, NULL, &objectarray);
-  (*outSecureEnv)->GetMethodID (stringclazz, "<init>", "()V", &method);
-  (*outSecureEnv)->NewObject (stringclazz, method, NULL, &newobject);
-  (*outSecureEnv)->SetObjectArrayElement (objectarray, 3, newobject);
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectArray",
-                                      "([Ljava/lang/String;)V", &method);
-  args[0].l = objectarray;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (result.i == 0, "CallStaticMethod: static void (object_array)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItBoolReturnTrue", "()Z",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jboolean_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.z == JNI_TRUE, "CallStaticMethod: static bool (void)");
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItBoolReturnFalse", "()Z",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jboolean_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.z == JNI_FALSE, "CallStaticMethod: static bool (void)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItByteReturn", "()B",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jbyte_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.b == static_cast<jbyte> (0xfe),
-               "CallStaticMethod: static byte (void)");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItCharReturn", "()C",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jchar_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.c == 'K', "CHAR STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItCharUnicodeReturn", "()C",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jchar_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.c == static_cast<jchar> (0x6C34), "char static void: 0x6c34");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItShortReturn", "()S",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jshort_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.s == static_cast<jshort> (23), "SHORT STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItIntReturn", "()I",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jint_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.i == 3445, "INT STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItLongReturn", "()J",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jlong_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.j == 3242883, "LONG STATIC VOID");
-  
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItFloatReturn", "()F",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jfloat_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.f == 9.21E4f, "FLOAT STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItDoubleReturn", "()D",
-                                      &method);
-  (*outSecureEnv)->CallStaticMethod (jdouble_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (result.d == 8.33E88, "DOUBLE STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectReturn",
-                                      "()Ljava/lang/Object;", &method);
-  (*outSecureEnv)->CallStaticMethod (jobject_type, clazz, method, NULL,
-                                     &result);
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectString",
-                                      "(Ljava/lang/String;)V", &method);
-  args[0].l = result.l;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  // FIXME:
-  PLUGIN_TEST (1, "RETURNED OBJECT");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItIntArrayReturn", "()[I",
-                                      &method);
-  PLUGIN_DEBUG_1ARG ("GOT METHOD: %d\n", reinterpret_cast<JNIID*> (method)->identifier);
-  (*outSecureEnv)->CallStaticMethod (jobject_type, clazz, method, NULL,
-                                     &result);
-  // FIXME:
-  PLUGIN_TEST (1, "INT ARRAY STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItIntArray", "([I)V",
-                                      &method);
-  args[0].l = result.l;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (1, "RETURNED INT ARRAY");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectArrayReturn",
-                                      "()[Ljava/lang/String;", &method);
-  (*outSecureEnv)->CallStaticMethod (jobject_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (1, "OBJECT ARRAY STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectArray",
-                                      "([Ljava/lang/String;)V", &method);
-  args[0].l = result.l;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (1, "RETURNED OBJECT ARRAY");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectArrayMultiReturn",
-                                      "()[[Ljava/lang/String;", &method);
-  (*outSecureEnv)->CallStaticMethod (jobject_type, clazz, method, NULL,
-                                     &result);
-  PLUGIN_TEST (1, "OBJECT MULTIDIMENTIONAL ARRAY STATIC VOID");
-
-  (*outSecureEnv)->GetStaticMethodID (clazz, "TestItObjectArrayMulti",
-                                      "([[Ljava/lang/String;)V", &method);
-  args[0].l = result.l;
-  (*outSecureEnv)->CallStaticMethod (jvoid_type, clazz, method, args, &result);
-  PLUGIN_TEST (1, "RETURNED OBJECT MULTIDIMENTIONAL ARRAY");
-
-  (*outSecureEnv)->GetStaticFieldID (clazz, "intField", "I",
-                                     &field);
-  (*outSecureEnv)->GetStaticField (jint_type, clazz, field, &result);
-  val.i = 788;
-  (*outSecureEnv)->SetStaticField (jint_type, clazz, field, val);
-  (*outSecureEnv)->GetStaticField (jint_type, clazz, field, &result);
-  PLUGIN_TEST (1, "STATIC INT");
-  PLUGIN_TEST (result.i == 788, "OBJECT STATIC VOID");
-
-  (*outSecureEnv)->GetMethodID (clazz, "<init>", "()V", &method);
-  (*outSecureEnv)->NewObject (clazz, method, NULL, &newobject);
-  (*outSecureEnv)->GetMethodID (clazz, "TestItIntInstance", "(I)I", &method);
-  args[0].i = 6322;
-  (*outSecureEnv)->CallMethod (jint_type, newobject, method, args, &result);
-  PLUGIN_TEST (result.i == 899, "NEW OBJECT");
-
-  (*outSecureEnv)->GetFieldID (clazz, "intInstanceField", "I", &field);
-  (*outSecureEnv)->GetField (jint_type, newobject, field, &result);
-  val.i = 3224;
-  (*outSecureEnv)->SetField (jint_type, newobject, field, val);
-  (*outSecureEnv)->GetField (jint_type, newobject, field, &result);
-  PLUGIN_TEST (result.i == 3224, "int field: 3224");
-
-  (*outSecureEnv)->GetFieldID (clazz, "stringField",
-                               "Ljava/lang/String;", &field);
-  (*outSecureEnv)->GetField (jobject_type, newobject, field, &result);
-  (*outSecureEnv)->GetStringUTFLength (
-    reinterpret_cast<jstring> (result.l), &length);
-  PLUGIN_TEST (length == 5, "UTF-8 STRING");
-  (*outSecureEnv)->GetStringUTFChars (
-    reinterpret_cast<jstring> (result.l), &isCopy, &str);
-  PLUGIN_TEST (!strcmp (str, "hello"), "HI");
-
-  (*outSecureEnv)->GetFieldID (clazz, "complexStringField",
-                               "Ljava/lang/String;", &field);
-  (*outSecureEnv)->GetField (jobject_type, newobject, field, &result);
-  (*outSecureEnv)->GetStringUTFLength (
-    reinterpret_cast<jstring> (result.l), &length);
-  PLUGIN_TEST (length == 4, "HI");
-  (*outSecureEnv)->GetStringUTFChars (
-    reinterpret_cast<jstring> (result.l), &isCopy, &str);
-  char expected1[8] = { 0x7A, 0xF0, 0x9D, 0x84, 0x9E, 0xE6, 0xB0, 0xB4 };
-  PLUGIN_TEST (!memcmp (str, expected1, 8),
-               "string field: 0x7A, 0xF0, 0x9D, 0x84, 0x9E, 0xE6, 0xB0, 0xB4");
-
-  (*outSecureEnv)->GetFieldID (clazz, "stringField",
-                               "Ljava/lang/String;", &field);
-  (*outSecureEnv)->GetField (jobject_type, newobject, field, &result);
-  (*outSecureEnv)->GetStringLength (
-    reinterpret_cast<jstring> (result.l), &length);
-  PLUGIN_TEST (length == 5, "UTF-16 STRING");
-  (*outSecureEnv)->GetStringChars (
-    reinterpret_cast<jstring> (result.l), &isCopy, &jstr);
-  char expected2[10] = { 'h', 0x0, 'e', 0x0, 'l', 0x0, 'l', 0x0, 'o', 0x0 };
-  PLUGIN_TEST (!memcmp (jstr, expected2, 10), "string field: hello");
-
-  (*outSecureEnv)->GetFieldID (clazz, "complexStringField",
-                               "Ljava/lang/String;", &field);
-  (*outSecureEnv)->GetField (jobject_type, newobject, field, &result);
-  (*outSecureEnv)->GetStringLength (
-    reinterpret_cast<jstring> (result.l), &length);
-  PLUGIN_TEST (length == 4, "HI");
-  (*outSecureEnv)->GetStringChars (
-    reinterpret_cast<jstring> (result.l), &isCopy, &jstr);
-  char expected3[8] = { 0x7A, 0x00, 0x34, 0xD8, 0x1E, 0xDD, 0x34, 0x6C };
-  PLUGIN_TEST (!memcmp (jstr, expected3, 8),
-               "string field: 0x7A, 0x00, 0x34, 0xD8, 0x1E, 0xDD, 0x34, 0x6C");
-
-  (*outSecureEnv)->FindClass ("java.awt.Container", &clazz);
-  (*outSecureEnv)->FindClass ("java.awt.Component", &superclazz);
-  (*outSecureEnv)->GetSuperclass(clazz, &resultclazz);
-  PLUGIN_TEST (ID (superclazz) == ID (resultclazz), "CLASS HIERARCHY");
-  (*outSecureEnv)->IsAssignableFrom(clazz, superclazz, &resultbool);
-  PLUGIN_TEST (resultbool, "HI");
-  (*outSecureEnv)->IsAssignableFrom(superclazz, clazz, &resultbool);
-  PLUGIN_TEST (!resultbool, "IsAssignableFrom: JNI_FALSE");
-
-  (*outSecureEnv)->FindClass ("java.awt.Container", &clazz);
-  (*outSecureEnv)->GetMethodID (clazz, "<init>", "()V", &method);
-  (*outSecureEnv)->NewObject (clazz, method, NULL, &newobject);
-  (*outSecureEnv)->IsInstanceOf(newobject, clazz, &resultbool);
-  PLUGIN_TEST (resultbool, "IsInstanceOf: JNI_TRUE");
-  (*outSecureEnv)->FindClass ("java.lang.String", &superclazz);
-  (*outSecureEnv)->IsInstanceOf(newobject, superclazz, &resultbool);
-  PLUGIN_TEST (!resultbool, "HI");
-
-  // FIXME: test NewString and NewStringUTF
-#endif
-  // FIXME: call set accessible: these methods should ignore access
-  // permissions (public/protected/package private/private -> public)
-
-  // Test multi-dimentional array passing/return.
-
-  // WRITE EXCEPTION HANDLING.
-  // WRITE ARRAY ELEMENT SETTING/GETTING.
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::SpendTime (PRUint32 timeMillis)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::UnwrapJavaWrapper (JNIEnv* jenv, jobject jobj,
-                                         PLUGIN_JAVASCRIPT_TYPE* obj)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-void
-IcedTeaPluginFactory::DisplayFailureDialog ()
-{
-  PLUGIN_TRACE_FACTORY ();
-  GtkWidget* dialog = NULL;
-
-  dialog = gtk_message_dialog_new (NULL,
-                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                   GTK_MESSAGE_ERROR,
-                                   GTK_BUTTONS_CLOSE,
-                                   FAILURE_MESSAGE,
-                                   appletviewer_executable);
-  gtk_widget_show_all (dialog);
-  gtk_dialog_run (GTK_DIALOG (dialog));
-  gtk_widget_destroy (dialog);
-
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::Print(const char* msg, const char* encoding)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-#include <nsICookieService.h>
-#include <nsIIOService.h>
-#include <nsIScriptSecurityManager.h>
-#include <nsIURI.h>
-#include <nsServiceManagerUtils.h>
-
-NS_IMPL_ISUPPORTS2 (IcedTeaPluginInstance, nsIPluginInstance,
-                    nsIJVMPluginInstance)
-
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::Initialize (nsIPluginInstancePeer* aPeer)
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  // Ensure that there is a jvm running...
- 
-  if (jvm_attached == PR_FALSE)
-  {
-    // using printf on purpose.. this should happen rarely
-    PLUGIN_DEBUG_0ARG("WARNING: Looks like the JVM is not up. Attempting to re-initialize...\n");
-
-    // mark attached right away, in case another initialize() call 
-    //is made (happens if multiple applets are present on the same page)
-    jvm_attached = PR_TRUE;
-    factory->InitializeJava();
-  }
-
-  // Send applet tag message to appletviewer.
-  // FIXME: nsCOMPtr
-  char const* documentbase;
-  unsigned int i = 0;
-  nsresult result = NS_OK;
-
-  nsCOMPtr<nsIPluginTagInfo2> taginfo = do_QueryInterface (aPeer);
-  if (!taginfo)
-    {
-      PLUGIN_ERROR ("Documentbase retrieval failed."
-                    "  Browser not Mozilla-based?");
-      result = NS_ERROR_FAILURE;
-    }
-  taginfo->GetDocumentBase (&documentbase);
-  if (!documentbase)
-    {
-      PLUGIN_ERROR ("Documentbase retrieval failed."
-                    "  Browser not Mozilla-based?");
-      return NS_ERROR_FAILURE;
-    }
-
-  char const* appletTag = NULL;
-  taginfo->GetTagText (&appletTag);
-
-  nsCString tagMessage (instanceIdentifierPrefix);
-  tagMessage += "tag ";
-  tagMessage += documentbase;
-  tagMessage += " ";
-  tagMessage += appletTag;
-  tagMessage += "</embed>";
-
-  PLUGIN_DEBUG_1ARG("TAG FROM BROWSER = %s\n", tagMessage.get());
-
-  // encode newline characters in the message
-  nsCString encodedAppletTag("");
-  for (int i=0; i < tagMessage.Length(); i++)
-  {
-	  if (tagMessage.get()[i] == '\r')
-	  {
-		  encodedAppletTag += "&#13;";
-		  continue;
-	  }
-
-	  if (tagMessage.get()[i] == '\n')
-	  {
-		  encodedAppletTag += "&#10;";
-		  continue;
-	  }
-
-	  encodedAppletTag += tagMessage.get()[i];
-  }
-
-  factory->SendMessageToAppletViewer (encodedAppletTag);
-
-  // Set back-pointer to peer instance.
-  PLUGIN_DEBUG_1ARG ("SETTING PEER!!!: %p\n", aPeer);
-  peer = aPeer;
-  NS_ADDREF (aPeer);
-  PLUGIN_DEBUG_1ARG ("DONE SETTING PEER!!!: %p\n", aPeer);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::GetPeer (nsIPluginInstancePeer** aPeer)
-{
-
-  PRBool processed;
-  nsresult result;
-  while (!peer)
-    {
-      result = factory->current->ProcessNextEvent(PR_TRUE, &processed);
-      PLUGIN_CHECK_RETURN ("wait for peer: process next event", result);
-    }
-
-  PLUGIN_DEBUG_1ARG ("GETTING PEER!!!: %p\n", peer);
-  *aPeer = peer;
-  // FIXME: where is this unref'd?
-  NS_ADDREF (peer);
-  PLUGIN_DEBUG_2ARG ("DONE GETTING PEER!!!: %p, %p\n", peer, *aPeer);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::Start ()
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::Stop ()
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::Destroy ()
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  if (fatalErrorOccurred == PR_TRUE)
-  {
-      return NS_OK;
-  }
-
-  nsCString destroyMessage (instanceIdentifierPrefix);
-  destroyMessage += "destroy";
-  factory->SendMessageToAppletViewer (destroyMessage);
-  is_active = PR_FALSE;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::SetWindow (nsPluginWindow* aWindow)
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  // Simply return if we receive a NULL window.
-  if ((aWindow == NULL) || (aWindow->window == NULL))
-    {
-      PLUGIN_DEBUG ("Instance::SetWindow: got NULL window.");
-
-      return NS_OK;
-    }
-
-  if (window_handle)
-    {
-
-       if (initialized == PR_FALSE) 
-       {
-
-           PLUGIN_DEBUG_1ARG ("IcedTeaPluginInstance::SetWindow: Instance %p waiting for initialization...\n", this);
-
-           long startTime = get_time_in_s();
-           PRBool timedOut = PR_FALSE;
-
-           while (initialized == PR_FALSE && 
-                  this->fatalErrorOccurred == PR_FALSE && 
-                  this->is_active == PR_FALSE) 
-           {
-               PROCESS_PENDING_EVENTS;
-
-               if ((get_time_in_s() - startTime) > TIMEOUT)
-               {
-                   timedOut = PR_TRUE;
-                   break;
-                }
-            }
-
-            // we timed out
-            if (timedOut == PR_TRUE)
-			{
-                PLUGIN_DEBUG_1ARG ("Initialization for instance %d has timed out. Marking it void\n", instance_identifier);
-				this->fatalErrorOccurred = PR_TRUE;
-                return NS_ERROR_FAILURE;
-			}
-
-            // did we bail because there is no jvm?
-            if (this->fatalErrorOccurred == PR_TRUE)
-			{
-				PLUGIN_DEBUG_0ARG("Initialization failed. SetWindow returning\n");
-				return NS_ERROR_FAILURE;
-			}
-
-            PLUGIN_DEBUG_1ARG ("Instance %p initialization complete...\n", this);
-       }
-
-      // The window already exists.
-      if (window_handle == aWindow->window)
-	{
-          // The parent window is the same as in previous calls.
-          PLUGIN_DEBUG ("Instance::SetWindow: window already exists.");
-
-		  nsCString message (instanceIdentifierPrefix);
-		  PRBool changed = PR_FALSE;
-
-          // The window is the same as it was for the last
-          // SetWindow call.
-          if (aWindow->width != window_width)
-            {
-			  // width has changed
-              PLUGIN_DEBUG ("Instance::SetWindow: window width changed.");
-
-			  window_width = aWindow->width;
-			  changed = PR_TRUE;
-            }
-
-          if (aWindow->height != window_height)
-            {
-			  // width has changed
-              PLUGIN_DEBUG ("Instance::SetWindow: window height changed.");
-
-			  window_height = aWindow->height;
-			  changed = PR_TRUE;
-            }
-
-           if (changed == PR_TRUE)
-		   {
-			  message += "width ";
-			  message.AppendInt (window_width);
-              message += " height ";
-              message.AppendInt (window_height);
-              factory->SendMessageToAppletViewer (message);
-		   }
-
-	}
-      else
-	{
-	  // The parent window has changed.  This branch does run but
-	  // doing nothing in response seems to be sufficient.
-	  PLUGIN_DEBUG ("Instance::SetWindow: parent window changed.");
-	}
-    }
-  else
-    {
-      PLUGIN_DEBUG ("Instance::SetWindow: setting window.");
-
-      nsCString windowMessage (instanceIdentifierPrefix);
-      windowMessage += "handle ";
-      windowMessage.AppendInt (reinterpret_cast<PRInt64>
-                               (aWindow->window));
-      factory->SendMessageToAppletViewer (windowMessage);
-
-      // Store the window handle.
-      window_handle = aWindow->window;
-    }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::NewStream (nsIPluginStreamListener** aListener)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::Print (nsPluginPrint* aPlatformPrint)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::GetValue (nsPluginInstanceVariable aVariable,
-                                 void* aValue)
-{
-  PLUGIN_TRACE_INSTANCE ();
-  nsresult result = NS_OK;
-
-  switch (aVariable)
-    {
-    case nsPluginInstanceVariable_WindowlessBool:
-      *static_cast<PRBool*> (aValue) = PR_FALSE;
-      break;
-    case nsPluginInstanceVariable_TransparentBool:
-      *static_cast<PRBool*> (aValue) = PR_FALSE;
-      break;
-    case nsPluginInstanceVariable_DoCacheBool:
-      *static_cast<PRBool*> (aValue) = PR_FALSE;
-      break;
-    case nsPluginInstanceVariable_CallSetWindowAfterDestroyBool:
-      *static_cast<PRBool*> (aValue) = PR_FALSE;
-      break;
-    case nsPluginInstanceVariable_NeedsXEmbed:
-      *static_cast<PRBool*> (aValue) = PR_TRUE;
-      break;
-    case nsPluginInstanceVariable_ScriptableInstance:
-      // Fall through.
-    case nsPluginInstanceVariable_ScriptableIID:
-      // Fall through.
-    default:
-      result = NS_ERROR_INVALID_ARG;
-      PLUGIN_ERROR ("Unknown plugin value");
-    }
-
-  return result;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::HandleEvent (nsPluginEvent* aEvent, PRBool* aHandled)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::GetJavaObject (jobject* object)
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  // wait for instance to initialize
-
-  if (initialized == PR_FALSE) 
-    {
-
-      PLUGIN_DEBUG_1ARG ("IcedTeaPluginInstance::GetJavaObject: Instance %p waiting for initialization...\n", this);
-
-      long startTime = get_time_in_s();
-      PRBool timedOut = PR_FALSE;
-      while (initialized == PR_FALSE && 
-             this->fatalErrorOccurred == PR_FALSE && 
-             this->is_active == PR_FALSE) 
-      {
-          PROCESS_PENDING_EVENTS;
-
-          if ((get_time_in_s() - startTime) > TIMEOUT)
-          {
-              timedOut = PR_TRUE;
-              break;
-           }
-      }
-
-      // we timed out
-      if (timedOut == PR_TRUE)
-	  {
-          PLUGIN_DEBUG_1ARG ("IcedTeaPluginInstance::GetJavaObject: Initialization for instance %d has timed out. Marking it void\n", instance_identifier);
-          this->fatalErrorOccurred = PR_TRUE;
-          return NS_ERROR_FAILURE;
-	  }
-
-      PLUGIN_DEBUG_1ARG ("Instance %p initialization complete...\n", this);
-    }
- 
-  return factory->GetJavaObject (instance_identifier, object);
-}
-
-#include <nsIDNSRecord.h>
-#include <nsIDNSService.h>
-#include <nsIHttpAuthManager.h>
-#include <nsIProxyInfo.h>
-#include <nsIProtocolProxyService.h>
-#include <nsILoginManager.h>
-#include <nsILoginInfo.h>
-
-/** 
- *
- * Returns the proxy information for the given url
- *
- * The proxy query part of this function can be made much smaller by using 
- * nsIPluginManager2::FindProxyForURL() .. however, because we need to parse 
- * the return components in various ways, it is easier to query 
- * nsIProtocolProxyService directly
- *
- * @param siteAddr The URL to check
- * @param  proxyScheme Return parameter containing the proxy URI scheme (http/socks/etc.)
- * @param proxyHost Return parameter containing the proxy host
- * @param proxyPort Return parameter containing the proxy port
- */
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetProxyInfo(const char* siteAddr, char** proxyScheme, char** proxyHost, char** proxyPort)
-{
-  nsresult rv;
-
-  // Initialize service variables
-  nsCOMPtr<nsIProtocolProxyService> proxy_svc = do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
-
-  if (!proxy_svc) {
-	  printf("Cannot initialize proxy service\n");
-	  return rv;
-  }
-
-  nsCOMPtr<nsIIOService> io_svc = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
-
-  if (NS_FAILED(rv) || !io_svc) {
-    printf("Cannot initialize io service\n");
-    return NS_ERROR_FAILURE;
-  }
-
-  // uri which needs to be accessed
-  nsCOMPtr<nsIURI> uri;
-  io_svc->NewURI(nsCString(siteAddr), NULL, NULL, getter_AddRefs(uri));
-
-  // find the proxy address if any
-  nsCOMPtr<nsIProxyInfo> info;
-  proxy_svc->Resolve(uri, 0, getter_AddRefs(info));
-
-  // if there is no proxy found, return immediately
-  if (!info) {
-     PLUGIN_DEBUG_1ARG("%s does not need a proxy\n", siteAddr);
-	 return NS_ERROR_FAILURE;
-  }
-
-  // if proxy info is available, extract it
-  nsCString phost;
-  PRInt32 pport;
-  nsCString ptype;
-
-  info->GetHost(phost);
-  info->GetPort(&pport);
-  info->GetType(ptype);
-
-  // resolve the proxy address to an IP
-  nsCOMPtr<nsIDNSService> dns_svc = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
-
-  if (!dns_svc) {
-      printf("Cannot initialize DNS service\n");
-      return rv;
-  }
-
-  nsCOMPtr<nsIDNSRecord> record;
-  dns_svc->Resolve(phost, 0U, getter_AddRefs(record));
-
-  // TODO: Add support for multiple ips
-  nsDependentCString ipAddr;
-  record->GetNextAddrAsString(ipAddr);
-
-  // pack information in return variables
-  snprintf(*proxyScheme, sizeof(char)*32, "%s", ptype.get());
-  snprintf(*proxyHost, sizeof(char)*64, "%s", ipAddr.get());
-  snprintf(*proxyPort, sizeof(char)*8, "%d", pport);
-
-  PLUGIN_DEBUG_4ARG("Proxy info for %s: %s %s %s\n", siteAddr, *proxyScheme, *proxyHost, *proxyPort);
-
-  return NS_OK;
-}
-
-/** 
- * Returns the cookie information for the given url
- *
- * @param siteAddr The URI to check (must be decoded)
- * @return cookieString The cookie string for the given URI
- */
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetCookieInfo(const char* siteAddr, char** cookieString) 
-{
-
-  nsresult rv;
-  nsCOMPtr<nsIScriptSecurityManager> sec_man = 
-    do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
-
-  if (!sec_man) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIIOService> io_svc = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
-
-  if (NS_FAILED(rv) || !io_svc) {
-    return NS_ERROR_FAILURE;
-  }
-
-  nsCOMPtr<nsIURI> uri;
-  io_svc->NewURI(nsCString(siteAddr), NULL, NULL, getter_AddRefs(uri));
-
-  nsCOMPtr<nsICookieService> cookie_svc = do_GetService(NS_COOKIESERVICE_CONTRACTID, &rv);
-
-  if (NS_FAILED(rv) || !cookie_svc) {
-    return NS_ERROR_FAILURE;
-  }
-
-  rv = cookie_svc->GetCookieString(uri, NULL, cookieString);
-
-  if (NS_FAILED(rv) || !*cookieString) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::GetJavaObject (PRUint32 instance_identifier,
-                                     jobject* object)
-{
-  // add stub to hash table, mapping index to object_stub pointer.  by
-  // definition jobject is a pointer, so our jobject representation
-  // has to be real pointers.
-
-  // ask Java for index of CODE class
-  object_identifier_return = 0;
-
-  int reference = 0;
-
-  nsCString objectMessage ("instance ");
-  objectMessage.AppendInt (instance_identifier);
-  objectMessage += " reference ";
-  objectMessage.AppendInt (reference);
-  objectMessage += " GetJavaObject";
-  PLUGIN_DEBUG_1ARG ("Sending object message: %s\n", objectMessage.get());
-  ResultContainer *container = new ResultContainer();
-  result_map.Put(reference, container);
-  SendMessageToAppletViewer (objectMessage);
-
-  PRBool processed = PR_FALSE;
-  nsresult result = NS_OK;
-
-  // wait for result
-  long startTime = get_time_in_s();
-  while (object_identifier_return == 0) {
-	  current->ProcessNextEvent(PR_TRUE, &processed);
-
-	  // If we have been waiting for more than 20 seconds, something is wrong
-	  if ((get_time_in_ms() - startTime) > TIMEOUT)
-		  break;
-  }
-
-  PLUGIN_DEBUG_1ARG ("GOT JAVA OBJECT IDENTIFIER: %d\n", object_identifier_return);
-  if (object_identifier_return == 0)
-    PLUGIN_DEBUG_0ARG ("WARNING: received object identifier 0\n");
-
-  *object = references.ReferenceObject (object_identifier_return);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaPluginInstance::GetText (char const** result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// plugin_in_pipe_callback is called when data is available on the
-// input pipe, or when the appletviewer crashes or is killed.  It may
-// be called after data has been destroyed in which case it simply
-// returns FALSE to remove itself from the glib main loop.
-static gboolean
-plugin_in_pipe_callback (GIOChannel* source,
-                         GIOCondition condition,
-                         gpointer plugin_data)
-{
-  PLUGIN_DEBUG ("plugin_in_pipe_callback");
-
-  gchar* message = NULL;
-  gboolean keep_installed = TRUE;
-
-  // If data is NULL then GCJ_Destroy has already been called and
-  // plugin_in_pipe_callback is being called after plugin
-  // destruction.  In that case all we need to do is return FALSE so
-  // that the plugin_in_pipe_callback watch is removed.
-  if (condition & G_IO_IN)
-  {
-      if (g_io_channel_read_line (in_from_appletviewer,
-                                  &message, NULL, NULL,
-                                  &channel_error)
-          != G_IO_STATUS_NORMAL)
-       {
-           if (channel_error)
-           {
-               PLUGIN_ERROR_TWO ("Failed to read line from input channel",
-                                 channel_error->message);
-               g_error_free (channel_error);
-               channel_error = NULL;
-            }
-            else
-                PLUGIN_ERROR ("Failed to read line from input channel");
-        }
-        else
-        {
-
-             // Remove trailing newline from message.
-             //message[strlen (message) - 1] = '\0';
-             PLUGIN_DEBUG_1ARG ("Received message: %s\n", message);
-             PLUGIN_DEBUG_1ARG ("  PIPE: plugin read: %s\n", message);
-        }
-
-        keep_installed = TRUE;
-  }
-
-  if (condition & (G_IO_ERR | G_IO_HUP))
-  {
-      PLUGIN_DEBUG ("appletviewer has stopped.");
-      keep_installed = FALSE;
-	  jvm_attached = PR_FALSE;
-
-	  factory->MarkInstancesVoid();
-  } else
-  {
-  
-
-    // push message to queue
-    PR_EnterMonitor(jvmMsgQueuePRMonitor);
-    jvmMsgQueue.push(nsCString(message));
-    PR_ExitMonitor(jvmMsgQueuePRMonitor);
-
-    // poke process thread
-    PRThread *prThread;
-    processThread->GetPRThread(&prThread);
-    PRStatus res = PR_Interrupt(prThread);
-
-  }
-
-  PLUGIN_DEBUG ("plugin_in_pipe_callback return");
-  return keep_installed;
-}
-
-
-NS_IMETHODIMP
-IcedTeaPluginFactory::OnInputStreamReady (nsIAsyncInputStream* aStream)
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  return NS_OK;
-
-  // FIXME: change to NSCString.  Why am I getting symbol lookup errors?
-  // /home/fitzsim/sources/mozilla/dist/bin/firefox-bin: symbol lookup error:
-  // /usr/lib/jvm/java-1.7.0-icedtea-1.7.0.0/jre/lib/i386/IcedTeaPlugin.so:
-  // undefined symbol: _ZNK10nsACString12BeginReadingEv
-  char message[10000];
-  message[0] = 0;
-  char byte = 0;
-  PRUint32 readCount = 0;
-  int index = 0;
-
-  printf ("ONINPUTSTREAMREADY 1 %p\n", current_thread ());
-  // Omit return value checking for speed.
-  input->Read (&byte, 1, &readCount);
-  if (readCount != 1)
-    {
-      PLUGIN_ERROR ("failed to read next byte");
-      return NS_ERROR_FAILURE;
-    }
-  while (byte != 0)
-    {
-      message[index++] = byte;
-      // Omit return value checking for speed.
-      nsresult result = input->Read (&byte, 1, &readCount);
-      if (readCount != 1)
-        {
-          PLUGIN_ERROR ("failed to read next byte");
-          return NS_ERROR_FAILURE;
-        }
-    }
-  message[index] = byte;
-
-  printf ("  PIPE: plugin read: %s\n", message);
-
-
-  // push message to queue
-  printf("Got response. Processing... %s\n", message);
-  PR_EnterMonitor(jvmMsgQueuePRMonitor);
-  printf("Acquired lock on queue\n");
-  jvmMsgQueue.push(nsCString(message));
-  printf("Pushed to queue\n");
-  PR_ExitMonitor(jvmMsgQueuePRMonitor);
-
-  // poke process thread
-  PRThread *prThread;
-  processThread->GetPRThread(&prThread);
-  printf("Interrupting process thread...\n");
-  PRStatus res = PR_Interrupt(prThread);
-  printf("Handler event dispatched\n");
-
-  nsresult result = async->AsyncWait (this, 0, 0, current);
-  PLUGIN_CHECK_RETURN ("re-add async wait", result);
-
-  return NS_OK;
-}
-
-#include <nsServiceManagerUtils.h>
-#include <nsINetUtil.h>
-
-void
-IcedTeaPluginFactory::HandleMessage (nsCString const& message)
-{
-  PLUGIN_DEBUG_1ARG ("received message: %s\n", message.get());
-
-  nsresult conversionResult;
-  PRUint32 space;
-  char msg[message.Length()];
-  char *pch;
-
-  strcpy(msg, message.get());
-  pch = strtok (msg, " ");
-  nsDependentCSubstring prefix(pch, strlen(pch));
-  pch = strtok (NULL, " ");
-  PRUint32 identifier = nsDependentCSubstring(pch, strlen(pch)).ToInteger (&conversionResult);
-
-  /* Certain prefixes may not have an identifier. if they don't. we have a command here */
-  nsDependentCSubstring command;
-  if (NS_FAILED(conversionResult)) {
-    command.Rebind(pch, strlen(pch));
-  }
-
-  PRUint32 reference = -1;
-
-  if (strstr(message.get(), "reference") != NULL) {
-	  pch = strtok (NULL, " "); // skip "reference" literal
-	  pch = strtok (NULL, " ");
-	  reference = nsDependentCSubstring(pch, strlen(pch)).ToInteger (&conversionResult);
-  }
-
-  if (command.Length() == 0) {
-    pch = strtok (NULL, " ");
-    command.Rebind(pch, strlen(pch));
-  }
-
-  pch = strtok (NULL, " ");
-
-  nsDependentCSubstring rest("", 0);
-  while (pch != NULL) {
-	rest += pch;
-	pch = strtok (NULL, " ");
-
-	if (pch != NULL)
-		rest += " ";
-  }
-
-  ResultContainer *resultC;
-  if (reference != -1 && result_map.Get(reference, &resultC))
-  {
-    resultC->stop_timer();
-  }
-
-//  printf ("Parse results: prefix: %s, identifier: %d, reference: %d, command: %s, rest: %s\n", (nsCString (prefix)).get(), identifier, reference, (nsCString (command)).get(), (nsCString (rest)).get());
-
-  if (prefix == "instance")
-    {
-      if (command == "status")
-        {
-          IcedTeaPluginInstance* instance = NULL;
-          instances.Get (identifier, &instance);
-          if (instance != 0)
-		  {
-            instance->peer->ShowStatus (nsCString (rest).get ());
-          }
-        }
-      else if (command == "initialized")
-        {
-          IcedTeaPluginInstance* instance = NULL;
-          instances.Get (identifier, &instance);
-          if (instance != 0) {
-			PLUGIN_DEBUG_2ARG ("Setting instance.initialized for %p from %d ", instance, instance->initialized);
-            instance->initialized = PR_TRUE;
-			PLUGIN_DEBUG_1ARG ("to %d...\n", instance->initialized);
-		  }
-		}
-      else if (command == "fatalError")
-        {
-          IcedTeaPluginInstance* instance = NULL;
-          instances.Get (identifier, &instance);
-          if (instance != 0) {
-			PLUGIN_DEBUG_2ARG ("Setting instance.fatalErrorOccurred for %p from %d ", instance, instance->fatalErrorOccurred);
-            instance->fatalErrorOccurred = PR_TRUE;
-			PLUGIN_DEBUG_1ARG ("to %d...\n", instance->fatalErrorOccurred);
-		  }
-		}
-      else if (command == "url")
-        {
-          IcedTeaPluginInstance* instance = NULL;
-          instances.Get (identifier, &instance);
-          if (instance != 0)
-            {
-              space = rest.FindChar (' ');
-              nsDependentCSubstring escapedUrl = Substring (rest, 0, space);
-
-              nsresult rv;
-              nsCOMPtr<nsINetUtil> net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv);
-
-              if (!net_util)
-                printf("Error instantiating NetUtil service.\n");
-
-              nsDependentCSubstring url;
-              net_util->UnescapeString(escapedUrl, 0, url);
-
-              nsDependentCSubstring target = Substring (rest, space + 1);
-              nsCOMPtr<nsPIPluginInstancePeer> ownerGetter =
-                do_QueryInterface (instance->peer);
-              nsIPluginInstanceOwner* owner = nsnull;
-              ownerGetter->GetOwner (&owner);
-			  PLUGIN_DEBUG_2ARG ("Calling GetURL with %s and %s\n", nsCString (url).get (), nsCString (target).get ());
-              nsCOMPtr<nsIRunnable> event = new GetURLRunnable (instance->peer,
-													 nsCString (url),
-													 nsCString (target));
-              current->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
-            }
-        }
-      else if (command == "GetWindow")
-        {
-          IcedTeaPluginInstance* instance = NULL;
-          instances.Get (identifier, &instance);
-
-		  PLUGIN_DEBUG_1ARG ("GetWindow instance: %d\n", instance);
-          if (instance != 0)
-            {
-              nsCOMPtr<nsIRunnable> event =
-                new IcedTeaRunnableMethod<IcedTeaPluginInstance>
-                (instance,
-                 &IcedTeaPluginInstance::IcedTeaPluginInstance::GetWindow);
-              NS_DispatchToMainThread (event);
-            }
-        }
-      else if (command == "GetMember")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING GetMember\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring nameID = Substring (rest, space + 1);
-          name_identifier = nameID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse name id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::GetMember);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING GetMember DONE\n");
-        }
-      else if (command == "SetMember")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING SetMember\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring nameAndValue = Substring (rest, space + 1);
-          space = nameAndValue.FindChar (' ');
-          nsDependentCSubstring nameID = Substring (nameAndValue, 0, space);
-          // FIXME: these member variables need to be keyed on thread id
-          name_identifier = nameID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse name id", conversionResult);
-          nsDependentCSubstring valueID = Substring (nameAndValue, space + 1);
-          value_identifier = valueID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse value id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::SetMember);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING SetMember DONE\n");
-        }
-      else if (command == "GetSlot")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING GetSlot\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring indexStr = Substring (rest, space + 1);
-          slot_index = indexStr.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse name id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::GetSlot);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING GetSlot DONE\n");
-        }
-      else if (command == "SetSlot")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING SetSlot\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring nameAndValue = Substring (rest, space + 1);
-          space = nameAndValue.FindChar (' ');
-          nsDependentCSubstring indexStr = Substring (nameAndValue, 0, space);
-          slot_index = indexStr.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse name id", conversionResult);
-          nsDependentCSubstring valueID = Substring (nameAndValue, space + 1);
-          value_identifier = valueID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse value id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::SetSlot);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING SetSlot DONE\n");
-        }
-      else if (command == "Eval")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING Eval\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring stringID = Substring (rest, space + 1);
-          string_identifier = stringID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse string id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::Eval);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING Eval DONE\n");
-        }
-      else if (command == "RemoveMember")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING RemoveMember\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring nameID = Substring (rest, space + 1);
-          name_identifier = nameID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse name id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::RemoveMember);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING RemoveMember DONE\n");
-        }
-      else if (command == "Call")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING Call\n");
-          space = rest.FindChar (' ');
-          nsDependentCSubstring javascriptID = Substring (rest, 0, space);
-          javascript_identifier = string_to_js_id ((nsCString) javascriptID);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-          nsDependentCSubstring nameAndArgs = Substring (rest, space + 1);
-          space = nameAndArgs.FindChar (' ');
-          nsDependentCSubstring nameID = Substring (nameAndArgs, 0, space);
-          name_identifier = nameID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse method name id", conversionResult);
-          nsDependentCSubstring argsID = Substring (nameAndArgs, space + 1);
-          args_identifier = argsID.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse args id", conversionResult);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::Call);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING Call DONE\n");
-        }
-      else if (command == "Finalize")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING Finalize\n");
-          javascript_identifier = string_to_js_id ((nsCString) rest);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::Finalize);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING Finalize DONE\n");
-        }
-      else if (command == "ToString")
-        {
-          PLUGIN_DEBUG_0ARG ("POSTING ToString\n");
-          javascript_identifier = string_to_js_id ((nsCString) rest);
-          PLUGIN_DEBUG_1ARG ("parse javascript id %ld\n", javascript_identifier);
-
-          nsCOMPtr<nsIRunnable> event =
-            new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-            (this,
-             &IcedTeaPluginFactory::IcedTeaPluginFactory::ToString);
-          NS_DispatchToMainThread (event);
-          PLUGIN_DEBUG_0ARG ("POSTING ToString DONE\n");
-        }
-      else if (command == "Error")
-        {
-
-			ResultContainer *resultC;
-			if (reference != -1 && result_map.Get(reference, &resultC))
-			{
-				PLUGIN_DEBUG_1ARG ("Error occured. Setting error flag for container @ %d to true\n", reference);               
-
-				resultC->errorOccurred = PR_TRUE;
-				resultC->errorMessage = (nsCString) rest;
-			}
-
-			rest += "ERROR: ";
-			IcedTeaPluginInstance* instance = NULL;
-			instances.Get (identifier, &instance);
-			if (instance != 0)
-			{
-				instance->peer->ShowStatus (nsCString (rest).get ());
-			}
-		}
-    }
-  else if (prefix == "context")
-    {
-      // FIXME: switch context to identifier.
-
-      //printf ("HandleMessage: XXX%sXXX\n", nsCString (command).get ());
-      if (command == "GetJavaObject")
-        {
-          // FIXME: undefine XPCOM_GLUE_AVOID_NSPR?
-          // object_identifier_return = rest.ToInteger (&result);
-          // FIXME: replace with returnIdentifier ?
-          object_identifier_return = rest.ToInteger (&conversionResult);
-          PLUGIN_DEBUG_1ARG ("Patrsed integer: %d\n", object_identifier_return);
-          PLUGIN_CHECK ("parse integer", conversionResult);
-
-        }
-      else if (command == "FindClass"
-               || command == "GetSuperclass"
-               || command == "IsAssignableFrom"
-               || command == "IsInstanceOf"
-               || command == "GetStaticMethodID"
-               || command == "GetMethodID"
-               || command == "GetStaticFieldID"
-               || command == "GetFieldID"
-               || command == "GetObjectClass"
-               || command == "NewObject"
-               || command == "NewString"
-               || command == "NewStringUTF"
-               || command == "GetObjectArrayElement"
-               || command == "NewObjectArray"
-               || command == "ExceptionOccurred"
-               || command == "NewGlobalRef"
-               || command == "NewArray")
-        {
-		  ResultContainer *resultC;
-		  result_map.Get(reference, &resultC);
-		  PLUGIN_DEBUG_2ARG("Looking in map for %d and found = %d\n", reference, resultC);
-		  PLUGIN_DEBUG_1ARG("Curr val = %p\n", resultC);
-		  resultC->returnIdentifier = rest.ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse integer", conversionResult);
-          PLUGIN_DEBUG_1ARG ("GOT RETURN IDENTIFIER %d\n", resultC->returnIdentifier);
-
-        }
-      else if (command == "GetField"
-               || command == "GetStaticField"
-               || command == "CallStaticMethod"
-               || command == "GetArrayLength"
-               || command == "GetStringUTFLength"
-               || command == "GetStringLength"
-               || command == "CallMethod")
-        {
-//          if (returnValue != "")
-//            PLUGIN_ERROR ("Return value already defined.");
-          
-		   ResultContainer *resultC;
-		   result_map.Get(reference, &resultC);
-		   resultC->returnValue = rest;
-		   resultC->returnValue.SetIsVoid(PR_FALSE);
-           PLUGIN_DEBUG_1ARG ("PLUGIN GOT RETURN VALUE: %s\n", resultC->returnValue.get());
-        }
-      else if (command == "GetStringUTFChars")
-        {
-//          if (returnValue != "")
-//            PLUGIN_ERROR ("Return value already defined.");
-
-
-          nsCString returnValue("");
-
-          // Read byte stream into return value.
-          PRUint32 offset = 0;
-          PRUint32 previousOffset = 0;
-
-          offset = rest.FindChar (' ');
-          int length = Substring (rest, 0,
-                                  offset).ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse integer", conversionResult);
-
-          for (int i = 0; i < length; i++)
-            {
-              previousOffset = offset + 1;
-              offset = rest.FindChar (' ', previousOffset);
-              returnValue += static_cast<char>
-                (Substring (rest, previousOffset,
-                            offset - previousOffset).ToInteger (&conversionResult, 16));
-              PLUGIN_CHECK ("parse integer", conversionResult);
-            }
-		  ResultContainer *resultC;
-		  result_map.Get(reference, &resultC);
-		  resultC->returnValue = returnValue;
-          PLUGIN_DEBUG_1ARG ("PLUGIN GOT RETURN UTF-8 STRING: %s\n", resultC->returnValue.get ());
-        }
-      else if (command == "GetStringChars")
-        {
- //         if (!returnValueUCS.IsEmpty ())
-//            PLUGIN_ERROR ("Return value already defined.");
-
-          // Read byte stream into return value.
-		  nsString returnValueUCS;
-		  returnValueUCS.Truncate();
-
-          PRUint32 offset = 0;
-          PRUint32 previousOffset = 0;
-
-          offset = rest.FindChar (' ');
-
-          int length = Substring (rest, 0,
-                                  offset).ToInteger (&conversionResult);
-          PLUGIN_CHECK ("parse integer", conversionResult);
-          for (int i = 0; i < length; i++)
-            {
-              previousOffset = offset + 1;
-              offset = rest.FindChar (' ', previousOffset);
-              char low = static_cast<char> (
-                                            Substring (rest, previousOffset,
-                                                       offset - previousOffset).ToInteger (&conversionResult, 16));
-              PLUGIN_CHECK ("parse integer", conversionResult);
-              previousOffset = offset + 1;
-              offset = rest.FindChar (' ', previousOffset);
-              char high = static_cast<char> (
-                                             Substring (rest, previousOffset,
-                                                        offset - previousOffset).ToInteger (&conversionResult, 16));
-              PLUGIN_CHECK ("parse integer", conversionResult);
-              // FIXME: swap on big-endian systems.
-              returnValueUCS += static_cast<PRUnichar> ((high << 8) | low);
-            }
-          PLUGIN_DEBUG_1ARG ("PLUGIN GOT RETURN UTF-16 STRING: %d: ",
-                  returnValueUCS.Length());
-          for (int i = 0; i < returnValueUCS.Length(); i++)
-            {
-              if ((returnValueUCS[i] >= 'A'
-                   && returnValueUCS[i] <= 'Z')
-                  || (returnValueUCS[i] >= 'a'
-                      && returnValueUCS[i] <= 'z')
-                  || (returnValueUCS[i] >= '0'
-                      && returnValueUCS[i] <= '9'))
-			  {
-                PLUGIN_DEBUG_1ARG ("%c", returnValueUCS[i]);
-			  }
-              else
-                PLUGIN_DEBUG_0ARG ("?");
-            }
-          PLUGIN_DEBUG_0ARG ("\n");
-		  ResultContainer *resultC;
-		  result_map.Get(reference, &resultC);
-		  resultC->returnValueUCS = returnValueUCS;
-		  resultC->returnValueUCS.SetIsVoid(PR_FALSE);
-
-        }
-      // Do nothing for: SetStaticField, SetField, ExceptionClear,
-      // DeleteGlobalRef, DeleteLocalRef
-    }
-	else if (prefix == "plugin")
-    {
-
-        if (command == "PluginProxyInfo") {
-
-          nsresult rv;
-          nsCOMPtr<nsINetUtil> net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv);
-
-          if (!net_util)
-            printf("Error instantiating NetUtil service.\n");
-
-          // decode the url
-          nsDependentCSubstring url;
-          net_util->UnescapeString(rest, 0, url);
-
-          char* proxyScheme = (char*) malloc(sizeof(char)*32);
-          char* proxyHost = (char*) malloc(sizeof(char)*64);
-          char* proxyPort = (char*) malloc(sizeof(char)*8);
-
-          nsCString proxyInfo("plugin PluginProxyInfo ");
-
-          // get proxy info
-          if (GetProxyInfo(((nsCString) url).get(), &proxyScheme, &proxyHost, &proxyPort) == NS_OK)
-          {
-              proxyInfo += proxyScheme;
-              proxyInfo += " ";
-              proxyInfo += proxyHost;
-              proxyInfo += " ";
-              proxyInfo += proxyPort;
-
-              PLUGIN_DEBUG_4ARG("Proxy for %s is %s %s %s\n", ((nsCString) url).get(), proxyScheme, proxyHost, proxyPort);
-          } else {
-              PLUGIN_DEBUG_1ARG("No suitable proxy found for %s\n", ((nsCString) url).get());
-          }
-
-          // send back what we found
-          SendMessageToAppletViewer (proxyInfo);
-
-		  // free allocated memory
-          delete proxyScheme, proxyHost, proxyPort;
-
-		} else if (command == "PluginCookieInfo") 
-        {
-
-          nsresult rv;
-          nsCOMPtr<nsINetUtil> net_util = do_GetService(NS_NETUTIL_CONTRACTID, &rv);
-
-          if (!net_util)
-            printf("Error instantiating NetUtil service.\n");
-
-          // decode the url
-          nsDependentCSubstring url;
-          net_util->UnescapeString(rest, 0, url);
-
-          nsCString cookieInfo("plugin PluginCookieInfo ");
-          cookieInfo += rest;
-          cookieInfo += " ";
-
-          char* cookieString;
-          if (GetCookieInfo(((nsCString) url).get(), &cookieString) == NS_OK)
-          {
-              cookieInfo += cookieString;
-              PLUGIN_DEBUG_2ARG("Cookie for %s is %s\n", ((nsCString) url).get(), cookieString);
-          } else {
-              PLUGIN_DEBUG_1ARG("No cookie found for %s\n", ((nsCString) url).get());
-          }
-
-          // send back what we found
-          SendMessageToAppletViewer (cookieInfo);
-
-		}
-	}
-}
-
-void IcedTeaPluginFactory::ProcessMessage ()
-{
-	while (true) {
-		PR_Sleep(1000);
-
-		// If there was an interrupt, clear it
-		PR_ClearInterrupt();
-
-		// Was I interrupted for shutting down?
-		if (shutting_down == PR_TRUE) {
-			break;
-		}
-
-		// Nope. Ok, is there work to do?
-		if (!jvmMsgQueue.empty())
-		    ConsumeMsgFromJVM();
-
-		// All done. Now let's process pending events
-
-		// Were there new events dispatched?
-		
-		PRBool this_has_pending, curr_has_pending, processed = PR_FALSE;
-		PRBool continue_processing = PR_TRUE;
-
-		while (continue_processing == PR_TRUE) {
-
-		  processThread->HasPendingEvents(&this_has_pending);
-		  if (this_has_pending == PR_TRUE) {
-			  processThread->ProcessNextEvent(PR_TRUE, &processed);
-			  PLUGIN_DEBUG_1ARG ("Pending event processed (this) ... %d\n", processed);
-		  }
-
-		  current->HasPendingEvents(&curr_has_pending);
-		  if (curr_has_pending == PR_TRUE) {
-			  current->ProcessNextEvent(PR_TRUE, &processed);
-			  PLUGIN_DEBUG_1ARG ("Pending event processed (current) ... %d\n", processed);
-		  }
-
-		  if (this_has_pending != PR_TRUE && curr_has_pending != PR_TRUE) {
-			  continue_processing = PR_FALSE;
-		  }
-		}
-	}
-
-}
-
-void IcedTeaPluginFactory::ConsumeMsgFromJVM ()
-{
-	PLUGIN_TRACE_INSTANCE ();
-
-	while (!jvmMsgQueue.empty()) {
-
-    	PR_EnterMonitor(jvmMsgQueuePRMonitor);
-		nsCString message = jvmMsgQueue.front();
-		jvmMsgQueue.pop();
-    	PR_ExitMonitor(jvmMsgQueuePRMonitor);
-
-		HandleMessage (message);
-		PLUGIN_DEBUG_0ARG ("Processing complete\n");
-	}
-}
-
-/**
- *
- * JNI I/O code
- *
-
-#include <jni.h>
-
-typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
-
-void IcedTeaPluginFactory::InitJVM ()
-{
-
-  JavaVMOption options[2];
-  JavaVMInitArgs vm_args;
-  long result;
-  jmethodID mid;
-  jfieldID fid;
-  jobject jobj;
-  int i, asize;
-
-  void *handle = dlopen(libjvm_so, RTLD_NOW);
-  if (!handle) {
-    printf("Cannot open library: %s\n", dlerror());
-  }
-
-  options[0].optionString = ".";
-  options[1].optionString = "-Djava.compiler=NONE";
-//  options[2].optionString = "-Xdebug";
-//  options[3].optionString = "-Xagent";
-//  options[4].optionString = "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n";
-
-  vm_args.version = JNI_VERSION_1_2;
-  vm_args.options = options;
-  vm_args.nOptions = 2;
-  vm_args.ignoreUnrecognized = JNI_TRUE;
-
-  PLUGIN_DEBUG("invoking vm...\n");
-
-  PR_EnterMonitor(jvmPRMonitor);
-
-  CreateJavaVM_t JNI_CreateJavaVM = (CreateJavaVM_t) dlsym(handle, "JNI_CreateJavaVM");
-  result = (*JNI_CreateJavaVM)(&jvm,(void **)&javaEnv, &vm_args);
-  if(result == JNI_ERR ) {
-    printf("Error invoking the JVM");
-	exit(1);
-    //return NS_ERROR_FAILURE;
-  }
-
-  PLUGIN_DEBUG("Looking for the PluginMain constructor...");
-
-  javaPluginClass = (javaEnv)->FindClass("Lsun/applet/PluginMain;");
-  if( javaPluginClass == NULL ) {
-    printf("can't find class PluginMain\n");
-	exit(1);
-    //return NS_ERROR_FAILURE;
-  }
-  (javaEnv)->ExceptionClear();
-  mid=(javaEnv)->GetMethodID(javaPluginClass, "<init>", "()V");
-
-  if( mid == NULL ) {
-    printf("can't find method init\n");
-	exit(1);
-    //return NS_ERROR_FAILURE;
-  }
-
-  PLUGIN_DEBUG("Creating PluginMain object...");
-
-  javaPluginObj=(javaEnv)->NewObject(javaPluginClass, mid);
-
-  if( javaPluginObj == NULL ) {
-    printf("can't create jobj\n");
-	exit(1);
-    //return NS_ERROR_FAILURE;
-  }
-
-  PLUGIN_DEBUG("PluginMain object created...");
-
-  postMessageMID = (javaEnv)->GetStaticMethodID(javaPluginClass, "postMessage", "(Ljava/lang/String;)V");
-
-  if( postMessageMID == NULL ) {
-    printf("can't find method postMessage(Ljava/lang/String;)V\n");
-	exit(1);
-  }
-
-  getMessageMID = (javaEnv)->GetStaticMethodID(javaPluginClass, "getMessage", "()Ljava/lang/String;");
-
-  if( getMessageMID == NULL ) {
-    printf("can't find method getMessage()Ljava/lang/String;\n");
-	exit(1);
-  }
-
-  jvm->DetachCurrentThread();
-
-  printf("VM Invocation complete, detached");
-
-  PR_ExitMonitor(jvmPRMonitor);
-
-  // Start another thread to periodically poll for available messages
-
-  nsCOMPtr<nsIRunnable> readThreadEvent =
-							new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-							(this, &IcedTeaPluginFactory::IcedTeaPluginFactory::ReadFromJVM);
-
-  NS_NewThread(getter_AddRefs(readThread), readThreadEvent);
-
-  nsCOMPtr<nsIRunnable> processMessageEvent =
-							new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-							(this, &IcedTeaPluginFactory::IcedTeaPluginFactory::ProcessMessage);
-
-  NS_NewThread(getter_AddRefs(processThread), processMessageEvent);
-
-
-  //printf("PluginMain initialized...\n");
-  //(jvm)->DestroyJavaVM();
-  //dlclose(handle);
-}
-
-void IcedTeaPluginFactory::ReadFromJVM ()
-{
-
-	PLUGIN_TRACE_INSTANCE ();
-
-	int noResponseCycles = 20;
-
-	const char *message;
-	int responseSize;
-	jstring response;
-
-	while (true) {
-
-		// Lock, attach, read, detach, unlock
-		PR_EnterMonitor(jvmPRMonitor);
-		(jvm)->AttachCurrentThread((void**)&javaEnv, NULL);
-
-		response = (jstring) (javaEnv)->CallStaticObjectMethod(javaPluginClass, getMessageMID);
-		responseSize = (javaEnv)->GetStringLength(response);
-
-		message = responseSize > 0 ? (javaEnv)->GetStringUTFChars(response, NULL) : "";
-		(jvm)->DetachCurrentThread();
-		PR_ExitMonitor(jvmPRMonitor);
-
-		if (responseSize > 0) {
-
-			noResponseCycles = 0;
-
-			PR_EnterMonitor(jvmMsgQueuePRMonitor);
-
-			printf("Async processing: %s\n", message);
-			jvmMsgQueue.push(nsCString(message));
-
-			PR_ExitMonitor(jvmMsgQueuePRMonitor);
-	
-			// poke process thread
-			PRThread *prThread;
-			processThread->GetPRThread(&prThread);
-
-			printf("Interrupting process thread...\n");
-			PRStatus res = PR_Interrupt(prThread);
-
-			// go back to bed
-			PR_Sleep(PR_INTERVAL_NO_WAIT);
-		} else {
-			//printf("Async processor sleeping...\n");
-            if (noResponseCycles >= 5) {
-			    PR_Sleep(1000);
-			} else {
-				PR_Sleep(PR_INTERVAL_NO_WAIT);
-			}
-
-            noResponseCycles++;
-		}
-	}
-}
-
-void IcedTeaPluginFactory::IcedTeaPluginFactory::WriteToJVM(nsCString& message)
-{
-
-  PLUGIN_TRACE_INSTANCE ();
-
-  PR_EnterMonitor(jvmPRMonitor);
-
-  (jvm)->AttachCurrentThread((void**)&javaEnv, NULL);
-
-  PLUGIN_DEBUG("Sending to VM:");
-  PLUGIN_DEBUG(message.get());
-  (javaEnv)->CallStaticVoidMethod(javaPluginClass, postMessageMID, (javaEnv)->NewStringUTF(message.get()));
-  PLUGIN_DEBUG("... sent!");
-
-  (jvm)->DetachCurrentThread();
-  PR_ExitMonitor(jvmPRMonitor);
-
-  return;
-
-  // Try sync read first. Why you ask? Let me tell you why! because attaching
-  // and detaching to the jvm is very expensive. In a standard run, 
-  // ReadFromJVM(), takes up 96.7% of the time, of which 66.5% is spent 
-  // attaching, and 30.7% is spent detaching. 
-
-  int responseSize;
-  jstring response;
-  int tries = 0;
-  int maxTries = 100;
-  const char* retMessage;
-
-  responseSize = 1;
-  PRBool processed = PR_FALSE;
-
-  while (responseSize > 0 || tries < maxTries) {
-
-      fflush(stdout);
-      fflush(stderr);
-
-	  //printf("trying... %d\n", tries);
-	  response = (jstring) (javaEnv)->CallStaticObjectMethod(javaPluginClass, getMessageMID);
-	  responseSize = (javaEnv)->GetStringLength(response);
-
-	  retMessage = (javaEnv)->GetStringUTFChars(response, NULL);
-
-	  if (responseSize > 0) {
-
-		    printf("Got response. Processing... %s\n", retMessage);
-   
-			PR_EnterMonitor(jvmMsgQueuePRMonitor);
-
-		    printf("Acquired lock on queue\n");
-
-			jvmMsgQueue.push(nsCString(retMessage));
-
-		    printf("Pushed to queue\n");
-
-			PR_ExitMonitor(jvmMsgQueuePRMonitor);
-
-            processed = PR_TRUE;
-
-			// If we have a response, bump tries up so we are not looping un-necessarily
-			tries = maxTries - 2;
-	  } else {
-        PR_Sleep(2);
-	  }
-	  tries++;
-  }
-
-  printf("Polling complete...\n");
-
-  (jvm)->DetachCurrentThread();
-
-  PR_ExitMonitor(jvmPRMonitor);
-
-  // wake up asynch read thread if needed
-
-  if (processed == PR_TRUE) {
-      // poke process thread
-      PRThread *prThread;
-      processThread->GetPRThread(&prThread);
-
-      printf("Interrupting process thread...\n");
-      PRStatus res = PR_Interrupt(prThread);
-
-      printf("Handler event dispatched\n");
-  } else {
-      PRThread *prThread;
-      readThread->GetPRThread(&prThread);
-
-      printf("Interrupting thread...\n");
-      PRStatus res = PR_Interrupt(prThread);
-      printf("Interrupted! %d\n", res);
-  }
-
-}
-
-*/
-
-nsresult
-IcedTeaPluginFactory::StartAppletviewer ()
-{
-
-  PLUGIN_TRACE_INSTANCE ();
-  nsresult result;
-
-  nsCOMPtr<nsIComponentManager> manager;
-  result = NS_GetComponentManager (getter_AddRefs (manager));
-  PLUGIN_CHECK_RETURN ("get component manager", result);
-
-  nsCOMPtr<nsILocalFile> file;
-  result = manager->CreateInstanceByContractID (NS_LOCAL_FILE_CONTRACTID,
-                                                nsnull,
-                                                NS_GET_IID (nsILocalFile),
-                                                getter_AddRefs (file));
-  PLUGIN_CHECK_RETURN ("create local file", result);
-
-  result = file->InitWithNativePath (nsCString (appletviewer_executable));
-  PLUGIN_CHECK_RETURN ("init with path", result);
-
-  result = manager->CreateInstanceByContractID (NS_PROCESS_CONTRACTID,
-                                                nsnull,
-                                                NS_GET_IID (nsIProcess),
-                                                getter_AddRefs (applet_viewer_process));
-  PLUGIN_CHECK_RETURN ("create process", result);
-
-  result = applet_viewer_process->Init (file);
-  PLUGIN_CHECK_RETURN ("init process", result);
-
-  // FIXME: hard-coded port number.
-  int numArgs;
-  char const** args;
-  
-  if (getenv("ICEDTEAPLUGIN_DEBUG"))
-  {
-	  numArgs = 4;
-      char const* javaArgs[4] = { "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n", "sun.applet.PluginMain" };
-	  args = javaArgs;
-  } else
-  {
-	  numArgs = 1;
-	  char const* javaArgs[1] = { "sun.applet.PluginMain" };
-	  args = javaArgs;
-  }
-
-  // start processing thread
-  nsCOMPtr<nsIRunnable> processMessageEvent =
-							new IcedTeaRunnableMethod<IcedTeaPluginFactory>
-							(this, &IcedTeaPluginFactory::IcedTeaPluginFactory::ProcessMessage);
-
-  NS_NewThread(getter_AddRefs(processThread), processMessageEvent);
-
-  // data->in_pipe_name
-  in_pipe_name = g_strdup_printf ("%s/icedtea-appletviewer-to-plugin",
-                                         data_directory);
-  if (!in_pipe_name)
-    {
-      PLUGIN_ERROR ("Failed to create input pipe name.");
-     // If data->in_pipe_name is NULL then the g_free at
-      // cleanup_in_pipe_name will simply return.
-      
-      result = NS_ERROR_OUT_OF_MEMORY;
-	  goto cleanup_in_pipe_name;
-    }
-
-  // clear the file first
-  PLUGIN_DEBUG_TWO ("clearing old input fifo (if any):", in_pipe_name);
-  g_remove(in_pipe_name);
-
-  PLUGIN_DEBUG_TWO ("creating input fifo:", in_pipe_name);
-  if (mkfifo (in_pipe_name, 0700) == -1 && errno != EEXIST)
-    {
-      PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno));
-      result = NS_ERROR_OUT_OF_MEMORY;
-      goto cleanup_in_pipe_name;
-    }
-  PLUGIN_DEBUG_TWO ("created input fifo:", in_pipe_name);
-
-  // Create plugin-to-appletviewer pipe which we refer to as the
-  // output pipe.
-
-  // data->out_pipe_name
-  out_pipe_name = g_strdup_printf ("%s/icedtea-plugin-to-appletviewer",
-                                         data_directory);
-
-  PLUGIN_DEBUG("got confirmation that appletviewer is running");
-
-  if (!out_pipe_name)
-    {
-      PLUGIN_ERROR ("Failed to create output pipe name.");
-      result = NS_ERROR_OUT_OF_MEMORY;
-      goto cleanup_out_pipe_name;
-    }
-
-  // clear the file first
-  PLUGIN_DEBUG_TWO ("clearing old output fifo (if any):", out_pipe_name);
-  
-  g_remove(out_pipe_name);
-  PLUGIN_DEBUG_TWO ("creating output fifo:", out_pipe_name);
-  if (mkfifo (out_pipe_name, 0700) == -1 && errno != EEXIST)
-    {
-      PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno));
-      result = NS_ERROR_OUT_OF_MEMORY;
-      goto cleanup_out_pipe_name;
-    }
-  PLUGIN_DEBUG_TWO ("created output fifo:", out_pipe_name);
-
-#if MOZILLA_VERSION_COLLAPSED < 1090100
-  result = applet_viewer_process->Run (PR_FALSE, args, numArgs, nsnull);
-#else
-  result = applet_viewer_process->Run (PR_FALSE, args, numArgs);
-#endif
-  PLUGIN_CHECK_RETURN ("run process", result);
-
-  out_to_appletviewer = g_io_channel_new_file (out_pipe_name,
-                                                  "w", &channel_error);
-
-  if (!out_to_appletviewer)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_TWO ("Failed to create output channel",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR ("Failed to create output channel");
-
-      result = NS_ERROR_UNEXPECTED;
-      goto cleanup_out_to_appletviewer;
-    }
-
-  // Create appletviewer-to-plugin channel.  The default encoding for
-  // the file is UTF-8.
-  // data->in_from_appletviewer
-  in_from_appletviewer = g_io_channel_new_file (in_pipe_name,
-                                                  "r", &channel_error);
-  if (!in_from_appletviewer)
-    {
-      if (channel_error)
-        {
-          PLUGIN_ERROR_TWO ("Failed to create input channel",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-        }
-      else
-        PLUGIN_ERROR ("Failed to create input channel");
-
-      result = NS_ERROR_UNEXPECTED;
-      goto cleanup_in_from_appletviewer;
-    }
-
-  // Watch for hangup and error signals on the input pipe.
-  in_watch_source =
-    g_io_add_watch (in_from_appletviewer,
-                    (GIOCondition) (G_IO_IN | G_IO_ERR | G_IO_HUP),
-                    plugin_in_pipe_callback, NULL);
-
- goto cleanup_done;
-
- cleanup_in_watch_source:
-  // Removing a source is harmless if it fails since it just means the
-  // source has already been removed.
-  g_source_remove (in_watch_source);
-  in_watch_source = 0;
-
- cleanup_in_from_appletviewer:
-  if (in_from_appletviewer)
-    g_io_channel_unref (in_from_appletviewer);
-  in_from_appletviewer = NULL;
-
-  // cleanup_out_watch_source:
-  g_source_remove (out_watch_source);
-  out_watch_source = 0;
-
- cleanup_out_to_appletviewer:
-  if (out_to_appletviewer)
-    g_io_channel_unref (out_to_appletviewer);
-  out_to_appletviewer = NULL;
-
-  // cleanup_out_pipe:
-  // Delete output pipe.
-  PLUGIN_DEBUG_TWO ("deleting input fifo:", in_pipe_name);
-  unlink (out_pipe_name);
-  PLUGIN_DEBUG_TWO ("deleted input fifo:", in_pipe_name);
-
- cleanup_out_pipe_name:
-  g_free (out_pipe_name);
-  out_pipe_name = NULL;
-
-  // cleanup_in_pipe:
-  // Delete input pipe.
-  PLUGIN_DEBUG_TWO ("deleting output fifo:", out_pipe_name);
-  unlink (in_pipe_name);
-  PLUGIN_DEBUG_TWO ("deleted output fifo:", out_pipe_name);
-
- cleanup_in_pipe_name:
-  g_free (in_pipe_name);
-  in_pipe_name = NULL;
-
- cleanup_done:
-
- return result;
-}
-
-nsresult
-IcedTeaPluginFactory::SendMessageToAppletViewer (nsCString& message)
-{
-  PLUGIN_TRACE_INSTANCE ();
-
-  nsresult result;
-  PRBool processed;
-
-  PLUGIN_DEBUG_1ARG ("Writing to JVM: %s\n", message.get());
-
-  gsize bytes_written = 0;
-
-  message.Append('\n');
-
-  // g_io_channel_write_chars will return something other than
-  // G_IO_STATUS_NORMAL if not all the data is written.  In that
-  // case we fail rather than retrying.
-  if (g_io_channel_write_chars (out_to_appletviewer,
-                                message.get(), -1, &bytes_written,
-                                &channel_error)
-      != G_IO_STATUS_NORMAL)
-  {
-        if (channel_error)
-        {
-            PLUGIN_ERROR_TWO ("Failed to write bytes to output channel",
-                                channel_error->message);
-            g_error_free (channel_error);
-            channel_error = NULL;
-         }
-          else
-            PLUGIN_ERROR ("Failed to write bytes to output channel");
-  }
-
-  if (g_io_channel_flush (out_to_appletviewer, &channel_error)
-      != G_IO_STATUS_NORMAL)
-  {
-      if (channel_error)
-      {
-          PLUGIN_ERROR_TWO ("Failed to flush bytes to output channel",
-                            channel_error->message);
-          g_error_free (channel_error);
-          channel_error = NULL;
-      }
-      else
-          PLUGIN_ERROR ("Failed to flush bytes to output channel");
-  }
-
-  PLUGIN_DEBUG_1ARG ("Wrote %d bytes to pipe\n", bytes_written);
-
-  return NS_OK;
-}
-
-PRUint32
-IcedTeaPluginFactory::RegisterInstance (IcedTeaPluginInstance* instance)
-{
-  // FIXME: do locking?
-  PRUint32 identifier = next_instance_identifier;
-  next_instance_identifier++;
-  instances.Put (identifier, instance);
-  return identifier;
-}
-
-void
-IcedTeaPluginFactory::UnregisterInstance (PRUint32 instance_identifier)
-{
-  // FIXME: do locking?
-  instances.Remove (instance_identifier);
-}
-
-IcedTeaPluginInstance::IcedTeaPluginInstance (IcedTeaPluginFactory* factory)
-: window_handle (0),
-  window_width (0),
-  window_height (0),
-  peer(0),
-  liveconnect_window (0),
-  initialized(PR_FALSE),
-  fatalErrorOccurred(PR_FALSE),
-  is_active(PR_TRUE),
-  instanceIdentifierPrefix ("")
-{
-  PLUGIN_TRACE_INSTANCE ();
-  IcedTeaPluginInstance::factory = factory;
-  instance_identifier = factory->RegisterInstance (this);
-
-  instanceIdentifierPrefix += "instance ";
-  instanceIdentifierPrefix.AppendInt (instance_identifier);
-  instanceIdentifierPrefix += " ";
-}
-
-#include <nsIScriptSecurityManager.h>
-
-void
-IcedTeaPluginInstance::GetWindow ()
-{
-
-  nsresult result;
-  PLUGIN_DEBUG_1ARG ("HERE 22: %d\n", liveconnect_window);
-
-  // principalsArray, numPrincipals and securitySupports
-  // are ignored by GetWindow.  See:
-  //
-  // nsCLiveconnect.cpp: nsCLiveconnect::GetWindow
-  // jsj_JSObject.c: jsj_enter_js
-  // lcglue.cpp: enter_js_from_java_impl
-  // so they can all safely be null.
-  if (factory->proxyEnv != NULL)
-    {
-      PLUGIN_DEBUG_2ARG ("HERE 23: %d, %p\n", liveconnect_window, current_thread ());
-
-      // there is a bad race condition here where if the instance is active, 
-      // this code remains active after destruction.. so double check
-	  if (is_active != PR_TRUE)
-	  {
-		  PLUGIN_DEBUG_1ARG("Plugin %d is no longer active. Bypassing \
-                             GetWindow request.\n", instance_identifier);
-		  return;
-	  }
-
-      result = factory->liveconnect->GetWindow(factory->proxyEnv,
-                                               this,
-                                               NULL, 0, NULL,
-                                               &liveconnect_window);
-      PLUGIN_CHECK ("get window", result);
-      PLUGIN_DEBUG_1ARG ("HERE 24: %ld\n", liveconnect_window);
-    }
-
-  PLUGIN_DEBUG_1ARG ("HERE 20: %ld\n", liveconnect_window);
-
-  char *windowAddr;
-  windowAddr = (char*) malloc(20*sizeof(char));
-  js_id_to_string(&windowAddr, liveconnect_window);
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptGetWindow";
-  message += " ";
-  message += windowAddr;
-  factory->SendMessageToAppletViewer (message);
-
-  free(windowAddr);
-}
-
-IcedTeaPluginInstance::~IcedTeaPluginInstance ()
-{
-  PLUGIN_TRACE_INSTANCE ();
-  factory->UnregisterInstance (instance_identifier);
-}
-
-// FIXME: these LiveConnect member functions need to be in instance
-// since nsCLiveConnect objects associate themselves with an instance,
-// for JavaScript context switching.
-void
-IcedTeaPluginFactory::GetMember ()
-{
-  nsresult result;
-  PLUGIN_DEBUG_0ARG ("BEFORE GETTING NAMESTRING\n");
-  jsize strSize = 0;
-  jchar const* nameString;
-  jstring name = static_cast<jstring> (references.ReferenceObject (name_identifier));
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringLength (name, &strSize);
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringChars (name, NULL, &nameString);
-  PLUGIN_DEBUG_0ARG ("AFTER GETTING NAMESTRING\n");
-
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        PLUGIN_DEBUG_2ARG ("Calling GETMEMBER: %d, %d\n", javascript_identifier, strSize);
-        result = liveconnect->GetMember(proxyEnv,
-                                        javascript_identifier,
-                                        nameString, strSize,
-                                        NULL, 0, NULL,
-                                        &liveconnect_member);
-        PLUGIN_CHECK ("get member", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. GetMember call skipped\n", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  PLUGIN_DEBUG_1ARG ("GOT MEMBER: %d\n", ID (liveconnect_member));
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptGetMember";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::GetSlot ()
-{
-  nsresult result;
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        result = liveconnect->GetSlot(proxyEnv,
-                                      javascript_identifier,
-                                      slot_index,
-                                      NULL, 0, NULL,
-                                      &liveconnect_member);
-        PLUGIN_CHECK ("get slot", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. GetSlot call skipped\n", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  PLUGIN_DEBUG_1ARG ("GOT SLOT: %d\n", ID (liveconnect_member));
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptGetSlot";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::SetMember ()
-{
-  nsresult result;
-  PLUGIN_DEBUG_0ARG ("BEFORE GETTING NAMESTRING\n");
-  jsize strSize = 0;
-  jchar const* nameString;
-  jstring name = static_cast<jstring> (references.ReferenceObject (name_identifier));
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringLength (name, &strSize);
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringChars (name, NULL, &nameString);
-  PLUGIN_DEBUG_0ARG ("AFTER GETTING NAMESTRING\n");
-
-  jobject value = references.ReferenceObject (value_identifier);
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        PLUGIN_DEBUG_2ARG ("Calling SETMEMBER: %d, %d\n", javascript_identifier, strSize);
-        result = liveconnect->SetMember(proxyEnv,
-                                        javascript_identifier,
-                                        nameString, strSize,
-                                        value,
-                                        NULL, 0, NULL);
-        PLUGIN_CHECK ("set member", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. SetMember call skipped\n", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptSetMember";
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::SetSlot ()
-{
-  nsresult result;
-  jobject value = references.ReferenceObject (value_identifier);
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        result = liveconnect->SetSlot(proxyEnv,
-                                      javascript_identifier,
-                                      slot_index,
-                                      value,
-                                      NULL, 0, NULL);
-        PLUGIN_CHECK ("set slot", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. SetSlot call skipped\n", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptSetSlot";
-  SendMessageToAppletViewer (message);
-}
-
-#include <nsIJSContextStack.h>
-
-void
-IcedTeaPluginFactory::Eval ()
-{
-  nsresult result;
-  PLUGIN_DEBUG_0ARG ("BEFORE GETTING NAMESTRING\n");
-  jsize strSize = 0;
-  jchar const* nameString;
-  // FIXME: unreference after SendMessageToAppletViewer call.
-  jstring name = static_cast<jstring> (references.ReferenceObject (string_identifier));
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringLength (name, &strSize);
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringChars (name, NULL, &nameString);
-
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-	    nsCString evStr("");
-		for (int i=0; i < strSize; i++)
-			evStr += nameString[i];
-
-        PLUGIN_DEBUG_2ARG ("Calling Eval: %d, %s\n", javascript_identifier, evStr.get());
-        result = liveconnect->Eval(proxyEnv,
-                                   javascript_identifier,
-                                   nameString, strSize,
-                                   NULL, 0, NULL,
-                                   &liveconnect_member);
-        PLUGIN_CHECK ("eval", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. Eval call skipped\n", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptEval";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::RemoveMember ()
-{
-  nsresult result;
-  PLUGIN_DEBUG_0ARG ("BEFORE GETTING NAMESTRING\n");
-  jsize strSize = 0;
-  jchar const* nameString;
-  jstring name = static_cast<jstring> (references.ReferenceObject (name_identifier));
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringLength (name, &strSize);
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringChars (name, NULL, &nameString);
-  PLUGIN_DEBUG_0ARG ("AFTER GETTING NAMESTRING\n");
-
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        PLUGIN_DEBUG_2ARG ("Calling RemoveMember: %d, %d\n", javascript_identifier, strSize);
-        result = liveconnect->RemoveMember(proxyEnv,
-                                           javascript_identifier,
-                                           nameString, strSize,
-                                           NULL, 0, NULL);
-        PLUGIN_CHECK ("RemoveMember", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. Eval call skipped", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptRemoveMember";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::Call ()
-{
-  nsresult result;
-  PLUGIN_DEBUG_0ARG ("BEFORE GETTING NAMESTRING\n");
-  jsize strSize = 0;
-  jchar const* nameString;
-  jstring name = static_cast<jstring> (
-    references.ReferenceObject (name_identifier));
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringLength (name, &strSize);
-  ((IcedTeaJNIEnv*) secureEnv)->GetStringChars (name, NULL, &nameString);
-  PLUGIN_DEBUG_0ARG ("AFTER GETTING NAMESTRING\n");
-  jobjectArray args = static_cast<jobjectArray> (
-    references.ReferenceObject (args_identifier));
-
-  jobject liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        PLUGIN_DEBUG_2ARG ("CALL: %d, %d\n", javascript_identifier, strSize);
-        result = liveconnect->Call(proxyEnv,
-                                   javascript_identifier,
-                                   nameString, strSize,
-                                   args,
-                                   NULL, 0, NULL,
-                                   &liveconnect_member);
-        PLUGIN_CHECK ("call", result);
-	  } else
-	  {
-		  PLUGIN_DEBUG_1ARG("%d has been cleared. Call skipped", javascript_identifier);
-		  liveconnect_member = NULL;
-	  }
-    }
-
-  PLUGIN_DEBUG_1ARG ("GOT RETURN FROM CALL : %d\n", ID (liveconnect_member));
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptCall";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::Finalize ()
-{
-  nsresult result;
-  if (proxyEnv != NULL)
-    {
-      PLUGIN_DEBUG_1ARG ("FINALIZE: %d\n", javascript_identifier);
-
-      if (!factory->js_cleared_handles.Get(javascript_identifier, NULL))
-	  {
-        // remove reference -- set to PR_FALSE rather than removing from table, 
-        // because that allows us to guarantee to all functions using the table, 
-	    // that the entry exists
-        factory->js_cleared_handles.Put(javascript_identifier, PR_TRUE);
-        result = liveconnect->FinalizeJSObject(proxyEnv,
-                                             javascript_identifier);
-        PLUGIN_CHECK ("finalize", result);
-	  } else
-	  {
-	    PLUGIN_DEBUG_1ARG("%d has no references. Finalization skipped.\n", javascript_identifier);
-	  }
-    }
-
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptFinalize";
-  SendMessageToAppletViewer (message);
-}
-
-void
-IcedTeaPluginFactory::ToString ()
-{
-  nsresult result;
-
-  jstring liveconnect_member;
-  if (proxyEnv != NULL)
-    {
-      PLUGIN_DEBUG_1ARG ("Calling ToString: %d\n", javascript_identifier);
-      result = liveconnect->ToString(proxyEnv,
-                                     javascript_identifier,
-                                     &liveconnect_member);
-      PLUGIN_CHECK ("ToString", result);
-    }
-
-  PLUGIN_DEBUG_1ARG ("ToString: %d\n", ID (liveconnect_member));
-  nsCString message ("context ");
-  message.AppendInt (0);
-  message += " ";
-  message += "JavaScriptToString";
-  message += " ";
-  message.AppendInt (ID (liveconnect_member));
-  SendMessageToAppletViewer (message);
-}
-
-nsresult
-IcedTeaPluginFactory::SetTransport (nsISocketTransport* transport)
-{
-  PLUGIN_TRACE_INSTANCE ();
-  IcedTeaPluginFactory::transport = transport;
-//   sink = new IcedTeaEventSink ();
-//   nsresult result = transport->SetEventSink (sink, nsnull);
-//   PLUGIN_CHECK ("socket event sink", result);
-//   return result;
-  // FIXME: remove return if EventSink not needed.
-  return NS_OK;
-}
-
-void
-IcedTeaPluginFactory::Connected ()
-{
-  PLUGIN_TRACE_INSTANCE ();
-  connected = PR_TRUE;
-}
-
-void
-IcedTeaPluginFactory::Disconnected ()
-{
-  PLUGIN_TRACE_INSTANCE ();
-  connected = PR_FALSE;
-}
-
-PRBool
-IcedTeaPluginFactory::IsConnected ()
-{
-//  PLUGIN_TRACE_INSTANCE ();
-  return connected;
-}
-
-NS_IMPL_ISUPPORTS1 (IcedTeaSocketListener, nsIServerSocketListener)
-
-IcedTeaSocketListener::IcedTeaSocketListener (IcedTeaPluginFactory* factory)
-{
-  PLUGIN_TRACE_LISTENER ();
-
-  IcedTeaSocketListener::factory = factory;
-}
-
-IcedTeaSocketListener::~IcedTeaSocketListener ()
-{
-  PLUGIN_TRACE_LISTENER ();
-}
-
-NS_IMETHODIMP
-IcedTeaSocketListener::OnSocketAccepted (nsIServerSocket* aServ,
-                                         nsISocketTransport* aTransport)
-{
-  PLUGIN_TRACE_LISTENER ();
-
-  nsresult result = factory->SetTransport (aTransport);
-  PLUGIN_CHECK_RETURN ("set transport", result);
-  factory->Connected ();
-
-  result = aTransport->OpenOutputStream (nsITransport::OPEN_BLOCKING,
-                                        nsnull, nsnull,
-                                        getter_AddRefs (factory->output));
-  PLUGIN_CHECK_RETURN ("output stream", result);
-
-  result = aTransport->OpenInputStream (0, nsnull, nsnull,
-                                       getter_AddRefs (factory->input));
-  PLUGIN_CHECK_RETURN ("input stream", result);
-
-  factory->async = do_QueryInterface (factory->input, &result);
-  PLUGIN_CHECK_RETURN ("async input stream", result);
-
-  result = factory->async->AsyncWait (factory, 0, 0, factory->current);
-  PLUGIN_CHECK_RETURN ("add async wait", result);
-
-
-  return NS_OK;
-}
-
-// FIXME: handle appletviewer crash and shutdown scenarios.
-NS_IMETHODIMP
-IcedTeaSocketListener::OnStopListening (nsIServerSocket *aServ,
-                                        nsresult aStatus)
-{
-  PLUGIN_TRACE_LISTENER ();
-
-  nsCString shutdownStr("shutdown");
-  PLUGIN_DEBUG_1ARG("stop listening: %uld\n", aStatus);
-
-  nsresult result = NS_OK;
-
-  switch (aStatus)
-  {
-  case NS_ERROR_ABORT:
-    factory->SendMessageToAppletViewer(shutdownStr);
-    PLUGIN_DEBUG ("appletviewer stopped");
-    // FIXME: privatize?
-    result = factory->async->AsyncWait (nsnull, 0, 0, factory->current);
-    PLUGIN_CHECK_RETURN ("clear async wait", result);
-    break;
-  default:
-    PLUGIN_DEBUG_1ARG ("ERROR %x\n", aStatus);
-    PLUGIN_DEBUG ("Listener: Unknown status value.");
-  }
-  return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS1 (IcedTeaEventSink, nsITransportEventSink)
-
-IcedTeaEventSink::IcedTeaEventSink ()
-{
-  PLUGIN_TRACE_EVENTSINK ();
-}
-
-IcedTeaEventSink::~IcedTeaEventSink ()
-{
-  PLUGIN_TRACE_EVENTSINK ();
-}
-
-//static int connected = 0;
-
-NS_IMETHODIMP
-IcedTeaEventSink::OnTransportStatus (nsITransport *aTransport,
-                                     nsresult aStatus,
-                                     PRUint64 aProgress,
-                                     PRUint64 aProgressMax)
-{
-  PLUGIN_TRACE_EVENTSINK ();
-
-  switch (aStatus)
-    {
-      case nsISocketTransport::STATUS_RESOLVING:
-        PLUGIN_DEBUG ("RESOLVING");
-        break;
-      case nsISocketTransport::STATUS_CONNECTING_TO:
-        PLUGIN_DEBUG ("CONNECTING_TO");
-        break;
-      case nsISocketTransport::STATUS_CONNECTED_TO:
-        PLUGIN_DEBUG ("CONNECTED_TO");
-        //        connected = 1;
-        break;
-      case nsISocketTransport::STATUS_SENDING_TO:
-        PLUGIN_DEBUG ("SENDING_TO");
-        break;
-      case nsISocketTransport::STATUS_WAITING_FOR:
-        PLUGIN_DEBUG ("WAITING_FOR");
-        break;
-      case nsISocketTransport::STATUS_RECEIVING_FROM:
-        PLUGIN_DEBUG ("RECEIVING_FROM");
-        break;
-    default:
-      PLUGIN_ERROR ("Unknown transport status.");
-    }
-
-  return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS1 (IcedTeaJNIEnv, nsISecureEnv)
-
-#include <nsCOMPtr.h>
-#include <nsIOutputStream.h>
-#include <nsISocketTransportService.h>
-#include <nsISocketTransport.h>
-#include <nsITransport.h>
-#include <nsNetCID.h>
-#include <nsIPrincipal.h>
-#include <xpcjsid.h>
-
-IcedTeaJNIEnv::IcedTeaJNIEnv (IcedTeaPluginFactory* factory)
-: factory (factory)
-{
-  PLUGIN_TRACE_JNIENV ();
-  contextCounter = 1;
-
-  contextCounterPRMonitor = PR_NewMonitor();
-}
-
-IcedTeaJNIEnv::~IcedTeaJNIEnv ()
-{
-  PLUGIN_TRACE_JNIENV ();
-}
-
-int
-IcedTeaJNIEnv::IncrementContextCounter ()
-{
-
-	PLUGIN_TRACE_JNIENV ();
-
-    PR_EnterMonitor(contextCounterPRMonitor);
-    contextCounter++;
-    PR_ExitMonitor(contextCounterPRMonitor);
-
-	return contextCounter;
-}
-
-void
-IcedTeaJNIEnv::DecrementContextCounter ()
-{
-	PLUGIN_TRACE_JNIENV ();
-
-    PR_EnterMonitor(contextCounterPRMonitor);
-    contextCounter--;
-    PR_ExitMonitor(contextCounterPRMonitor);
-}
-
-#include "nsCRT.h"
-
-nsresult
-IcedTeaJNIEnv::GetEnabledPrivileges(nsCString *privileges, nsISecurityContext *ctx)
-{
-	// check privileges one by one
-
-	privileges->Truncate();
-
-	// see: http://docs.sun.com/source/816-6170-10/index.htm
-	
-    if (ctx)
-    {
-
-       PRBool hasUniversalBrowserRead = PR_FALSE;
-       PRBool hasUniversalJavaPermission = PR_FALSE;
-
-       ctx->Implies("UniversalBrowserRead", "UniversalBrowserRead", &hasUniversalBrowserRead);
-       if (hasUniversalBrowserRead == PR_TRUE)
-       {
-	       *privileges += "UniversalBrowserRead";
-       }
-
-       ctx->Implies("UniversalJavaPermission", "UniversalJavaPermission", &hasUniversalJavaPermission);
-       if (hasUniversalJavaPermission == PR_TRUE)
-       {
-	       *privileges += ",";
-  	       *privileges += "UniversalJavaPermission";
-       }
-    }
-
-     return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewObject (jclass clazz,
-                          jmethodID methodID,
-                          jvalue* args,
-                          jobject* result,
-                          nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_ID (methodID);
-  MESSAGE_ADD_ARGS (methodID, args);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jobject, result); 
-  DecrementContextCounter ();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::CallMethod (jni_type type,
-                           jobject obj,
-                           jmethodID methodID,
-                           jvalue* args,
-                           jvalue* result,
-                           nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_ADD_ID (methodID);
-  MESSAGE_ADD_ARGS (methodID, args);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_VALUE (reference, type, result);
-  DecrementContextCounter ();
-
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::CallNonvirtualMethod (jni_type type,
-                                     jobject obj,
-                                     jclass clazz,
-                                     jmethodID methodID,
-                                     jvalue* args,
-                                     jvalue* result,
-                                     nsISecurityContext* ctx)
-{
-
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// nsPrintfCString is not exported.
-class NS_COM IcedTeaPrintfCString : public nsCString
-  {
-    typedef nsCString string_type;
-
-    enum { kLocalBufferSize = 15 };
-
-    public:
-      explicit IcedTeaPrintfCString( const char_type* format, ... );
-
-    private:
-      char_type  mLocalBuffer[ kLocalBufferSize + 1 ];
-  };
-
-IcedTeaPrintfCString::IcedTeaPrintfCString( const char_type* format, ... )
-  : string_type(mLocalBuffer, 0, NS_STRING_CONTAINER_INIT_DEPEND)
-  {
-    va_list ap;
-
-    size_type logical_capacity = kLocalBufferSize;
-    size_type physical_capacity = logical_capacity + 1;
-
-    va_start(ap, format);
-    int len = PR_vsnprintf(mLocalBuffer, physical_capacity, format, ap);
-    SetLength (len);
-    NS_CStringSetData(*this, mLocalBuffer, len);
-    va_end(ap);
-  }
-
-char*
-IcedTeaJNIEnv::ValueString (jni_type type, jvalue value)
-{
-  PLUGIN_TRACE_JNIENV ();
-  nsCString retstr ("");
-
-  char* longVal = (char*) malloc(sizeof(char)*20);
-  switch (type)
-    {
-    case jboolean_type:
-      retstr += value.z ? "true" : "false";
-      break;
-    case jbyte_type:
-      retstr.AppendInt (value.b & 0x0ff, 16);
-      break;
-    case jchar_type:
-      retstr += value.c;
-      break;
-    case jshort_type:
-      retstr.AppendInt (value.s);
-      break;
-    case jint_type:
-      retstr.AppendInt (value.i);
-      break;
-    case jlong_type:
-      sprintf(longVal, "%"PRId64, value.j);
-      retstr += longVal;
-      break;
-    case jfloat_type:
-      retstr += IcedTeaPrintfCString ("%f", value.f);
-      break;
-    case jdouble_type:
-      retstr += IcedTeaPrintfCString ("%g", value.d);
-      break;
-    case jobject_type:
-      retstr.AppendInt (ID (value.l));
-      break;
-    case jvoid_type:
-      break;
-    default:
-      break;
-    }
-
-  free(longVal);
-
-  // Freed by calling function.
-  return strdup (retstr.get ());
-}
-
-jvalue
-IcedTeaJNIEnv::ParseValue (jni_type type, nsCString& str)
-{
-  PLUGIN_TRACE_JNIENV ();
-  jvalue retval;
-  PRUint32 id;
-  char** bytes;
-  int low;
-  int high;
-  int offset;
-  nsresult conversionResult;
-
-  switch (type)
-    {
-    case jboolean_type:
-      retval.z = (jboolean) (str == "true");
-      break;
-    case jbyte_type:
-      retval.b = (jbyte) str.ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse int", conversionResult);
-      break;
-    case jchar_type:
-      offset = str.FindChar ('_', 0);
-      low = Substring (str, 0, offset).ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse integer", conversionResult);
-      high = Substring (str, offset + 1).ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse integer", conversionResult);
-      retval.c = ((high << 8) & 0x0ff00) | (low & 0x0ff);
-      break;
-    case jshort_type:
-      // Assume number is in range.
-      retval.s = str.ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse int", conversionResult);
-      break;
-    case jint_type:
-      retval.i = str.ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse int", conversionResult);
-      break;
-    case jlong_type:
-      retval.j =  str.ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse int", conversionResult);
-      break;
-    case jfloat_type:
-      retval.f = strtof (str.get (), NULL);
-      break;
-    case jdouble_type:
-      retval.d = strtold (str.get (), NULL);
-      break;
-    case jobject_type:
-      // Have we referred to this object before?
-      id = str.ToInteger (&conversionResult);
-      PLUGIN_CHECK ("parse int", conversionResult);
-      retval.l = factory->references.ReferenceObject (id);
-      break;
-    case jvoid_type:
-      // Clear.
-      retval.i = 0;
-      break;
-    default:
-      PLUGIN_DEBUG_0ARG ("WARNING: didn't handle parse type\n");
-      break;
-    }
-
-  return retval;
-}
-
-// FIXME: make ExpandArgs extend nsACString
-char*
-IcedTeaJNIEnv::ExpandArgs (JNIID* id, jvalue* args)
-{
-  PLUGIN_TRACE_JNIENV ();
-  nsCString retstr ("");
-
-  int i = 0;
-  char stopchar = '\0';
-  // FIXME: check for end-of-string throughout.
-  if (id->signature[0] == '(')
-    {
-      i = 1;
-      stopchar = ')';
-    }
- 
-  // Method.
-  int arg = 0;
-  char* fl;
-  char* longVal = (char*) malloc(sizeof(char)*20);
-  while (id->signature[i] != stopchar)
-    {
-      switch (id->signature[i])
-        {
-        case 'Z':
-          retstr += args[arg].z ? "true" : "false";
-          break;
-        case 'B':
-          retstr.AppendInt (args[arg].b);
-          break;
-        case 'C':
-          retstr.AppendInt (static_cast<int> (args[arg].c) & 0x0ff);
-          retstr += "_";
-          retstr.AppendInt ((static_cast<int> (args[arg].c)
-                             >> 8) & 0x0ff);
-          break;
-        case 'S':
-          retstr.AppendInt (args[arg].s);
-          break;
-        case 'I':
-          retstr.AppendInt (args[arg].i);
-          break;
-        case 'J':
-          sprintf(longVal, "%"PRId64, args[arg].j);
-          retstr += longVal;
-          break;
-        case 'F':
-          retstr += IcedTeaPrintfCString ("%f", args[arg].f);
-          break;
-        case 'D':
-          retstr += IcedTeaPrintfCString ("%g", args[arg].d);
-          break;
-        case 'L':
-          retstr.AppendInt (ID (args[arg].l));
-          i++;
-          while (id->signature[i] != ';')
-            i++;
-          break;
-        case '[':
-          retstr.AppendInt (ID (args[arg].l));
-          i++;
-          while (id->signature[i] == '[')
-            i++;
-          if (id->signature[i] == 'L')
-            {
-              while (id->signature[i] != ';')
-                i++;
-            }
-          else
-            {
-              if (!(id->signature[i] == 'Z'
-                    || id->signature[i] == 'B'
-                    || id->signature[i] == 'C'
-                    || id->signature[i] == 'S'
-                    || id->signature[i] == 'I'
-                    || id->signature[i] == 'J'
-                    || id->signature[i] == 'F'
-                    || id->signature[i] == 'D'))
-                PLUGIN_ERROR_TWO ("Failed to parse signature", id->signature);
-            }
-          break;
-        default:
-          PLUGIN_ERROR_TWO ("Failed to parse signature", id->signature);
-          PLUGIN_DEBUG_1ARG ("FAILED ID: %d\n", id->identifier);
-          break;
-        }
-	
-	  retstr += " ";
-      i++;
-	  arg++;
-    }
-
-  free(longVal);
-
-  // Freed by calling function.
-  return strdup (retstr.get ());
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetField (jni_type type,
-                         jobject obj,
-                         jfieldID fieldID,
-                         jvalue* result,
-                         nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_ADD_ID (fieldID);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_VALUE (reference, type, result);
-  DecrementContextCounter ();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::SetField (jni_type type,
-                         jobject obj,
-                         jfieldID fieldID,
-                         jvalue val,
-                         nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_TYPE (type);
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_ADD_ID (fieldID);
-  MESSAGE_ADD_VALUE (fieldID, val);
-  MESSAGE_SEND ();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::CallStaticMethod (jni_type type,
-                                 jclass clazz,
-                                 jmethodID methodID,
-                                 jvalue* args,
-                                 jvalue* result,
-                                 nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_ID (methodID);
-  MESSAGE_ADD_ARGS (methodID, args);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_VALUE (reference, type, result);
-  DecrementContextCounter ();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStaticField (jni_type type,
-                               jclass clazz,
-                               jfieldID fieldID,
-                               jvalue* result,
-                               nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_ID (fieldID);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_VALUE (reference, type, result);
-  DecrementContextCounter ();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::SetStaticField (jni_type type,
-                               jclass clazz,
-                               jfieldID fieldID,
-                               jvalue val,
-                               nsISecurityContext* ctx)
-{
-  PLUGIN_TRACE_JNIENV ();
-
-  char origin[1024];
-  sprintf(origin, "");
-
-  if (ctx)
-	  ctx->GetOrigin(origin, 1024);
-
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_SRC(origin);
-  MESSAGE_ADD_PRIVILEGES(ctx);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_TYPE (type);
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_ID (fieldID);
-  MESSAGE_ADD_VALUE (fieldID, val);
-  MESSAGE_SEND ();
-
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetVersion (jint* version)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::DefineClass (char const* name,
-                            jobject loader,
-                            jbyte const* buf,
-                            jsize len,
-                            jclass* clazz)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::FindClass (char const* name,
-                          jclass* clazz)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_STRING (name);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jclass, clazz);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetSuperclass (jclass sub,
-                              jclass* super)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (sub);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jclass, super);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::IsAssignableFrom (jclass sub,
-                                 jclass super,
-                                 jboolean* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (sub);
-  MESSAGE_ADD_REFERENCE (super);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_BOOLEAN (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-// IMPLEMENTME.
-NS_IMETHODIMP
-IcedTeaJNIEnv::Throw (jthrowable obj,
-                      jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::ThrowNew (jclass clazz,
-                         char const* msg,
-                         jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::ExceptionOccurred (jthrowable* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_SEND ();
-  // FIXME: potential leak here: when is result free'd?
-  MESSAGE_RECEIVE_REFERENCE (reference, jthrowable, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::ExceptionDescribe (void)
-{
-  PLUGIN_TRACE_JNIENV ();
-  // Do nothing.
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::ExceptionClear (void)
-{
-  PLUGIN_TRACE_JNIENV ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_SEND ();
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::FatalError (char const* msg)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewGlobalRef (jobject lobj,
-                             jobject* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (lobj);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE(reference, jobject, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::DeleteGlobalRef (jobject gref)
-{
-  PLUGIN_TRACE_JNIENV ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (gref);
-  MESSAGE_SEND ();
-  factory->references.UnreferenceObject (ID (gref));
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::DeleteLocalRef (jobject obj)
-{
-  PLUGIN_TRACE_JNIENV ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_SEND ();
-//  factory->references.UnreferenceObject (ID (obj));
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::IsSameObject (jobject obj1,
-                             jobject obj2,
-                             jboolean* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  *result = (obj1 == NULL && obj2 == NULL) ||
-    ((obj1 != NULL && obj2 != NULL)
-     && (ID (obj1) == ID (obj2)));
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::AllocObject (jclass clazz,
-                            jobject* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetObjectClass (jobject obj,
-                               jclass* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jclass, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::IsInstanceOf (jobject obj,
-                             jclass clazz,
-                             jboolean* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (obj);
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_BOOLEAN (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetMethodID (jclass clazz,
-                            char const* name,
-                            char const* sig,
-                            jmethodID* id)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_STRING (name);
-  MESSAGE_ADD_STRING (sig);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_ID (reference, jmethodID, id, sig);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetFieldID (jclass clazz,
-                           char const* name,
-                           char const* sig,
-                           jfieldID* id)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_STRING (name);
-  MESSAGE_ADD_STRING (sig);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_ID (reference, jfieldID, id, sig);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStaticMethodID (jclass clazz,
-                                  char const* name,
-                                  char const* sig,
-                                  jmethodID* id)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_STRING (name);
-  MESSAGE_ADD_STRING (sig);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_ID (reference, jmethodID, id, sig);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStaticFieldID (jclass clazz,
-                                 char const* name,
-                                 char const* sig,
-                                 jfieldID* id)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_STRING (name);
-  MESSAGE_ADD_STRING (sig);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_ID (reference, jfieldID, id, sig);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewString (jchar const* unicode,
-                          jsize len,
-                          jstring* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_SIZE (len);
-  MESSAGE_ADD_STRING_UCS (unicode, len);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jstring, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStringLength (jstring str,
-                                jsize* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (str);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_SIZE (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStringChars (jstring str,
-                               jboolean* isCopy,
-                               jchar const** result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  if (isCopy)
-    *isCopy = JNI_TRUE;
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (str);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_STRING_UCS (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::ReleaseStringChars (jstring str,
-                                   jchar const* chars)
-{
-  PLUGIN_TRACE_JNIENV ();
-  PR_Free ((void*) chars);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewStringUTF (char const* utf,
-                             jstring* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_STRING_UTF (utf);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jstring, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStringUTFLength (jstring str,
-                                   jsize* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (str);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_SIZE (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetStringUTFChars (jstring str,
-                                  jboolean* isCopy,
-                                  char const** result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  if (isCopy)
-    *isCopy = JNI_TRUE;
-
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (str);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_STRING (reference, char, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::ReleaseStringUTFChars (jstring str,
-                                      char const* chars)
-{
-  PLUGIN_TRACE_JNIENV ();
-  PR_Free ((void*) chars);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetArrayLength (jarray array,
-                               jsize* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (array);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_SIZE (reference, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewObjectArray (jsize len,
-                               jclass clazz,
-                               jobject init,
-                               jobjectArray* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_SIZE (len);
-  MESSAGE_ADD_REFERENCE (clazz);
-  MESSAGE_ADD_REFERENCE (init);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jobjectArray, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetObjectArrayElement (jobjectArray array,
-                                      jsize index,
-                                      jobject* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (array);
-  MESSAGE_ADD_SIZE (index);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jobject, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-IcedTeaJNIEnv::SetObjectArrayElement (jobjectArray array,
-                                      jsize index,
-                                      jobject val)
-{
-  PLUGIN_TRACE_JNIENV ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(-1);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_REFERENCE (array);
-  MESSAGE_ADD_SIZE (index);
-  MESSAGE_ADD_REFERENCE (val);
-  MESSAGE_SEND ();
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::NewArray (jni_type element_type,
-                         jsize len,
-                         jarray* result)
-{
-  PLUGIN_TRACE_JNIENV ();
-  int reference = IncrementContextCounter ();
-  MESSAGE_CREATE ();
-  MESSAGE_ADD_STACK_REFERENCE(reference);
-  MESSAGE_ADD_FUNC();
-  MESSAGE_ADD_TYPE (element_type);
-  MESSAGE_ADD_SIZE (len);
-  MESSAGE_SEND ();
-  MESSAGE_RECEIVE_REFERENCE (reference, jarray, result);
-  DecrementContextCounter ();
-  return NS_OK;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetArrayElements (jni_type type,
-                                 jarray array,
-                                 jboolean* isCopy,
-                                 void* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::ReleaseArrayElements (jni_type type,
-                                     jarray array,
-                                     void* elems,
-                                     jint mode)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetArrayRegion (jni_type type,
-                               jarray array,
-                               jsize start,
-                               jsize len,
-                               void* buf)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::SetArrayRegion (jni_type type,
-                               jarray array,
-                               jsize start,
-                               jsize len,
-                               void* buf)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::RegisterNatives (jclass clazz,
-                                JNINativeMethod const* methods,
-                                jint nMethods,
-                                jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::UnregisterNatives (jclass clazz,
-                                  jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::MonitorEnter (jobject obj,
-                             jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::MonitorExit (jobject obj,
-                            jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// FIXME: never called?
-// see nsJVMManager.cpp:878
-// Not used.
-NS_IMETHODIMP
-IcedTeaJNIEnv::GetJavaVM (JavaVM** vm,
-                          jint* result)
-{
-  NOT_IMPLEMENTED ();
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-// Module loading function.  See nsPluginsDirUNIX.cpp.
-// FIXME: support unloading, free'ing memory NSGetFactory allocates?
-extern "C" NS_EXPORT nsresult
-NSGetFactory (nsISupports* aServMgr, nsCID const& aClass,
-              char const* aClassName, char const* aContractID,
-              nsIFactory** aFactory)
-{
-  PLUGIN_DEBUG_0ARG("NSGetFactory called\n");
-
-  static NS_DEFINE_CID (PluginCID, NS_PLUGIN_CID);
-  if (!aClass.Equals (PluginCID))
-    return NS_ERROR_FACTORY_NOT_LOADED;
-
-  // Set appletviewer_executable.
-  Dl_info info;
-  char* filename = NULL;
-  if (dladdr (reinterpret_cast<void const*> (NSGetFactory),
-              &info) == 0)
-    {
-      PLUGIN_ERROR_TWO ("Failed to determine plugin shared object filename",
-                        dlerror ());
-      return NS_ERROR_FAILURE;
-    }
-  // Freed below.
- filename = strdup (info.dli_fname);
-  if (!filename)
-    {
-      PLUGIN_ERROR ("Failed to create plugin shared object filename.");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-  nsCString executable (dirname (filename));
-
-  free (filename);
-  filename = NULL;
-
-  executable += nsCString ("/../../bin/java");
-
-  // Never freed.
-  appletviewer_executable = strdup (executable.get ());
-  if (!appletviewer_executable)
-    {
-      PLUGIN_ERROR ("Failed to create java executable name.");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-  // Make sure the plugin data directory exists, creating it if
-  // necessary.
-  data_directory = g_strconcat (getenv ("HOME"), "/.icedteaplugin", NULL);
-  if (!data_directory)
-    {
-      PLUGIN_ERROR ("Failed to create data directory name.");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-
-  if (!g_file_test (data_directory,
-                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
-    {
-      int file_error = 0;
-
-      file_error = g_mkdir (data_directory, 0700);
-      if (file_error != 0)
-        {
-          PLUGIN_ERROR_THREE ("Failed to create data directory",
-                              data_directory,
-                              strerror (errno));
-         
-          if (data_directory)
-          {
-            g_free (data_directory);
-            data_directory = NULL;
-           };
-
-           return NS_ERROR_UNEXPECTED;
-        }
-    }
-
-  if (factory_created == PR_TRUE)
-  {
-	  // wait for factory to initialize
-	  while (!factory)
-	  {
-		  PR_Sleep(200);
-		  PLUGIN_DEBUG("Waiting for factory to be created...");
-	  }
-
-
-      PLUGIN_DEBUG("NSGetFactory: Returning existing factory");
-
-	  *aFactory = factory;
-	  NS_ADDREF (factory);
-  } else
-  {
-    factory_created = PR_TRUE;
-    PLUGIN_DEBUG("NSGetFactory: Creating factory");
-    factory = new IcedTeaPluginFactory ();
-    if (!factory)
-      return NS_ERROR_OUT_OF_MEMORY;
-
-    NS_ADDREF (factory);
-    *aFactory = factory;
-  }
-
-  return NS_OK;
-}
-
-// FIXME: replace with NS_GetCurrentThread.
-PRThread*
-current_thread ()
-{
-  nsCOMPtr<nsIComponentManager> manager;
-  nsresult result = NS_GetComponentManager (getter_AddRefs (manager));
-  PLUGIN_CHECK ("get component manager", result);
-
-  nsCOMPtr<nsIThreadManager> threadManager;
-  result = manager->CreateInstanceByContractID
-    (NS_THREADMANAGER_CONTRACTID, nsnull, NS_GET_IID (nsIThreadManager),
-     getter_AddRefs (threadManager));
-  PLUGIN_CHECK ("thread manager", result);
-
-  // threadManager is NULL during shutdown.
-  if (threadManager)
-    {
-      nsCOMPtr<nsIThread> current;
-      result = threadManager->GetCurrentThread (getter_AddRefs (current));
-      //  PLUGIN_CHECK ("current thread", result);
-
-      PRThread* threadPointer;
-      result = current->GetPRThread (&threadPointer);
-      //  PLUGIN_CHECK ("thread pointer", result);
-
-      return threadPointer;
-    }
-  else
-    return NULL;
-}
--- a/Makefile.am	Mon Mar 29 00:25:26 2010 +0100
+++ b/Makefile.am	Mon Mar 29 02:54:20 2010 +0100
@@ -42,8 +42,6 @@
 	$(abs_top_builddir)/bootstrap/jdk1.6.0
 ICEDTEA_RT = \
 	$(ICEDTEA_BOOT_DIR)/jre/lib/rt.jar
-ICEDTEA_PLUGS = \
-	$(abs_top_builddir)/bootstrap/jdk1.7.0/jre/lib/rt-closed.jar
 ICEDTEA_ENDORSED_DIR = \
 	$(ICEDTEA_BOOT_DIR)/lib/endorsed
 ICEDTEA_BUILD_DIR_ECJ = \
@@ -61,17 +59,18 @@
 LANGTOOLS = openjdk-ecj/langtools/src/share/classes
 CORBA = openjdk-ecj/corba/src/share/classes
 
-# FIXME (netx): NetX source directories go here
+NETX_SRCDIR = $(abs_top_srcdir)/netx
+NETX_RESOURCE_DIR=$(NETX_SRCDIR)/net/sourceforge/jnlp/resources
+NETX_EXTRA_DIR=$(abs_top_srcdir)/extra/net/sourceforge/jnlp/about/resources
 
 OPENJDK_SOURCEPATH_DIRS = \
         $(SHARE):$(SOLARIS):$(LANGTOOLS):$(CORBA)
 
-ABS_SOURCE_DIRS = $(abs_top_builddir)/generated:$(abs_top_srcdir)/rt:$(LIVECONNECT_SRCS)
+SOURCEPATH_DIRS = $(abs_top_builddir)/generated:$(OPENJDK_SOURCEPATH_DIRS)
 
 # Sources used from OpenJDK.
 ICEDTEA_BOOTSTRAP_DIRS = \
 	$(SHARE)/com/sun/jdi \
-	$(SHARE)/com/sun/jmx/snmp/agent \
 	$(SHARE)/com/sun/net/httpserver \
 	$(SHARE)/com/sun/tools/jdi \
 	$(SHARE)/java/io \
@@ -89,10 +88,18 @@
 	$(LANGTOOLS)/com/sun/mirror \
 	$(LANGTOOLS)/com/sun/tools/apt
 
+# PR42003 - javax.swing.plaf.basic.BasicDirectoryModel
+# PR43389 - javax.management.StandardMBean
+ICEDTEA_BOOTSTRAP_CLASSES = \
+	$(SHARE)/javax/swing/plaf/basic/BasicDirectoryModel.java \
+	$(SHARE)/javax/management/StandardMBean.java
+
 # FIXME (javac): Settings for javac go here
 
 # Flags
 IT_CFLAGS=$(CFLAGS) $(ARCHFLAG)
+IT_JAVAC_SETTINGS=-g -encoding utf-8 $(JAVACFLAGS) $(MEMORY_LIMIT) $(PREFER_SOURCE)
+IT_JAVACFLAGS=$(IT_JAVAC_SETTINGS)
 
 # Conditional defintions
 
@@ -124,32 +131,14 @@
 
 # FIXME (HotSpot): HotSpot changeset logic goes here
 
-# FIXME (plugin): LIVECONNECT_DIR becomes sun/applet netscape
-# FIXME (plugin): NPPLUGIN_DIR becomes PLUGIN_DIR
-if ENABLE_NPPLUGIN
-ICEDTEANPPLUGIN_CLEAN = clean-IcedTeaNPPlugin
-ICEDTEANPPLUGIN_TARGET = $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so
-PLUGIN_PATCH = patches/icedtea-liveconnect.patch
-LIVECONNECT_DIR = -C lib/rt netscape -C lib/rt sun/applet
-NPPLUGIN_DIR=$(abs_top_builddir)/plugin/icedteanp
-NPPLUGIN_SRCDIR=$(abs_top_srcdir)/plugin/icedteanp
-LIVECONNECT_SRCS = $(NPPLUGIN_SRCDIR)/java
-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 sun/applet
-NPPLUGIN_DIR = 
-LIVECONNECT_SRCS = $(abs_top_srcdir)/plugin/icedtea
-else
-ICEDTEAPLUGIN_CLEAN =
-ICEDTEAPLUGIN_TARGET =
-PLUGIN_PATCH = 
-LIVECONNECT_DIR =
-NPPLUGIN_DIR =
-LIVECONNECT_SRCS =
-endif
+LIVECONNECT_DIR = netscape sun/applet
+PLUGIN_DIR=$(abs_top_builddir)/plugin/icedteanp
+PLUGIN_SRCDIR=$(abs_top_srcdir)/plugin/icedteanp
+LIVECONNECT_SRCS = $(PLUGIN_SRCDIR)/java
+ICEDTEAPLUGIN_TARGET = $(PLUGIN_DIR)/IcedTeaPlugin.so \
+	stamps/liveconnect-dist.stamp
 endif
 
 if WITH_VISUALVM
@@ -236,12 +225,8 @@
 	patches/icedtea-lucene-crash.patch \
 	patches/icedtea-version.patch \
 	patches/icedtea-version-hotspot.patch \
-	patches/icedtea-copy-plugs.patch \
 	patches/icedtea-text-relocations.patch \
 	patches/icedtea-ssl.patch \
-	$(PLUGIN_PATCH) \
-	patches/icedtea-webstart.patch \
-	patches/icedtea-webstart-umask.patch \
 	patches/icedtea-rmi_amd64.patch \
 	patches/icedtea-tools.patch \
 	patches/icedtea-use-system-tzdata.patch \
@@ -309,13 +294,23 @@
 	patches/icedtea-sh4-support.patch \
 	patches/libpng.patch \
 	patches/zero.patch \
-	patches/shark.patch
+	patches/shark.patch \
+	patches/extensions/netx.patch \
+	patches/extensions/netx-dist.patch \
+	patches/extensions/netx-umask.patch \
+	patches/icedtea-jtreg-httpTest.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
 	patches/icedtea-rhino.patch
 endif
 
+if ENABLE_PLUGIN
+ICEDTEA_PATCHES += \
+	patches/extensions/liveconnect.patch \
+	patches/extensions/liveconnect-dist.patch
+endif
+
 if BUILD_CACAO
 ICEDTEA_PATCHES += \
 	patches/icedtea-cacao.patch \
@@ -326,6 +321,7 @@
 ICEDTEA_PATCHES += patches/cacao/nio2.patch
 endif
 endif
+
 if WITH_CACAO
 ICEDTEA_PATCHES += \
 	patches/icedtea-cacao-ignore-jdi-tests.patch \
@@ -357,8 +353,6 @@
 ICEDTEA_PATCHES += patches/icedtea-nss-config.patch
 endif
 
-ICEDTEA_PATCHES += patches/icedtea-override.patch
-
 ICEDTEA_PATCHES += $(DISTRIBUTION_PATCHES)
 
 # Bootstrapping patches
@@ -368,7 +362,9 @@
 	patches/ecj/icedtea-spp.patch \
 	patches/ecj/icedtea-jopt.patch \
 	patches/ecj/icedtea-jaxp-dependency.patch \
-	patches/ecj/bootver.patch
+	patches/ecj/bootver.patch \
+	patches/ecj/getannotation-cast.patch \
+	patches/ecj/override.patch
 
 if DTDTYPE_QNAME
 ICEDTEA_ECJ_PATCHES += \
@@ -403,7 +399,6 @@
 PLUGIN_VERSION = $(ICEDTEA_NAME) $(PACKAGE_VERSION)$(ICEDTEA_REV)$(ICEDTEA_PKG)
 
 ICEDTEA_ENV = \
-	IMPORT_BINARY_PLUGS=true \
 	ALT_JDK_IMPORT_PATH="$(ICEDTEA_BOOT_DIR)" \
 	ANT="$(ANT)" \
         BUILD_NUMBER="$(OPENJDK_VERSION)" \
@@ -445,7 +440,9 @@
 	DEBUG_CLASSFILES="true" \
 	DEBUG_BINARIES="true" \
 	ALT_DROPS_DIR="$(abs_top_builddir)/drops" \
-	VERBOSE="$(VERBOSE)"
+	VERBOSE="$(VERBOSE)" \
+	ALT_NETX_DIST="$(abs_top_builddir)/netx.build" \
+	ALT_LIVECONNECT_DIST="$(abs_top_builddir)/liveconnect"
 
 if WITH_CACAO
 ICEDTEA_ENV += \
@@ -485,94 +482,20 @@
 endif
 
 # OpenJDK ecj build environment.
-# FIXME (bootstrap): Remove duplication
-ICEDTEA_ENV_ECJ = \
-	IMPORT_BINARY_PLUGS=true \
-	ALT_JDK_IMPORT_PATH="$(ICEDTEA_BOOT_DIR)" \
-	ANT="$(ANT)" \
-	BUILD_NUMBER="$(OPENJDK_VERSION)" \
-	JDK_UPDATE_VERSION="$(JDK_UPDATE_VERSION)" \
-        JRE_RELEASE_VERSION="1.6.0_$(COMBINED_VERSION)" \
-	MILESTONE="fcs" \
+ICEDTEA_ENV_ECJ = $(ICEDTEA_ENV) \
 	JAVA_TOOLS_DIR="$(ICEDTEA_BOOT_DIR)/bin" \
-	LANG="C" \
-	PATH="$(abs_top_builddir)/bootstrap/jdk1.6.0/bin:$(OS_PATH):$$PATH" \
-	ALT_BINARY_PLUGS_PATH="$(abs_top_builddir)/bootstrap/jdk1.7.0" \
-	ALT_BOOTDIR="$(ICEDTEA_BOOT_DIR)" \
-	BUILD_ARCH_DIR="$(BUILD_ARCH_DIR)" \
 	ICEDTEA_RT="$(ICEDTEA_RT)" \
 	ICEDTEA_BUILD_DIR="$(ICEDTEA_BUILD_DIR_ECJ)" \
 	ICEDTEA_CLS_DIR="$(ICEDTEA_CLS_DIR_ECJ)" \
-	ICEDTEA_ENDORSED_DIR="$(ICEDTEA_ENDORSED_DIR)" \
-	ENDORSED="-Djava.endorsed.dirs=$(ICEDTEA_ENDORSED_DIR)" \
 	BOOTCLASSPATH_CLS_RT="-bootclasspath $(ICEDTEA_CLS_DIR_ECJ):$(ICEDTEA_RT)" \
 	BOOTCLASSPATH_CLS="-bootclasspath $(ICEDTEA_CLS_DIR_ECJ)" \
 	BOOTCLASSPATH_RT_LIBGCJ="-bootclasspath $(ICEDTEA_RT)" \
-	CLASSPATH="" \
-	LD_LIBRARY_PATH="" \
 	GENSRCDIR="$(abs_top_builddir)/generated" \
-	ZERO_BUILD="$(ICEDTEA_ZERO_BUILD)" \
-	SHARK_BUILD="$(ICEDTEA_SHARK_BUILD)" \
-	ZERO_LIBARCH="$(ZERO_LIBARCH)" \
-	ARCH_DATA_MODEL="$(ZERO_BITSPERWORD)" \
-	ZERO_ENDIANNESS="$(ZERO_ENDIANNESS)" \
-	ZERO_ARCHDEF="$(ZERO_ARCHDEF)" \
-	ZERO_ARCHFLAG="$(ARCHFLAG)" \
-	LIBFFI_CFLAGS="$(LIBFFI_CFLAGS)" \
-	LIBFFI_LIBS="$(LIBFFI_LIBS)" \
-	LLVM_CFLAGS="$(LLVM_CFLAGS)" \
-	LLVM_LDFLAGS="$(LLVM_LDFLAGS)" \
-	LLVM_LIBS="$(LLVM_LIBS)" \
-	FREETYPE2_HEADERS="$(FREETYPE2_CFLAGS)" \
-	FT2_LIB="$(FREETYPE2_LIBS)" \
-	ALT_PARALLEL_COMPILE_JOBS="$(PARALLEL_JOBS)" \
-	HOTSPOT_BUILD_JOBS="$(PARALLEL_JOBS)" \
-	JAVAC="" \
-	JAVA_HOME="" \
-	JDK_HOME="" \
 	JAR_KNOWS_ATFILE="$(JAR_KNOWS_ATFILE)" \
 	JAR_KNOWS_J_OPTIONS="$(JAR_KNOWS_J_OPTIONS)" \
 	JAR_ACCEPTS_STDIN_LIST="$(JAR_ACCEPTS_STDIN_LIST)" \
-	DISTRIBUTION_ID="$(DIST_ID)" \
-	DERIVATIVE_ID="$(ICEDTEA_NAME) $(PACKAGE_VERSION)$(ICEDTEA_REV)" \
-	DEBUG_CLASSFILES="true" \
-	DEBUG_BINARIES="true" \
 	DISABLE_NIMBUS="true" \
-	NO_DOCS="true" \
-	ALT_DROPS_DIR="$(abs_top_builddir)/drops" \
-	VERBOSE="$(VERBOSE)"
-
-if WITH_CACAO
-ICEDTEA_ENV_ECJ += \
-	ALT_HOTSPOT_IMPORT_PATH="$(CACAO_IMPORT_PATH)"
-endif
-
-if DISABLE_OPTIMIZATIONS
-ICEDTEA_ENV_ECJ += \
-	NO_OPTIMIZATIONS="true" \
-	CC_NO_OPT="-O0 -g"
-endif
-
-if !ENABLE_DOCS
-ICEDTEA_ENV_ECJ += \
 	NO_DOCS="true"
-endif
-
-if ENABLE_CROSS_COMPILATION
-ICEDTEA_ENV_ECJ += \
-	CROSS_COMPILATION="true" \
-	CROSS_TARGET_ARCH="$(CROSS_TARGET_ARCH)"
-endif
-
-if HAS_HOTSPOT_REVISION
-ICEDTEA_ENV_ECJ += \
-	HOTSPOT_BUILD_VERSION="$(HOTSPOT_REVISION)"
-endif
-
-if WITH_RHINO
-ICEDTEA_ENV_ECJ += \
-	RHINO_JAR="$(abs_top_builddir)/rhino/rhino.jar"
-endif
 
 # Source files
 # FIXME (distclean): Add generated file list
@@ -586,7 +509,6 @@
 	javaws.png javaws.desktop visualvm.desktop \
 	jconsole.desktop policytool.desktop \
 	test/jtreg \
-	IcedTeaPlugin.cc \
 	HACKING pulseaudio fsg.sh \
 	$(abs_top_srcdir)/plugin \
 	hotspot.map \
@@ -607,7 +529,8 @@
 check-local: jtregcheck
 
 #FIXME (clean): Should become clean-local.
-distclean-local: clean-copy clean-jtreg clean-jtreg-reports $(PULSE_JAVA_CLEAN_TARGET)
+distclean-local: clean-copy clean-jtreg clean-jtreg-reports $(PULSE_JAVA_CLEAN_TARGET) \
+ clean-netx clean-plugin clean-liveconnect
 	rm -rf stamps
 	rm -f rt-source-files.txt \
 	  extra-source-files.txt
@@ -619,13 +542,6 @@
 	rm -rf rt/netscape
 	rm -rf visualvm
 	rm -rf netbeans
-if ENABLE_NPPLUGIN
-	rm -f $(NPPLUGIN_DIR)/*.o $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so
-else
-if ENABLE_PLUGIN
-	rm -f IcedTeaPlugin.o IcedTeaPlugin.so
-endif
-endif
 
 if BUILD_CACAO
 	rm -rf cacao
@@ -644,11 +560,10 @@
 	clean-clone-ecj clean-patch-ecj clean-bootstrap-directory \
 	clean-bootstrap-directory-symlink clean-bootstrap-directory-ecj \
 	clean-bootstrap-directory-symlink-ecj icedtea icedtea-debug \
-	clean-icedtea icedtea-against-icedtea clean-icedtea-ecj clean-plugs \
+	clean-icedtea icedtea-against-icedtea clean-icedtea-ecj \
 	clean-tools-jar clean-visualvm clean-nbplatform \
-	clean-copy clean-rt $(ICEDTEAPLUGIN_CLEAN) \
-	$(ICEDTEANPPLUGIN_CLEAN) hotspot hotspot-helper clean-extra clean-jtreg \
-	clean-jtreg-reports 
+	clean-copy clean-rt $(ICEDTEAPLUGIN_CLEAN) hotspot \
+	hotspot-helper clean-extra clean-jtreg clean-jtreg-reports 
 
 env:
 	@echo 'unset JAVA_HOME'
@@ -1099,15 +1014,6 @@
 	    >>openjdk/jdk/make/common/shared/Defs.gmk ;
 endif
 
-#FIXME (plugin): Don't do this copying
-if ENABLE_NPPLUGIN
-	cp -a $(abs_top_srcdir)/plugin/icedteanp/java/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
-else
-if ENABLE_PLUGIN
-	cp -a $(abs_top_srcdir)/plugin/icedtea/sun/applet/*java openjdk/jdk/src/share/classes/sun/applet/
-endif
-endif
-
 clean-patch:
 	rm -f stamps/patch.stamp
 	all_patches_ok=yes; \
@@ -1125,11 +1031,6 @@
 	if ! test x$${all_patches_ok} = "xyes" ; then \
 	  echo "WARNING Not all patches reverted cleanly" ; \
 	fi
-	rm -rf rt/netscape
-	for file in plugin/icedtea/sun/applet/*java ; \
-	do \
-		rm -f openjdk/jdk/src/share/classes/sun/applet/`basename $file` ; \
-	done ;
 
 #FIXME (missing): versioning.stamp
 #FIXME (clean): Missing clean-versioning
@@ -1318,7 +1219,7 @@
 # If you change anything here in the icedtea target, please make sure
 # you change it in the icedtea-debug target as well.
 stamps/icedtea.stamp: stamps/bootstrap-directory-symlink.stamp \
-	stamps/plugs.stamp $(OPENJDK_TREE) stamps/plugin.stamp \
+	stamps/netx-dist.stamp $(OPENJDK_TREE) stamps/plugin.stamp \
 	extra-lib/about.jar stamps/cacao.stamp \
 	stamps/visualvm.stamp $(PULSE_JAVA_TARGET) stamps/rewrite-rhino.stamp
 	$(ARCH_PREFIX) $(MAKE) \
@@ -1329,18 +1230,11 @@
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/ext
 	mkdir -p $(BUILD_OUTPUT_DIR)/j2re-image/lib/ext
-if ENABLE_NPPLUGIN
-	cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \
+if ENABLE_PLUGIN
+	cp -pPRf $(PLUGIN_DIR)/IcedTeaPlugin.so \
 	  $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
-	cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \
+	cp -pPRf $(PLUGIN_DIR)/IcedTeaPlugin.so \
 	  $(BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR)
-else
-if ENABLE_PLUGIN
-	cp -pPRf IcedTeaPlugin.so \
-	  $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
-	cp -pPRf IcedTeaPlugin.so \
-	  $(BUILD_OUTPUT_DIR)/j2re-image/lib/$(INSTALL_ARCH_DIR)
-endif
 endif
 if ENABLE_PULSE_JAVA
 	cp -pPRf $(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so \
@@ -1372,11 +1266,9 @@
 	cp -r netbeans/nbbuild/netbeans_visualvm/profiler3 \
 	  $(BUILD_OUTPUT_DIR)/j2sdk-image/lib/visualvm	
 endif
-	cp $(abs_top_srcdir)/rt/net/sourceforge/jnlp/resources/about.jnlp \
-	  extra-lib/about.jar \
+	cp $(NETX_RESOURCE_DIR)/about.jnlp extra-lib/about.jar \
 	  $(BUILD_OUTPUT_DIR)/j2re-image/lib ; \
-	cp $(abs_top_srcdir)/rt/net/sourceforge/jnlp/resources/about.jnlp \
-	  extra-lib/about.jar \
+	cp $(NETX_RESOURCE_DIR)/about.jnlp extra-lib/about.jar \
 	  $(BUILD_OUTPUT_DIR)/j2sdk-image/jre/lib
 if ZERO_BUILD
 	printf -- '-zero ALIASED_TO -server\n' >> $(BUILD_JRE_ARCH_DIR)/jvm.cfg
@@ -1419,7 +1311,7 @@
 	touch stamps/icedtea.stamp
 
 stamps/icedtea-debug.stamp: stamps/bootstrap-directory-symlink.stamp \
-	stamps/plugs.stamp $(OPENJDK_TREE) stamps/plugin.stamp \
+	stamps/netx-dist.stamp $(OPENJDK_TREE) stamps/plugin.stamp \
 	extra-lib/about.jar stamps/cacao.stamp \
 	stamps/visualvm.stamp $(PULSE_JAVA_TARGET) stamps/rewrite-rhino.stamp
 	$(ARCH_PREFIX) $(MAKE) \
@@ -1430,18 +1322,11 @@
 	mkdir -p $(BUILD_OUTPUT_DIR)-debug/j2re-image/lib/$(INSTALL_ARCH_DIR)
 	mkdir -p $(BUILD_OUTPUT_DIR)-debug/j2sdk-image/jre/lib/ext
 	mkdir -p $(BUILD_OUTPUT_DIR)-debug/j2re-image/lib/ext
-if ENABLE_NPPLUGIN
-	cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \
+if ENABLE_PLUGIN
+	cp -pPRf $(PLUGIN_DIR)/IcedTeaPlugin.so \
 	  $(BUILD_OUTPUT_DIR)-debug/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
-	cp -pPRf $(NPPLUGIN_DIR)/IcedTeaNPPlugin.so \
+	cp -pPRf $(PLUGIN_DIR)/IcedTeaPlugin.so \
 	  $(BUILD_OUTPUT_DIR)-debug/j2re-image/lib/$(INSTALL_ARCH_DIR)
-else
-if ENABLE_PLUGIN
-	cp -pPRf IcedTeaPlugin.so \
-	  $(BUILD_OUTPUT_DIR)-debug/j2sdk-image/jre/lib/$(INSTALL_ARCH_DIR)
-	cp -pPRf IcedTeaPlugin.so \
-	  $(BUILD_OUTPUT_DIR)-debug/j2re-image/lib/$(INSTALL_ARCH_DIR)
-endif
 endif
 if ENABLE_PULSE_JAVA
 	cp -pPRf $(PULSE_JAVA_NATIVE_BUILDDIR)/libpulse-java.so \
@@ -1473,11 +1358,9 @@
 	cp -r netbeans/nbbuild/netbeans_visualvm/profiler3 \
 	  $(BUILD_OUTPUT_DIR)/j2sdk-image/lib/visualvm
 endif
-	cp $(abs_top_srcdir)/rt/net/sourceforge/jnlp/resources/default.jnlp \
-	  extra-lib/about.jar \
+	cp $(NETX_RESOURCE_DIR)/default.jnlp extra-lib/about.jar \
 	  $(BUILD_OUTPUT_DIR)-debug/j2re-image/lib ; \
-	cp $(abs_top_srcdir)/rt/net/sourceforge/jnlp/resources/default.jnlp \
-	  extra-lib/about.jar \
+	cp $(NETX_RESOURCE_DIR)/default.jnlp extra-lib/about.jar \
 	  $(BUILD_OUTPUT_DIR)-debug/j2sdk-image/jre/lib
 if ZERO_BUILD
 	printf -- '-zero ALIASED_TO -server\n' >> $(BUILD_DEBUG_JRE_ARCH_DIR)/jvm.cfg
@@ -1544,8 +1427,8 @@
 # ===================
 
 stamps/icedtea-ecj.stamp: stamps/bootstrap-directory-symlink-ecj.stamp \
-	stamps/plugs.stamp $(OPENJDK_ECJ_TREE) stamps/cacao.stamp \
-	stamps/rewrite-rhino.stamp
+	stamps/netx-dist.stamp $(OPENJDK_ECJ_TREE) stamps/cacao.stamp \
+	stamps/rewrite-rhino.stamp stamps/plugin.stamp
 	$(ARCH_PREFIX) $(MAKE) \
 	  $(ICEDTEA_ENV_ECJ) \
 	  -C openjdk-ecj/ \
@@ -1592,23 +1475,23 @@
 
 # Plugin
 
-if ENABLE_NPPLUGIN
-# IcedTeaNPPlugin.so.
+if ENABLE_PLUGIN
+# IcedTeaPlugin.so.
 # Separate compile and link invocations to ensure intermediate object
 # is listed before -l options.  See:
 # http://developer.mozilla.org/en/docs/XPCOM_Glue
 
-NPPLUGIN_SRC=IcedTeaNPPlugin.cc IcedTeaScriptablePluginObject.cc \
+PLUGIN_SRC=IcedTeaNPPlugin.cc IcedTeaScriptablePluginObject.cc \
         IcedTeaJavaRequestProcessor.cc IcedTeaPluginRequestProcessor.cc \
 		IcedTeaPluginUtils.cc
 
-NPPLUGIN_OBJECTS=IcedTeaNPPlugin.o IcedTeaScriptablePluginObject.o \
+PLUGIN_OBJECTS=IcedTeaNPPlugin.o IcedTeaScriptablePluginObject.o \
         IcedTeaJavaRequestProcessor.o IcedTeaPluginRequestProcessor.o \
 		IcedTeaPluginUtils.o
 
-$(NPPLUGIN_DIR)/%.o: $(NPPLUGIN_SRCDIR)/%.cc
-	mkdir -p $(NPPLUGIN_DIR) && \
-	cd $(NPPLUGIN_DIR) && \
+$(PLUGIN_DIR)/%.o: $(PLUGIN_SRCDIR)/%.cc
+	mkdir -p $(PLUGIN_DIR) && \
+	cd $(PLUGIN_DIR) && \
 	$(CXX) $(CXXFLAGS) \
 	  -DJDK_UPDATE_VERSION="\"$(JDK_UPDATE_VERSION)\"" \
 	  -DPLUGIN_VERSION="\"$(PLUGIN_VERSION)\"" \
@@ -1618,75 +1501,115 @@
 	  $(MOZILLA_CFLAGS) \
 	  -fPIC -o $@ -c $<
 
-$(NPPLUGIN_DIR)/IcedTeaNPPlugin.so: $(addprefix $(NPPLUGIN_DIR)/,$(NPPLUGIN_OBJECTS))
-	cd $(NPPLUGIN_DIR) && \
+$(PLUGIN_DIR)/IcedTeaPlugin.so: $(addprefix $(PLUGIN_DIR)/,$(PLUGIN_OBJECTS))
+	cd $(PLUGIN_DIR) && \
 	$(CXX) $(CXXFLAGS) \
-	  $(NPPLUGIN_OBJECTS) \
+	  $(PLUGIN_OBJECTS) \
 	  $(GLIB_LIBS) \
 	  $(GTK_LIBS) \
 	  $(MOZILLA_LIBS)\
 	  -shared -o $@
 
-clean-IcedTeaNPPlugin:
-	cd $(NPPLUGIN_DIR);\
-	rm -f *.o; \
-	rm -f IcedTeaNPPlugin.so; \
-	cd ../
-else
-if ENABLE_PLUGIN
-# IcedTeaPlugin.so.
-# Separate compile and link invocations to ensure intermediate object
-# is listed before -l options.  See:
-# http://developer.mozilla.org/en/docs/XPCOM_Glue
-IcedTeaPlugin.o: IcedTeaPlugin.cc
-	$(CXX) $(CXXFLAGS) \
-	  -DPLUGIN_VERSION="\"$(PLUGIN_VERSION)\"" \
-	  -DMOZILLA_VERSION_COLLAPSED="$(MOZILLA_VERSION_COLLAPSED)" \
-	  $(GTK_CFLAGS) \
-	  $(MOZILLA_CFLAGS) \
-	  -fPIC -c -o $@ $<
-IcedTeaPlugin.so: IcedTeaPlugin.o
-	$(CXX) $(CXXFLAGS) \
-	  $< \
-	  $(GTK_LIBS) \
-	  $(MOZILLA_LIBS) \
-	  -shared -o $@
-
 clean-IcedTeaPlugin:
-	rm -f IcedTeaPlugin.o
-	rm -f IcedTeaPlugin.so
-endif
+	rm -f $(PLUGIN_DIR)/*.o
+	rm -f $(PLUGIN_DIR)/IcedTeaPlugin.so
 endif
 
-stamps/plugin.stamp: $(ICEDTEAPLUGIN_TARGET) $(ICEDTEANPPLUGIN_TARGET)
+stamps/plugin.stamp: $(ICEDTEAPLUGIN_TARGET)
 	mkdir -p stamps
 	touch stamps/plugin.stamp
 
-clean-plugin: $(ICEDTEAPLUGIN_CLEAN) $(ICEDTEANPPLUGIN_CLEAN)
+clean-plugin: $(ICEDTEAPLUGIN_CLEAN)
 	rm -f stamps/plugin.stamp
 
-#FIXME (plugin): Missing liveconnect-source-files.txt
-#FIXME (plugin): Missing liveconnect.stamp
-#FIXME (plugin): Missing liveconnect-dist.stamp
-#FIXME (clean): Missing clean-liveconnect
-#FIXME (netx): Missing netx-source-files.txt
-#FIXME (netx): Missing netx.stamp
-#FIXME (netx): Missing netx-dist.stamp
-#FIXME (clean): Missing clean-netx
+liveconnect-source-files.txt:
+	if test "x${LIVECONNECT_DIR}" != x; then \
+	  find $(LIVECONNECT_SRCS) -name '*.java' | sort > $@ ; \
+	fi
+	touch $@
+
+stamps/liveconnect.stamp: liveconnect-source-files.txt stamps/netx.stamp
+	if test "x${LIVECONNECT_DIR}" != x; then \
+	  mkdir -p $(abs_top_builddir)/liveconnect && \
+	  $(ICEDTEA_BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \
+	      -d $(abs_top_builddir)/liveconnect \
+	      -classpath $(abs_top_builddir)/lib/rt:$(abs_top_builddir)/netx.build:$(SYSTEM_JDK_DIR)/jre/lib/rt.jar \
+	      -sourcepath $(SOURCEPATH_DIRS) \
+	      -bootclasspath \'\' \
+	      @liveconnect-source-files.txt ; \
+	fi
+	mkdir -p stamps
+	touch $@
+
+stamps/liveconnect-dist.stamp: stamps/liveconnect.stamp
+	if test "x${LIVECONNECT_DIR}" != x; then \
+	  (cd $(abs_top_builddir)/liveconnect ; \
+	   mkdir -p lib ; \
+	   $(ICEDTEA_BOOT_DIR)/bin/jar cf lib/classes.jar $(LIVECONNECT_DIR) ; \
+	   cp -a $(LIVECONNECT_SRCS) src; \
+	   find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
+	   cd src ; \
+	   $(ZIP) -qr $(abs_top_builddir)/liveconnect/lib/src.zip $(LIVECONNECT_DIR) ) ; \
+	fi
+	mkdir -p stamps
+	touch $@
+
+clean-liveconnect:
+	rm -rf $(abs_top_builddir)/liveconnect
+	rm -f stamps/liveconnect-dist.stamp
+	rm -f liveconnect-source-files.txt
+	rm -f stamps/liveconnect.stamp
+
+# NetX
+# requires availability of OpenJDK source code including
+# a patch applied to sun.plugin.AppletViewerPanel and generated sources
+
+netx-source-files.txt:
+	find $(NETX_SRCDIR) -name '*.java' | sort > $@
+
+stamps/netx.stamp: netx-source-files.txt stamps/rt-class-files.stamp
+	mkdir -p $(abs_top_builddir)/netx.build
+	$(ICEDTEA_BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \
+	    -d $(abs_top_builddir)/netx.build \
+	    -classpath $(abs_top_builddir)/lib/rt:$(SYSTEM_JDK_DIR)/jre/lib/rt.jar \
+	    -sourcepath $(NETX_SRCDIR):$(SOURCEPATH_DIRS) \
+	    -bootclasspath \'\' \
+	    @netx-source-files.txt
+	cp -r $(NETX_RESOURCE_DIR) $(abs_top_builddir)/netx.build/net/sourceforge/jnlp
+	mkdir -p stamps
+	touch $@
+
+stamps/netx-dist.stamp: stamps/netx.stamp
+	(cd $(abs_top_builddir)/netx.build ; \
+	 mkdir -p lib ; \
+	 $(ICEDTEA_BOOT_DIR)/bin/jar cf lib/classes.jar javax/jnlp net ; \
+	 cp -a $(NETX_SRCDIR) src; \
+	 find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
+	 cd src ; \
+	 $(ICEDTEA_BOOT_DIR)/bin/jar uf $(abs_top_builddir)/netx.build/lib/classes.jar \
+	  `find . -type f -not -name '*.java'` ; \
+	 $(ZIP) -qr $(abs_top_builddir)/netx.build/lib/src.zip javax net )
+	mkdir -p stamps
+	touch $@
+
+clean-netx:
+	rm -rf $(abs_top_builddir)/netx.build
+	rm -f stamps/netx-dist.stamp
+	rm -f netx-source-files.txt
+	rm -f stamps/netx.stamp
 
 # extras -- used to create about.jar for javaws.
 extra-source-files.txt:
 	find $(abs_top_srcdir)/extra -name '*.java' | sort > $@
 
 stamps/extra-class-files.stamp: $(INITIAL_BOOTSTRAP_LINK_STAMP) \
-  extra-source-files.txt stamps/plugs.stamp
+  extra-source-files.txt stamps/netx.stamp
 	mkdir -p extra-lib
 	$(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g -d extra-lib \
           -source 1.5 \
-          -sourcepath extra -cp $(ICEDTEA_RT):$(ICEDTEA_PLUGS) \
-          -bootclasspath \'\' @extra-source-files.txt ;
-	cp -r $(abs_top_srcdir)/extra/net/sourceforge/jnlp/about/resources \
-	  extra-lib/net/sourceforge/jnlp/about
+          -sourcepath extra -cp netx.build:$(ICEDTEA_RT) \
+          -bootclasspath \'\' @extra-source-files.txt
+	cp -r $(NETX_EXTRA_DIR) extra-lib/net/sourceforge/jnlp/about
 	mkdir -p stamps
 	touch $@
 
@@ -2013,22 +1936,21 @@
 
 # plugin tests
 
+if ENABLE_PLUGIN
 stamps/plugin-tests.stamp: $(INITIAL_BOOTSTRAP_LINK_STAMP) $(PLUGIN_TEST_SRCS) \
- bootstrap/jdk1.7.0/jre/lib/rt-closed.jar
+ stamps/plugin.stamp
 	mkdir -p plugin/tests/LiveConnect
-	if test -d lib/rt/netscape ; then \
-	  set -e ; \
-	  $(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g \
-	   -d plugin/tests/LiveConnect \
-	    -classpath bootstrap/jdk1.7.0/jre/lib/rt-closed.jar \
-	    -source 1.5 $(PLUGIN_TEST_SRCS) ; \
-	  $(ICEDTEA_BOOT_DIR)/bin/jar cf plugin/tests/LiveConnect/PluginTest.jar \
-	    plugin/tests/LiveConnect/*.class ; \
-	  cp -a $(abs_top_srcdir)/plugin/tests/LiveConnect/*.{js,html} plugin/tests/LiveConnect ; \
-	  echo "Done. Now launch \"firefox file://`pwd`/index.html\"" ; \
-	fi
+	$(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g \
+	 -d plugin/tests/LiveConnect \
+	 -classpath liveconnect/lib/classes.jar \
+	 -source 1.5 $(PLUGIN_TEST_SRCS) ;
+	$(ICEDTEA_BOOT_DIR)/bin/jar cf plugin/tests/LiveConnect/PluginTest.jar \
+	  plugin/tests/LiveConnect/*.class ;
+	cp -a $(abs_top_srcdir)/plugin/tests/LiveConnect/*.{js,html} plugin/tests/LiveConnect ;
+	echo "Done. Now launch \"firefox file://`pwd`/index.html\"" ; \
 	mkdir -p stamps
 	touch stamps/plugin-tests.stamp
+endif
 
 # jtreg
 
@@ -2123,8 +2045,6 @@
 
 # rt.jar additional class files.
 rt-source-files.txt: $(OPENJDK_ECJ_TREE)
-	find $(abs_top_srcdir)/rt $(abs_top_builddir)/rt $(LIVECONNECT_SRCS) -name '*.java' \
-	  | sort -u > $@
 	for dir in $(ICEDTEA_BOOTSTRAP_DIRS) ; \
 	do \
 	  $(FIND) $(abs_top_builddir)/$$dir -name '*.java' >> $@; \
@@ -2138,12 +2058,9 @@
 	mkdir -p lib/rt
 	$(ICEDTEA_BOOT_DIR)/bin/javac $(MEMORY_LIMIT) -g -d lib/rt \
           -source 1.5 \
-          -sourcepath \
-	    '$(OPENJDK_SOURCEPATH_DIRS):$(abs_top_builddir)/generated' \
+          -sourcepath $(SOURCEPATH_DIRS) \
           -classpath $(SYSTEM_JDK_DIR)/jre/lib/rt.jar \
 	  -bootclasspath \'\' @rt-source-files.txt ;
-	cp -r $(abs_top_srcdir)/rt/net/sourceforge/jnlp/resources \
-	  lib/rt/net/sourceforge/jnlp/
 	mkdir -p stamps
 	touch stamps/rt-class-files.stamp
 
@@ -2152,13 +2069,14 @@
 	rm -f stamps/rt-class-files.stamp
 	rm -f stamps/rt.stamp
 	rm -f rt-source-files.txt
+	cp $(SYSTEM_JDK_DIR)/jre/lib/rt.jar $(ICEDTEA_RT)
 
-stamps/rt.stamp: stamps/rt-class-files.stamp \
- stamps/bootstrap-directory-ecj.stamp
+stamps/rt.stamp: stamps/rt-class-files.stamp stamps/bootstrap-directory-ecj.stamp \
+ stamps/liveconnect.stamp
 	mkdir -p stamps
 if LACKS_SUN_AWT_TOOLKIT
 	$(ICEDTEA_BOOT_DIR)/bin/jar uf $(ICEDTEA_RT) -C lib/rt com -C lib/rt java \
-	  -C lib/rt javax $(LIVECONNECT_DIR) -C lib/rt net -C lib/rt sun ;
+	  -C lib/rt javax -C lib/rt sun ;
 endif
 	touch stamps/rt.stamp
 
@@ -2182,19 +2100,6 @@
 	fi
 	rm -f stamps/tools.stamp
 
-# rt-closed.jar
-stamps/plugs.stamp: stamps/rt.stamp stamps/tools.stamp
-	$(ICEDTEA_BOOT_DIR)/bin/jar cf $(ICEDTEA_PLUGS) \
-	  -C lib/rt com/sun/jmx/snmp $(LIVECONNECT_DIR) \
-	  -C lib/rt net -C lib/rt javax/jnlp ;
-	mkdir -p stamps
-	touch stamps/plugs.stamp
-
-clean-plugs: clean-plugs clean-copy clean-rt
-	rm -f $(ICEDTEA_PLUGS)
-	cp $(SYSTEM_JDK_DIR)/jre/lib/rt.jar $(ICEDTEA_RT)
-	rm -f stamps/plugs.stamp
-
 # Target Aliases
 # ===============
 
@@ -2242,8 +2147,16 @@
 
 jtreg: stamps/jtreg.stamp
 
+liveconnect: stamps/liveconnect.stamp
+
+liveconnect-dist: stamps/liveconnect-dist.stamp
+
 native-ecj: stamps/native-ecj.stamp
 
+netx: stamps/netx.stamp
+
+netx-dist: stamps/netx-dist.stamp
+
 overlay: stamps/overlay.stamp
 
 patch: stamps/patch.stamp
@@ -2256,8 +2169,6 @@
 
 plugin-tests: stamps/plugin-tests.stamp
 
-plugs: stamps/plugs.stamp
-
 pulse-java: stamps/pulse-java.stamp
 
 rewriter: stamps/rewriter.stamp
--- a/NEWS	Mon Mar 29 00:25:26 2010 +0100
+++ b/NEWS	Mon Mar 29 02:54:20 2010 +0100
@@ -1,5 +1,51 @@
-New in release 1.8 (XXXX-XX-XX):
+New in release 1.8 (2010-XX-XX):
+
+- Updated to OpenJDK6 b18.
+  - Nimbus Look 'n' Feel backported from OpenJDK7.
+  - JAXP and JAXWS now external dependencies rather than being in-tree.
+  - Updated timezone data
+  - Addition of security updates applied in IcedTea6 1.6.2.
+  - Many bug fixes:
+    http://blogs.sun.com/darcy/resource/OpenJDK_6/openjdk6-b18-changes-summary.html
+- Old plugin removed; NPPlugin is now the default and is controlled by
+  --enable/disable-plugin.  As with the old plugin, it produces a
+  IcedTeaPlugin.so library rather than IcedTeaNPPlugin.so.
+- Dependence on the binary plugs mechanism removed.  The plugin and NetX
+  code is now imported into the JDK build in the same manner as langtools,
+  CORBA, JAXP and JAXWS.
+- Zero/Shark
+  - Shark is now able to build itself.
+  - For ARM, add Thumb2 JIT.
+  - Fixed Shark sharkCompiler mattr memory corruption bug when using llvm 2.7.
+
+New in release 1.7.1 (2010-02-26):
 
+Bug fixes
+- PR179: Rhino bootclasspath issue
+- Add missing .c file to PulseAudio build
+Zero/Shark
+- Formatting changes and other fixes to match upstream
+- PR428: Shark on ARM precompiled header incls
+- Update Shark for LLVM r95390 API change.
+- S6927165: Zero S/390 fixes (from upstream)
+- Implemented Shark host CPU feature autotuner using LLVM 2.7 APIs.
+- Add s390 support to TCK setup helper script
+- Strip stupid options that llvm-config supplies
+- Update Shark for LLVM r94686 API change.
+- S6914622, S6909153, S6913869 upstream Zero fixes.
+NPPlugin fixes
+- PR446: Use JDK_UPDATE_VERSION to set the jpi version.
+- Re-designed frame embedding code so that the applet is dynamically
+  packed into given handle. This increases stability and breaks
+  reliance on the assumption that the browser will always provide a
+  handle in a certain sequence.
+- Encode new lines, carriage returns, and other special characters
+  before sending them to Java side (de-coding code is already in
+  effect on Java side).
+- Centralised and increased timeouts to give slow-loading applets
+  enough time to load.
+- Fix security permissions related to get/set property, based on
+  specifications.
 
 New in release 1.7 (2010-01-27):
 
--- a/acinclude.m4	Mon Mar 29 00:25:26 2010 +0100
+++ b/acinclude.m4	Mon Mar 29 02:54:20 2010 +0100
@@ -85,6 +85,12 @@
       CROSS_TARGET_ARCH=s390x
       ARCHFLAG="-m64"
        ;;
+    sh*-*-*)
+      BUILD_ARCH_DIR=sh
+      INSTALL_ARCH_DIR=sh
+      JRE_ARCH_DIR=sh
+      CROSS_TARGET_ARCH=sh
+      ;;
     *)
       BUILD_ARCH_DIR=`uname -m`
       INSTALL_ARCH_DIR=$BUILD_ARCH_DIR
@@ -1432,7 +1438,7 @@
   AM_CONDITIONAL([HAS_HOTSPOT_REVISION], test "x${HOTSPOT_REVISION}" != xnone)
 ])
 
-AC_DEFUN_ONCE([IT_CHECK_OLD_PLUGIN],
+AC_DEFUN_ONCE([IT_CHECK_PLUGIN],
 [
 AC_MSG_CHECKING([whether to build the browser plugin])
 AC_ARG_ENABLE([plugin],
@@ -1442,23 +1448,12 @@
 AC_MSG_RESULT(${enable_plugin})
 ])
 
-AC_DEFUN_ONCE([IT_CHECK_NEW_PLUGIN],
-[
-AC_MSG_CHECKING([whether to build the new experimental browser plugin based on npruntime])
-AC_ARG_ENABLE([npplugin],
-              [AS_HELP_STRING([--enable-npplugin],
-                              [Enable compilation of browser plugin (automatically disables default plugin)])],
-              [enable_npplugin="${enableval}"], [enable_npplugin="no"])
-AC_MSG_RESULT(${enable_npplugin})
-])
-
 AC_DEFUN_ONCE([IT_CHECK_PLUGIN_DEPENDENCIES],
 [
 dnl Check for plugin support headers and libraries.
 dnl FIXME: use unstable
-AC_REQUIRE([IT_CHECK_OLD_PLUGIN])
-AC_REQUIRE([IT_CHECK_NEW_PLUGIN])
-if test "x${enable_plugin}" = "xyes" -o "x${enable_npplugin}" = "xyes" ; then
+AC_REQUIRE([IT_CHECK_PLUGIN])
+if test "x${enable_plugin}" = "xyes" ; then
   PKG_CHECK_MODULES(GTK, gtk+-2.0)
   PKG_CHECK_MODULES(GLIB, glib-2.0)
   AC_SUBST(GLIB_CFLAGS)
@@ -1468,41 +1463,24 @@
 
 
   if $PKG_CONFIG --atleast-version 1.9.2 libxul 2>&AS_MESSAGE_LOG_FD ; then
-    if test "x${enable_npplugin}" != "xyes" ; then
-      AC_MSG_WARN([The old plugin does not work with xulrunner >= 1.9.2.  Enabling new plugin.])
-      enable_npplugin=yes;
-    fi
     xullibs=libxul
   else
     xullibs="libxul libxul-unstable"
   fi
 
-  if test "x${enable_npplugin}" = "xyes" ;
-  then
-    PKG_CHECK_MODULES(MOZILLA, \
-      mozilla-plugin ${xullibs})
+  PKG_CHECK_MODULES(MOZILLA, \
+    mozilla-plugin ${xullibs})
     
-    AC_SUBST(MOZILLA_CFLAGS)
-    AC_SUBST(MOZILLA_LIBS)
-  else
-    if test "x${enable_plugin}" = "xyes"
-    then
-      PKG_CHECK_MODULES(MOZILLA, \
-        nspr mozilla-js mozilla-plugin libxul-unstable >= 1.9)
-
-      AC_SUBST(MOZILLA_CFLAGS)
-      AC_SUBST(MOZILLA_LIBS)
-    fi
-  fi
+  AC_SUBST(MOZILLA_CFLAGS)
+  AC_SUBST(MOZILLA_LIBS)
 fi
 AM_CONDITIONAL(ENABLE_PLUGIN, test "x${enable_plugin}" = "xyes")
-AM_CONDITIONAL(ENABLE_NPPLUGIN, test "x${enable_npplugin}" = "xyes")
 ])
 
 AC_DEFUN_ONCE([IT_CHECK_XULRUNNER_VERSION],
 [
 AC_REQUIRE([IT_CHECK_PLUGIN_DEPENDENCIES])
-if test "x${enable_plugin}" = "xyes" -o "x${enable_npplugin}" = "xyes"
+if test "x${enable_plugin}" = "xyes"
 then
   AC_LANG_PUSH([C++])
   OLDCPPFLAGS="$CPPFLAGS"
--- a/configure.ac	Mon Mar 29 00:25:26 2010 +0100
+++ b/configure.ac	Mon Mar 29 02:54:20 2010 +0100
@@ -1,4 +1,4 @@
-AC_INIT([icedtea6],[1.8pre],[distro-pkg-dev@openjdk.java.net])
+AC_INIT([icedtea6],[1.9pre],[distro-pkg-dev@openjdk.java.net])
 AM_INIT_AUTOMAKE([1.9 tar-pax foreign])
 AC_CONFIG_FILES([Makefile])
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/BasicService.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/ExtendedService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,51 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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 javax.jnlp;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * This interface provides a way for the JNLP application to open specific files
+ * in the client's system. It asks permission from the user before opening any
+ * files.
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ * 
+ */
+public interface ExtendedService {
+
+    /**
+     * Open a file on the client' system and return its contents. The user must
+     * grant permission to the application for this to work.
+     * 
+     * @param file the file to open
+     * @return the opened file as a {@link FileContents} object
+     * @throws IOException on any io problems
+     */
+    FileContents openFile(File file) throws IOException;
+
+    /**
+     * Opens multiple files on the user's sytem and returns their contents as a
+     * {@link FileContents} array
+     * 
+     * @param files the files to open
+     * @return an array of FileContents objects
+     * @throws IOException on any io problems
+     */
+    FileContents[] openFiles(File[] files) throws IOException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/ExtensionInstallerService.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/SingleInstanceListener.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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 javax.jnlp;
+
+/**
+ * This interface specifies a listener which is notified whenever a new instance
+ * of the web start application is launched.
+ * 
+ */
+public interface SingleInstanceListener {
+
+    /**
+     * This method is called when a new instance of the application is launched.
+     * The arguments passed to the new instance are passed into this method.
+     * 
+     * @param arguments the arguments passed to the new instance of the
+     *        application
+     */
+    void newActivation(String[] arguments);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/SingleInstanceService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,46 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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 javax.jnlp;
+
+/**
+ * The SingleInstanceService provides a way to ensure that only one instance of
+ * the application is ever running - singleton behavior at the application
+ * level.
+ * 
+ */
+public interface SingleInstanceService {
+
+    /**
+     * Adds the specified SingleInstanceListener to the notification list. This
+     * listener is notified when a new instance of the application is started.
+     * 
+     * 
+     * @param listener the single instance listener to be added. No action is
+     *        performed if it is null.
+     */
+    void addSingleInstanceListener(SingleInstanceListener listener);
+
+    /**
+     * Removes the specified SingleInstanceListener from the notification list.
+     * This listener will not be notified if a new instance of the application
+     * is started.
+     * 
+     * @param listener the single instance listener to be removed. No action is
+     *        performed if it is null or not in the notification list.
+     */
+    void removeSingleInstanceListener(SingleInstanceListener listener);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/javax/jnlp/UnavailableServiceException.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/AssociationDesc.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,56 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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;
+
+public final class AssociationDesc {
+
+    /** the extensions this application wants to register with */
+    private String[] extensions;
+
+    /** the mime type for the association */
+    private String mimeType;
+
+    public AssociationDesc(String mimeType, String[] extensions) throws ParseException {
+        checkMimeType(mimeType);
+        this.mimeType = mimeType;
+        this.extensions = extensions;
+    }
+
+    /**
+     * Return the extensions for this association
+     */
+    public String[] getExtensions() {
+        return extensions;
+    }
+
+    /**
+     * Return the mimetype for this association
+     */
+    public String getMimeType() {
+        return mimeType;
+    }
+
+    /**
+     * Check for valid mimeType 
+     * @param mimeType a mime type
+     * @throws ParseException if mimeType is an invalid MIME type
+     */
+    private void checkMimeType(String mimeType) throws ParseException {
+        // TODO check that mime type is valid
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ComponentDesc.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,145 @@
+// 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 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) {
+        this.name = name;
+        this.version = version;
+        this.location = location;
+    }
+
+    /**
+     * 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);
+
+            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;
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/IconDesc.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,138 @@
+// 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";
+    
+    /** destop shortcut icon */
+    public static final Object SHORTCUT = "shortcut";
+
+
+    /** 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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,268 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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 associations specified in the JNLP file
+     */
+    public AssociationDesc[] getAssociations() {
+        List associations = getItems("association");
+        
+        return (AssociationDesc[]) associations.toArray(new AssociationDesc[associations.size()]);
+    }
+    
+    /**
+     * Returns the shortcut specified by this JNLP file
+     */
+    public ShortcutDesc getShortcut() {
+        return (ShortcutDesc) getItem("shortcut");
+    }
+    
+    /**
+     * Returns the related-contents specified by this JNLP file
+     */
+    public RelatedContentDesc[] getRelatedContents() {
+        List relatedContents = getItems("related-content");
+        
+        return (RelatedContentDesc[]) relatedContents.toArray(
+                new RelatedContentDesc[relatedContents.size()]);
+    }
+    
+    /**
+     * 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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,623 @@
+// 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.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+
+import net.sourceforge.jnlp.cache.ResourceTracker;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * 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;
+    
+    /** A key that uniquely identifies connected instances (main jnlp+ext) */
+    protected String uniqueKey = null;
+
+    /** the URL used to resolve relative URLs in the file */
+    protected URL codeBase;
+
+    /** 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) throws IOException, ParseException {
+        this(location, 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, boolean strict) throws IOException, ParseException {
+        this(location, (Version) null, strict);
+    }
+    
+    /**
+     * Create a JNLPFile from a URL and a Version checking for updates using 
+     * the default policy.
+     *
+     * @param location the location of the JNLP file
+     * @param version the version 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, Version version, boolean strict) throws IOException, ParseException {
+        this(location, version, strict, JNLPRuntime.getDefaultUpdatePolicy());
+    }
+
+    /**
+     * Create a JNLPFile from a URL and a version, checking for updates 
+     * using the specified policy.
+     *
+     * @param location the location of the JNLP file
+     * @param version the version 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, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
+        Node root = Parser.getRootNode(openURL(location, version, policy));
+        parse(root, strict, location);
+        	
+        //Downloads the original jnlp file into the cache if possible
+        //(i.e. If the jnlp file being launched exist locally, but it 
+        //originated from a website, then download the one from the website
+        //into the cache).  		
+        if (sourceLocation != null && location.getProtocol() == "file") {
+            openURL(sourceLocation, version, policy);
+        }
+
+        this.fileLocation = location;
+        
+        this.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" +
+                         Math.abs(((new java.util.Random()).nextInt())) + "-" +
+                         location;
+
+        if (JNLPRuntime.isDebug())
+            System.err.println("UNIQUEKEY=" + this.uniqueKey);
+    }
+
+    /**
+     * Create a JNLPFile from a URL, parent URLm a version and checking for 
+     * updates using the specified policy.
+     *
+     * @param location the location of the JNLP file
+     * @param uniqueKey A string that uniquely identifies connected instances
+     * @param version the version 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 uniqueKey, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
+        this(location, version, strict, policy);
+        this.uniqueKey = uniqueKey;
+
+        if (JNLPRuntime.isDebug())
+            System.err.println("UNIQUEKEY (override) =" + this.uniqueKey);
+    }
+
+    /**
+     * 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, Version version, 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, 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 location of the parent file if it exists, null otherwise
+     */
+    public String getUniqueKey() {
+        return uniqueKey;
+    }
+
+    /**
+     * 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 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() != null ? parser.getFileLocation() : location;
+            info = parser.getInfo(root);
+            resources = parser.getResources(root, false); // false == not a j2se/java 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());
+        }
+    }
+
+    /**
+     * 
+     * @return true if the JNLP file specifies things that can only be 
+     * applied on a new vm (eg: different max heap memory)
+     */
+    public boolean needsNewVM() {
+        
+        if (getNewVMArgs().size() == 0) {
+            return false;
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     *  @return a list of args to pass to the new 
+     *  JVM based on this JNLP file
+     */
+    public List<String> getNewVMArgs() {
+        
+        List<String> newVMArgs = new LinkedList<String>();
+        
+        JREDesc[] jres = getResources().getJREs();
+        for (int jreIndex = 0; jreIndex < jres.length; jreIndex++) {
+            String initialHeapSize = jres[jreIndex].getInitialHeapSize();
+            if (initialHeapSize != null) {
+                newVMArgs.add("-Xms" + initialHeapSize);
+            }
+            
+            String maxHeapSize = jres[jreIndex].getMaximumHeapSize();
+            if (maxHeapSize != null) {
+                newVMArgs.add("-Xmx" + maxHeapSize);
+            }
+            
+            String vmArgsFromJre = jres[jreIndex].getVMArgs();
+            if (vmArgsFromJre != null) {
+                String[] args = vmArgsFromJre.split(" ");
+                newVMArgs.addAll(Arrays.asList(args));
+            }
+        }
+        
+        return newVMArgs;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/JNLPSplashScreen.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,167 @@
+// 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 J2SE/Java 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 String initialHeapSize;
+
+    /** maximum head size */
+    private String maximumHeapSize;
+
+    /** args to pass to the vm */
+    private String vmArgs;
+    
+    /** 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 vmArgs, String initialHeapSize, 
+            String maximumHeapSize, List resources) throws ParseException {
+        this.version = version;
+        this.location = location;
+        this.vmArgs = vmArgs;
+        checkHeapSize(initialHeapSize);
+        this.initialHeapSize = initialHeapSize;
+        checkHeapSize(maximumHeapSize);
+        this.maximumHeapSize = 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 String getMaximumHeapSize() {
+        return maximumHeapSize;
+    }
+
+    /**
+     * Returns the initial heap size in bytes.
+     */
+    public String getInitialHeapSize() {
+        return initialHeapSize;
+    }
+
+    /**
+     * Returns the resources defined for this JRE.
+     */
+    public List getResourcesDesc() {
+        return resources;
+    }
+
+    /**
+     * Returns the additional arguments to pass to the Java VM
+     * Can be null
+     */
+    public String getVMArgs() {
+        return vmArgs;
+    }
+    
+    /**
+     * Check for valid heap size string
+     * @throws ParseException if heapSize is invalid
+     */
+    static private void checkHeapSize(String heapSize) throws ParseException {
+        // need to implement for completeness even though not used in netx
+        if (heapSize == null) {
+            return;
+        }
+        
+        boolean lastCharacterIsDigit = true;
+        // the last character must be 0-9 or k/K/m/M
+        char lastChar = Character.toLowerCase(heapSize.charAt(heapSize.length()-1));
+        if ((lastChar < '0' || lastChar > '9')) {
+            lastCharacterIsDigit = false;
+            if (lastChar != 'k' && lastChar!= 'm' ) {
+                throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize",new Object[] {heapSize}));
+            }
+        }
+        
+        int indexOfLastDigit = heapSize.length() - 1;
+        if (!lastCharacterIsDigit) {
+            indexOfLastDigit = indexOfLastDigit - 1;
+        }
+        
+        String size = heapSize.substring(0,indexOfLastDigit);
+        try {
+            // check that the number is a number!
+            Integer.valueOf(size);
+        } catch (NumberFormatException numberFormat) {
+            throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize", new Object[] {heapSize}), numberFormat);
+        }
+              
+    }
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/LaunchException.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,792 @@
+// 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.Applet;
+import java.awt.Container;
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadMXBean;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.jar.JarFile;
+
+import net.sourceforge.jnlp.cache.CacheUtil;
+import net.sourceforge.jnlp.cache.ResourceTracker;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.runtime.AppThreadGroup;
+import net.sourceforge.jnlp.runtime.AppletInstance;
+import net.sourceforge.jnlp.runtime.ApplicationInstance;
+import net.sourceforge.jnlp.runtime.JNLPClassLoader;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.services.InstanceExistsException;
+import net.sourceforge.jnlp.services.ServiceUtil;
+import net.sourceforge.jnlp.util.Reflect;
+
+/**
+ * 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;
+        
+        //First checks whether offline-allowed tag is specified inside the jnlp
+        //file.
+        if (!file.getInformation().isOfflineAllowed()) {
+            try {
+                //Checks the offline/online status of the system.
+                //If system is offline do not launch.
+                InetAddress.getByName(file.getSourceLocation().getHost());
+
+            } catch (UnknownHostException ue) {
+                System.err.println("File cannot be launched because offline-allowed tag not specified and system currently offline.");
+                return null;
+            } catch (Exception e) {
+                System.err.println(e);
+            }
+        }
+
+        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 vmArgs the arguments to pass to the new JVM. Can be empty but
+     *        must not be null.
+     * @param file the JNLP file to launch
+     * @param javawsArgs the arguments to pass to the javaws command. Can be
+     *        an empty list but must not be null.
+     * @throws LaunchException if there was an exception 
+     */
+    public void launchExternal(List<String> vmArgs, JNLPFile file, List<String> javawsArgs) throws LaunchException {
+        List<String> updatedArgs = new LinkedList<String>(javawsArgs);
+        
+        if (file.getFileLocation() != null)
+            updatedArgs.add(file.getFileLocation().toString());
+        else if (file.getSourceLocation() != null)
+            updatedArgs.add(file.getFileLocation().toString());
+        else
+            launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo")));
+        
+        launchExternal(vmArgs, updatedArgs);
+        
+    }
+    
+    /**
+     * 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 url the URL of the JNLP file to launch
+     * @throws LaunchException if there was an exception 
+     */
+    public void launchExternal(URL url) throws LaunchException {
+        List<String> javawsArgs = new LinkedList<String>();
+        javawsArgs.add(url.toString());
+        launchExternal(new LinkedList<String>(), javawsArgs);       
+    }
+
+    /**
+     * 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 vmArgs the arguments to pass to the jvm
+     * @param javawsArgs the arguments to pass to javaws (aka Netx)
+     * @throws LaunchException if there was an exception 
+     */
+    public void launchExternal(List<String> vmArgs, List<String> javawsArgs) throws LaunchException {
+        try {
+
+            List<String> commands = new LinkedList<String>();
+            
+            String pathToWebstartBinary = System.getProperty("java.home") + 
+                                      File.separatorChar + 
+                                      "bin" + 
+                                      File.separatorChar + 
+                                      "javaws";
+            commands.add(pathToWebstartBinary);
+            // use -Jargument format to pass arguments to the JVM through the launcher
+            for (String arg: vmArgs) {
+                commands.add("-J" + arg);
+            }
+            commands.addAll(javawsArgs);
+            
+            String[] command = commands.toArray(new String[] {});
+
+            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, (Version) null, true, updatePolicy); // strict
+            }
+            catch (ParseException ex) {
+                file = new JNLPFile(location, (Version) 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 {
+            
+            try {
+                ServiceUtil.checkExistingSingleInstance(file);
+            } catch (InstanceExistsException e) {
+                return null;
+            }
+            
+            if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) {
+                List<String> netxArguments = new LinkedList<String>();
+                netxArguments.add("-Xnofork");
+                netxArguments.addAll(JNLPRuntime.getInitialArguments());
+                launchExternal(file.getNewVMArgs(), netxArguments);
+                return null;
+            }
+            
+            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, 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();
+
+            setContextClassLoaderForAllThreads(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")));
+        }
+    }
+
+    /**
+     * Set the classloader as the context classloader for all threads. This is
+     * required to make some applications work. For example, an application that
+     * provides a custom Swing LnF may ask the swing thread to load resources
+     * from their JNLP, which would only work if the Swing thread knows about
+     * the JNLPClassLoader.
+     * 
+     * @param classLoader the classloader to set as the context classloader
+     */
+    private void setContextClassLoaderForAllThreads(ClassLoader classLoader) {
+        ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
+        ThreadGroup root;
+        
+        root = Thread.currentThread().getThreadGroup();
+        while (root.getParent() != null) {
+            root = root.getParent();
+        }
+
+        /* be prepared for change in thread size */
+        int threadCountGuess = threadBean.getThreadCount();
+        Thread[] threads;
+        do {
+            threadCountGuess = threadCountGuess * 2;
+            threads = new Thread[threadCountGuess];
+            root.enumerate(threads, true);
+        } while (threads[threadCountGuess-1] != null);
+        
+        
+        for (Thread thread: threads) {
+            if (thread != null) {
+                if (JNLPRuntime.isDebug()) {
+                    System.err.println("Setting " + classLoader + " as the classloader for thread " + thread.getName());
+                }
+                thread.setContextClassLoader(classLoader);
+            }
+        }
+        
+    }
+
+    /** 
+     * 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);
+
+            setContextClassLoaderForAllThreads(appletInstance.getClassLoader());
+
+            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("LInitApplication"), R("LInitApplicationInfo"));
+        }
+    }
+
+    /**
+     * 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.
+            }
+        }
+    };
+
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/MenuDesc.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,38 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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;
+
+public class MenuDesc {
+
+    /** the submenu for this menu entry */
+    private String subMenu;
+
+    /**
+     * Create a new menu descriptor
+     */
+    public MenuDesc(String subMenu) {
+        this.subMenu = subMenu;
+    }
+
+    /**
+     * Returns the submenu for this menu entry.
+     */
+    public String getSubMenu() {
+        return subMenu;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/NetxPanel.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,147 @@
+/*
+ * 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 boolean appletAlive;
+
+    public NetxPanel(URL documentURL, Hashtable atts)
+    {
+        super(documentURL, atts);
+    }
+    
+    // overloaded constructor, called when initialized via plugin 
+    public NetxPanel(URL documentURL, Hashtable atts, boolean exitOnFailure)
+    {
+        this(documentURL, atts);
+        this.exitOnFailure = exitOnFailure;
+        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,
+    				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 != null && handler.isAlive() && this.appletAlive;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/Node.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,1202 @@
+// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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 1.5 6.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 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));
+        
+        fileLocation = getURL(root, "href", codebase);
+
+        // 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 or java 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 or java 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) || "java".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/java 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", codebase);
+        String vmArgs = getAttribute(node, "java-vm-args",null);
+        try {
+            checkVMArgs(vmArgs);
+        } catch (IllegalArgumentException argumentException) {
+            vmArgs = null;
+        }
+        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, vmArgs, 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", codebase);
+        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", codebase);
+
+        ExtensionDesc ext = new ExtensionDesc(name, version, location);
+
+        Node dload[] = getChildNodes(node, "ext-download");
+        for (int i=0; i < dload.length; i++) {
+            boolean lazy = "lazy".equals(getAttribute(dload[i], "download", "eager"));
+
+            ext.addPart(getRequiredAttribute(dload[i], "ext-part", null),
+                        getAttribute(dload[i], "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", codebase));
+            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);
+            }
+            if ("association".equals(name)) {
+                addInfo(info, child, null, getAssociation(child));
+            }
+            if ("shortcut".equals(name)) {
+                addInfo(info, child, null, getShortcut(child));
+            }
+            if ("related-content".equals(name)) {
+                addInfo(info, child, null, getRelatedContent(child));
+            }
+
+            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", codebase);
+        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 (codebase != null)
+            return new SecurityDesc(file, type, codebase.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", codebase);
+        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);
+    }
+
+    /**
+     * Returns the association descriptor.
+     */
+    public AssociationDesc getAssociation(Node node) throws ParseException {
+        String[] extensions = getRequiredAttribute(node, "extensions", null).split(" ");
+        String mimeType = getRequiredAttribute(node, "mime-type", null);
+
+        return new AssociationDesc(mimeType, extensions);
+    }
+    
+    /**
+     * Returns the shortcut descriptor.
+     */
+    public ShortcutDesc getShortcut(Node node) throws ParseException {
+        
+        String online = getAttribute(node, "online", "true");
+        boolean shortcutIsOnline = Boolean.valueOf(online);
+        
+        boolean showOnDesktop = false;
+        MenuDesc menu = null;
+        
+        // step through the elements
+        Node child = node.getFirstChild();
+        while (child != null) {
+            String name = child.getNodeName();
+
+            if ("desktop".equals(name)) {
+                if (showOnDesktop && strict) {
+                    throw new ParseException(R("PTwoDesktops"));
+                }
+                showOnDesktop = true;
+            } else if ("menu".equals(name)){
+                if (menu != null && strict) {
+                    throw new ParseException(R("PTwoMenus"));
+                }
+                menu = getMenu(child);
+            }
+            
+            child = child.getNextSibling();
+        }
+        
+        ShortcutDesc shortcut = new ShortcutDesc(shortcutIsOnline, showOnDesktop);
+        if (menu != null) {
+            shortcut.addMenu(menu);
+        }
+        return shortcut;
+    }
+    
+    /**
+     * Returns the menu descriptor.
+     */
+    public MenuDesc getMenu(Node node) {
+        String subMenu = getAttribute(node, "submenu", null);
+        
+        return new MenuDesc(subMenu);
+    }
+
+    
+    /**
+     * Returns the related-content descriptor.
+     */
+    public RelatedContentDesc getRelatedContent(Node node) throws ParseException {
+        
+        getRequiredAttribute(node, "href", null);
+        URL location = getURL(node, "href", codebase);
+        
+        String title = null;
+        String description = null;
+        IconDesc icon = null;
+        
+        // step through the elements
+        Node child = node.getFirstChild();
+        while (child != null) {
+            String name = child.getNodeName();
+            
+            if ("title".equals(name)) {
+                if (title != null && strict) {
+                    throw new ParseException(R("PTwoTitles"));
+                }
+                title = getSpanText(child);
+            } else if ("description".equals(name)) {
+                if (description != null && strict) {
+                    throw new ParseException(R("PTwoDescriptions"));
+                }
+                description = getSpanText(child);
+            } else if ("icon".equals(name)) {
+                if (icon != null && strict) {
+                    throw new ParseException(R("PTwoIcons"));
+                }
+                icon = getIcon(child);
+            }
+            
+            child = child.getNextSibling();
+        }
+        
+        RelatedContentDesc relatedContent = new RelatedContentDesc(location);
+        relatedContent.setDescription(description);
+        relatedContent.setIconDesc(icon);
+        relatedContent.setTitle(title);
+        
+        return relatedContent;
+        
+    }
+    
+    // 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);
+    }
+    
+    /**
+     * Check that the VM args are valid and safe
+     * @param vmArgs a string containing the args
+     * @throws ParseException if the VM arguments are invalid or dangerous
+     */
+    private void checkVMArgs(String vmArgs) throws IllegalArgumentException {
+        if (vmArgs == null) {
+            return;
+        }
+        
+        List<String> validArguments = Arrays.asList(getValidVMArguments());
+        List<String> validStartingArguments = Arrays.asList(getValidStartingVMArguments());
+        
+        String[] arguments = vmArgs.split(" ");
+        boolean argumentIsValid = false;
+        for (String argument: arguments) {
+            argumentIsValid = false;
+            
+            if (validArguments.contains(argument)) {
+                argumentIsValid = true;
+            } else {
+                for (String validStartingArgument: validStartingArguments) {
+                    if (argument.startsWith(validStartingArgument)) {
+                        argumentIsValid = true;
+                        break;
+                    }
+                }
+            }
+            
+            if (!argumentIsValid) {
+                throw new IllegalArgumentException(argument);
+            }
+        }
+        
+    }
+    
+    /**
+     * Returns an array of valid (ie safe and supported) arguments for the JVM
+     * 
+     * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
+     */
+    private String[] getValidVMArguments() {
+        return new String[] {
+        "-d32",                             /* use a 32-bit data model if available */
+        "-client",                          /* to select the client VM */
+        "-server",                          /* to select the server VM */
+        "-verbose",                         /* enable verbose output */
+        "-version",                         /* print product version and exit */
+        "-showversion",                     /* print product version and continue */                              
+        "-help",                            /* print this help message */
+        "-X",                               /* print help on non-standard options */
+        "-ea",                              /* enable assertions */
+        "-enableassertions",                /* enable assertions */
+        "-da",                              /* disable assertions */
+        "-disableassertions",               /* disable assertions */
+        "-esa",                             /* enable system assertions */
+        "-enablesystemassertions",          /* enable system assertions */
+        "-dsa",                             /* disable system assertione */
+        "-disablesystemassertions",         /* disable system assertione */
+        "-Xmixed",                          /* mixed mode execution (default) */
+        "-Xint",                            /* interpreted mode execution only */
+        "-Xnoclassgc",                      /* disable class garbage collection */
+        "-Xincgc",                          /* enable incremental garbage collection */
+        "-Xbatch",                          /* disable background compilation */
+        "-Xprof",                           /* output cpu profiling data */
+        "-Xdebug",                          /* enable remote debugging */
+        "-Xfuture",                         /* enable strictest checks, anticipating future default */
+        "-Xrs",                             /* reduce use of OS signals by Java/VM (see documentation) */
+        "-XX:+ForceTimeHighResolution",     /* use high resolution timer */
+        "-XX:-ForceTimeHighResolution",     /* use low resolution (default) */
+        };
+    }
+
+    /**
+     * Returns an array containing the starts of valid (ie safe and supported)
+     * arguments for the JVM
+     * 
+     * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
+     */
+    private String[] getValidStartingVMArguments() {
+        return new String[] {
+        "-ea",                          /* enable assertions for classes */
+        "-enableassertions",            /* enable assertions for classes */
+        "-da",                          /* disable assertions for classes */
+        "-disableassertions",           /* disable assertions for classes */
+        "-verbose",                     /* enable verbose output */
+        "-Xms",                         /* set initial Java heap size */
+        "-Xmx",                         /* set maximum Java heap size */
+        "-Xss",                         /* set java thread stack size */
+        "-XX:NewRatio",                 /* set Ratio of new/old gen sizes */
+        "-XX:NewSize",                  /* set initial size of new generation */
+        "-XX:MaxNewSize",               /* set max size of new generation */
+        "-XX:PermSize",                 /* set initial size of permanent gen */
+        "-XX:MaxPermSize",              /* set max size of permanent gen */
+        "-XX:MaxHeapFreeRatio",         /* heap free percentage (default 70) */
+        "-XX:MinHeapFreeRatio",         /* heap free percentage (default 40) */
+        "-XX:UseSerialGC",              /* use serial garbage collection */
+        "-XX:ThreadStackSize",          /* thread stack size (in KB) */
+        "-XX:MaxInlineSize",            /* set max num of bytecodes to inline */
+        "-XX:ReservedCodeCacheSize",    /* Reserved code cache size (bytes) */
+        "-XX:MaxDirectMemorySize",
+
+        };
+    }
+
+    /**
+     * 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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,253 @@
+/*
+ * 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.Calendar;
+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, 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.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" +
+                         Math.abs(((new java.util.Random()).nextInt())) + "-" +
+                         documentBase;
+    }
+
+    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	Mon Mar 29 02:54:20 2010 +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/RelatedContentDesc.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,93 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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.net.URL;
+
+public class RelatedContentDesc {
+
+    /** title of the content */
+    private String title = null;;
+
+    /** the description of the content */
+    private String description = null;
+
+    /** the location of the content */
+    private URL location = null;
+
+    /** the icon for this related content */
+    private IconDesc icon = null;
+
+    /**
+     * Create a related-content descriptor
+     * @param href the url of the related content
+     */
+    public RelatedContentDesc(URL href) {
+        this.location = href;
+    }
+
+    /**
+     * Set the title of this content
+     * @param title the title of this content
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /**
+     * Returns the title of this content..
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * Set the description of this related content
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Returns the description of the related content
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Returns the location of the related content. Not null
+     */
+    public URL getLocation() {
+        return location;
+    }
+
+    /**
+     * Set the icon for this related content
+     */
+    public void setIconDesc(IconDesc icon) {
+        this.icon = icon;
+    }
+
+    /**
+     * Returns the icon descriptor for the realted content
+     */
+    public IconDesc getIcon() {
+        return icon;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/ResourcesDesc.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,197 @@
+// 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;
+    }
+    
+    /**
+     * Returns a PermissionCollection containing the sandbox permissions
+     */
+    public PermissionCollection getSandBoxPermissions() {
+        
+        Permissions permissions = new Permissions();
+
+        for (int i=0; i < sandboxPermissions.length; i++)
+            permissions.add(sandboxPermissions[i]);
+
+        if (downloadHost != null)
+            permissions.add(new SocketPermission(downloadHost,
+                                                 "connect, accept"));
+
+        // 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/ShortcutDesc.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,70 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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;
+
+public final class ShortcutDesc {
+
+    /** the application wants to be placed on the desktop */
+    private boolean onDesktop = false;
+
+    /** the application needs to be launched online */
+    private boolean requiresOnline = true;
+
+    /** the menu descriptor */
+    private MenuDesc menu = null;
+
+    /**
+     * Create a new Shortcut descriptor
+     * @param requiresOnline whether the shortcut requires connectivity
+     * @param onDesktop whether the shortcut wants to be placed on the desktop
+     */
+    public ShortcutDesc(boolean requiresOnline, boolean onDesktop) {
+        this.requiresOnline = requiresOnline;
+        this.onDesktop = onDesktop;
+    }
+
+    /**
+     * Returns whether the shortcut requires being online
+     */
+    public boolean isOnline() {
+        return requiresOnline;
+    }
+
+    /**
+     * Return whether the shortcut should be placed on the desktop
+     */
+    public boolean onDesktop() {
+        return onDesktop;
+    }
+
+    /**
+     * Add a shortcut to the 'start menu'
+     * (whatever that means on gnome/kde/other ...)
+     * @param menu if/what menu this shortcut should be added to
+     */
+    public void addMenu(MenuDesc menu) {
+        this.menu = menu;
+    }
+
+    /**
+     * Returns the menu this shortcut should be added to
+     */
+    public MenuDesc getMenu() {
+        return menu;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/StreamEater.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,45 @@
+// 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.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This class reads the output from a launched process and writes it to stdout.
+ */
+public class StreamEater extends Thread {
+    private InputStream stream;
+
+    public 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/Version.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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, Version version, UpdatePolicy policy) {
+        ResourceTracker rt = new ResourceTracker();
+        rt.addResource(location, 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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,271 @@
+// 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;
+    
+    /** 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, Version requestVersion, UpdatePolicy updatePolicy) {
+        this.location = location;
+        this.requestVersion = requestVersion;
+        this.updatePolicy = updatePolicy;
+    }
+
+    /**
+     * Return a shared Resource object representing the given
+     * location and version.
+     */
+    public static Resource getResource(URL location, Version requestVersion, UpdatePolicy updatePolicy) {
+        synchronized (resources) {
+            Resource resource = new Resource(location, requestVersion, updatePolicy);
+
+            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 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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,1051 @@
+// 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.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Pack200;
+import java.util.jar.Pack200.Unpacker;
+import java.util.zip.GZIPInputStream;
+
+import net.sourceforge.jnlp.Version;
+import net.sourceforge.jnlp.event.DownloadEvent;
+import net.sourceforge.jnlp.event.DownloadListener;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.util.WeakList;
+
+/**
+ * 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, Version version, UpdatePolicy updatePolicy) {
+        if (location == null)
+            throw new IllegalArgumentException("location==null");
+
+        Resource resource = Resource.getResource(location, version, updatePolicy);
+        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 a resource to a file, uncompressing it if required
+     * 
+     * @param resource the resource to download
+     */
+    private void downloadResource(Resource resource) {
+        resource.fireDownloadEvent(); // fire DOWNLOADING
+
+        try {
+            // create out second in case in does not exist
+            URLConnection con = getVersionedResourceURL(resource).openConnection();
+            con.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
+            
+            con.connect();
+
+            /*
+             * We dont really know what we are downloading. If we ask for
+             * foo.jar, the server might send us foo.jar.pack.gz or foo.jar.gz
+             * instead. So we save the file with the appropriate extension
+             */
+            URL downloadLocation = resource.location;
+
+            String contentEncoding = con.getContentEncoding();
+
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Content encoding for " + resource.location + ": "
+                        + contentEncoding);
+            }
+
+            if (contentEncoding != null) {
+                if (contentEncoding.equals("gzip")) {
+                    downloadLocation = new URL(downloadLocation.toString() + ".gz");
+                } else if (contentEncoding.equals("pack200-gzip")) {
+                    downloadLocation = new URL(downloadLocation.toString() + ".pack.gz");
+                }
+            }
+
+            InputStream in = new BufferedInputStream(con.getInputStream());
+            OutputStream out = CacheUtil.getOutputStream(downloadLocation, 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();
+            
+            /*
+             * If the file was compressed, uncompress it.
+             */
+            if (contentEncoding != null) {
+                if (contentEncoding.equals("gzip")) {
+                    GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(CacheUtil
+                            .getCacheFile(downloadLocation, resource.downloadVersion)));
+                    InputStream inputStream = new BufferedInputStream(gzInputStream);
+
+                    BufferedOutputStream outputStream = new BufferedOutputStream(
+                            new FileOutputStream(CacheUtil.getCacheFile(resource.location,
+                                    resource.downloadVersion)));
+
+                    while (-1 != (rlen = inputStream.read(buf))) {
+                        outputStream.write(buf, 0, rlen);
+                    }
+
+                    outputStream.close();
+                    inputStream.close();
+                    gzInputStream.close();
+                    
+                } else if (contentEncoding.equals("pack200-gzip")) {
+                    GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(
+                            CacheUtil.getCacheFile(downloadLocation, resource.downloadVersion)));
+                    InputStream inputStream = new BufferedInputStream(gzInputStream);
+
+                    JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(
+                            CacheUtil.getCacheFile(resource.location, resource.downloadVersion)));
+
+                    Unpacker unpacker = Pack200.newUnpacker();
+                    unpacker.unpack(inputStream, outputStream);
+
+                    outputStream.close();
+                    inputStream.close();
+                    gzInputStream.close();
+                }
+            }
+            
+            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
+            connection.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
+
+            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
+        }
+    }
+
+    /**
+     * Returns the versioned url for a resource
+     * @param resource the resource to get the url for 
+     */
+    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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,174 @@
+# 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.
+PTwoDesktops=Only one desktop element allowed
+PTwoMenus=Only one menu element allowed
+PTwoTitles=Only one title element allowed
+PTwoIcons=Only one icon element allowed
+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.
+PBadHeapSize=Invalid value for heap size ({0})
+
+# 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.
+RNoLockDir=Unable to create locks directory ({0})
+RNestedJarExtration=Unable to extract nested jar.
+RUnexpected=Unexpected {0} at {1}
+
+# 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.
+BXnofork    = Do not create another JVM.
+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?
+SDesktopShortcut=The application has requested permission to create a desktop launcher. 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.
+SCNMisMatch=The expected hostname for this certificate is: "{0}"<BR>The address being connected to is: "{1}"
+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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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.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.security.SecurityWarningDialog.AccessType;
+import net.sourceforge.jnlp.services.ServiceUtil;
+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();
+
+        //Fixme: -Should check whether a desktop entry already exists for
+        //        for this jnlp file, and do nothing if it exists.
+        //       -If no href is specified in the jnlp tag, it should 
+        //        default to using the one passed in as an argument.
+        addMenuAndDesktopEntries();
+    }
+
+    /**
+     * Creates menu and desktop entries if required by the jnlp file
+     */
+
+    private void addMenuAndDesktopEntries() {
+        XDesktopEntry entry = new XDesktopEntry(file);
+        ShortcutDesc sd = file.getInformation().getShortcut();
+
+        if (sd != null && sd.onDesktop()) {
+            if (ServiceUtil.checkAccess(this, AccessType.CREATE_DESTKOP_SHORTCUT)) {
+                entry.createDesktopShortcut();
+            }
+        }
+
+        if (sd != null && sd.getMenu() != null) {
+            /*
+             * Sun's WebStart implementation doesnt seem to do anything under GNOME
+             */
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("ApplicationInstance.addMenuAndDesktopEntries():"
+                        + " Adding menu entries NOT IMPLEMENTED");
+            }
+        }
+
+    }
+
+    /**
+     * 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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,451 @@
+// 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.Arrays;
+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 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"
+        + "  -Xnofork              "+R("BXnofork")+"\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);
+        
+        if (null != getOption("-Xnofork")) {
+            JNLPRuntime.setForksAllowed(false);
+        }
+        
+        // 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();
+        }
+
+        JNLPRuntime.setInitialArgments(Arrays.asList(argsIn));
+        
+        // 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());
+
+    }
+
+    /**
+     * 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(JNLPRuntime.getMessage("RUnexpected", 
+                        new Object[] {ex.toString(), ex.getStackTrace()[0]} ));
+        }
+
+        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(JNLPRuntime.NETX_ABOUT_FILE).exists())
+            return JNLPRuntime.NETX_ABOUT_FILE;
+        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, strict);
+
+        // Launches the jnlp file where this file originated. 
+        if (file.getSourceLocation() != null) {
+            file = new JNLPFile(file.getSourceLocation(), 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 JNLPRuntime.NETX_ABOUT_FILE file.
+     * 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
+        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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,1052 @@
+
+// 
+// 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.Version;
+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() {
+		
+        URL codebase = null;
+
+        if (file.getCodeBase() != null) {
+            codebase = file.getCodeBase();
+        } else {
+            //Fixme: codebase should be the codebase of the Main Jar not 
+            //the location. Although, it still works in the current state.
+            codebase = file.getResources().getMainJAR().getLocation();
+        }
+
+        /**
+         * 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,
+                    codebase.getHost());
+            } else {
+                this.security = new SecurityDesc(file, 
+                    SecurityDesc.SANDBOX_PERMISSIONS, 
+                    codebase.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, 
+                        codebase.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 baseLoader = null;
+        JNLPClassLoader loader = null;
+        String uniqueKey = file.getUniqueKey();
+
+        if (uniqueKey != null)
+            baseLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
+
+		try {
+		    
+		    // If base loader is null, or the baseloader's file and this 
+		    // file is different, initialize a new loader
+		    if (baseLoader == null || 
+		        !baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation())) {
+
+		        loader = new JNLPClassLoader(file, policy);
+
+		        // New loader init may have caused extentions to create a 
+		        // loader for this unique key. Check.
+		        JNLPClassLoader extLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
+
+		        if (extLoader != null) {
+		            for (URL u : loader.getURLs())
+		                extLoader.addURL(u);
+
+		            loader = extLoader;
+		        }
+
+                // loader is now current + ext. But we also need to think of 
+                // the baseLoader
+		        if (baseLoader != null) {
+                    for (URL u : loader.getURLs())
+                        baseLoader.addURL(u);
+
+                    loader = baseLoader;
+                } 
+
+		    } else {
+		        // if key is same and locations match, this is the loader we want
+		        loader = baseLoader;
+		    }
+
+		} catch (LaunchException e) {
+			throw e;
+		}
+
+        // loaders are mapped to a unique key. Only extensions and parent 
+        // share a key, so it is safe to always share based on it
+        urlToLoader.put(uniqueKey, loader);
+
+        return loader;
+    }
+
+    /**
+     * Returns a JNLP classloader for the JNLP file at the specified
+     * location. 
+     *
+     * @param location the file's location
+     * @param version the file's version
+     * @param policy the update policy to use when downloading resources
+     */
+    public static JNLPClassLoader getInstance(URL location, String uniqueKey, Version version, UpdatePolicy policy)
+            throws IOException, ParseException, LaunchException {
+        JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
+
+        if (loader == null || !location.equals(loader.getJNLPFile().getFileLocation()))
+            loader = getInstance(new JNLPFile(location, uniqueKey, version, 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 {
+                    String uniqueKey = this.getJNLPFile().getUniqueKey();
+                    JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), 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(),
+                                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) {
+            // Security desc. is used only to track security settings for the
+            // application. However, an application may comprise of multiple
+            // jars, and as such, security must be evaluated on a per jar basis.
+            
+            // set default perms
+            PermissionCollection permissions = security.getSandBoxPermissions();
+            
+            // If more than default is needed, evaluate based on codesource
+            if (security.getSecurityType().equals(SecurityDesc.ALL_PERMISSIONS) ||
+                security.getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS)) {
+
+                if (cs.getCodeSigners() != null) {
+                    permissions = security.getPermissions();
+                }
+            }
+
+            Enumeration<Permission> e = permissions.elements();
+            while (e.hasMoreElements())
+                result.add(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();
+                                    File parentDir = new File(extractedJarLocation).getParentFile();
+                                    if (!parentDir.isDirectory() && !parentDir.mkdirs()) {
+                                        throw new RuntimeException(R("RNestedJarExtration"));
+                                    }
+                                    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(),
+                                    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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,559 @@
+// 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.util.List;
+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; 
+    
+    /** set to false to indicate another JVM should not be spawned, even if necessary */
+    private static boolean forksAllowed = true;
+
+    /** contains the arguments passed to the jnlp runtime */
+    private static List<String> initialArguments;
+
+    /** Username */
+    public static final String USER = System.getProperty("user.name");
+
+    /** User's home directory */
+    public static final String HOME_DIR = System.getProperty("user.home");
+
+    /** the ~/.netxrc file containing netx settings */
+    public static final String NETXRC_FILE = HOME_DIR + File.separator + ".netxrc";
+
+    /** the ~/.netx directory containing user-specific data */
+    public static final String NETX_DIR = HOME_DIR + File.separator + ".netx";
+
+    /** the ~/.netx/security directory containing security related information */
+    public static final String SECURITY_DIR = NETX_DIR + File.separator + "security";
+
+    /** the ~/.netx/security/trusted.certs file containing trusted certificates */
+    public static final String CERTIFICATES_FILE = SECURITY_DIR + File.separator + "trusted.certs";
+
+    /** the /tmp/ directory used for temporary files */
+    public static final String TMP_DIR = System.getProperty("java.io.tmpdir");
+
+    /**
+     * the /tmp/$USER/netx/locks/ directory containing locks for single instance
+     * applications
+     */
+    public static final String LOCKS_DIR = TMP_DIR + File.separator + USER + File.separator
+            + "netx" + File.separator + "locks";
+
+    /** the java.home directory */
+    public static final String JAVA_HOME_DIR = System.getProperty("java.home");
+    
+    /** the JNLP file to open to display the network-based about window */
+    public static final String NETX_ABOUT_FILE = JAVA_HOME_DIR + File.separator + "lib"
+            + File.separator + "about.jnlp";
+
+    
+    
+    /**
+     * 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();
+
+        String baseStr = props.getProperty("basedir");
+        if (baseStr != null)
+            return new File(baseStr);
+
+        String homeDir = HOME_DIR;
+        File baseDir = new File(NETX_DIR);
+        if (homeDir == null || (!baseDir.isDirectory() && !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(NETXRC_FILE);
+        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);
+    }
+
+    /**
+     * Returns true if the current runtime will fork
+     */
+    public static boolean getForksAllowed() {
+        return forksAllowed;
+    }
+    
+    public static void setForksAllowed(boolean value) {
+        checkInitialized();
+        forksAllowed = value;
+    }
+    
+    /**
+     * 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();
+        }
+    }
+
+
+    public static void setInitialArgments(List<String> args) {
+        checkInitialized();
+        SecurityManager securityManager = System.getSecurityManager();
+        if (securityManager != null)
+            securityManager.checkPermission(new AllPermission());
+        initialArguments = args;
+    }
+    
+    public static List<String> getInitialArguments() {
+        return initialArguments;
+    }
+    
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,556 @@
+// 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 java.util.PropertyPermission;
+
+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 = null;
+				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 if (perm instanceof PropertyPermission) {
+
+				    if (JNLPRuntime.isDebug())
+				        System.err.println("Requesting property: " + perm.toString());
+
+				    // We go by the rules here:
+				    // http://java.sun.com/docs/books/tutorial/deployment/doingMoreWithRIA/properties.html
+
+				    // Since this is security sensitive, take a conservative approach:
+				    // Allow only what is specifically allowed, and deny everything else
+
+				    // First, allow what everyone is allowed to read
+				    if (perm.getActions().equals("read")) {
+				        if (    perm.getName().equals("java.class.version") ||
+				                perm.getName().equals("java.vendor") ||
+				                perm.getName().equals("java.vendor.url")  ||
+				                perm.getName().equals("java.version") ||
+				                perm.getName().equals("os.name") ||
+				                perm.getName().equals("os.arch") ||
+				                perm.getName().equals("os.version") ||
+				                perm.getName().equals("file.separator") ||
+				                perm.getName().equals("path.separator") ||
+				                perm.getName().equals("line.separator") ||
+				                perm.getName().startsWith("javaplugin.")
+				            ) {
+				            return;
+				        }
+				    }
+
+				    // Next, allow what only JNLP apps can do
+				    if (getApplication().getJNLPFile().isApplication()) {
+				        if (    perm.getName().equals("awt.useSystemAAFontSettings") ||
+				                perm.getName().equals("http.agent") ||
+				                perm.getName().equals("http.keepAlive") ||
+				                perm.getName().equals("java.awt.syncLWRequests") ||
+				                perm.getName().equals("java.awt.Window.locationByPlatform") ||
+				                perm.getName().equals("javaws.cfg.jauthenticator") ||
+				                perm.getName().equals("javax.swing.defaultlf") ||
+				                perm.getName().equals("sun.awt.noerasebackground") ||
+				                perm.getName().equals("sun.awt.erasebackgroundonresize") ||
+				                perm.getName().equals("sun.java2d.d3d") ||
+				                perm.getName().equals("sun.java2d.dpiaware") ||
+				                perm.getName().equals("sun.java2d.noddraw") ||
+				                perm.getName().equals("sun.java2d.opengl") ||
+				                perm.getName().equals("swing.boldMetal") ||
+				                perm.getName().equals("swing.metalTheme") ||
+				                perm.getName().equals("swing.noxp") ||
+				                perm.getName().equals("swing.useSystemFontSettings")
+				        ) {
+				            return; // JNLP apps can read and write to these
+				        }
+				    }
+
+				    // Next, allow access to customizable properties 
+				    if (perm.getName().startsWith("jnlp.") || 
+				        perm.getName().startsWith("javaws.")) {
+				        return;
+				    }
+
+				    // Everything else is denied
+				    throw se;
+
+				} else {
+				    tmpPerm = perm;
+				}
+
+				if (tmpPerm != null) {
+				    //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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,215 @@
+/* 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 CREATE_DESTKOP_SHORTCUT:
+			    topLabelText = R("SDesktopShortcut");
+			    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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,269 @@
+/* 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 = SecurityUtil.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 = SecurityUtil.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>";
+    }
+
+	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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,340 @@
+/* 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 = 
+			SecurityUtil.getCN(firstCert.getSubjectX500Principal().getName());
+		String issuerString = 
+			SecurityUtil.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 = 
+				SecurityUtil.getCN(secondCert.getSubjectX500Principal().getName());
+			issuerString = 
+				SecurityUtil.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] = SecurityUtil.getCN(c.getSubjectX500Principal().getName())
+				+ " (" + SecurityUtil.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);
+	}
+
+	/**
+	 * 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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,238 @@
+/* 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.io.IOException;
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateExpiredException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateNotYetValidException;
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.tools.KeyTool;
+import sun.security.util.DerValue;
+import sun.security.util.HostnameChecker;
+import sun.security.x509.X500Name;
+ 
+public class HttpsCertVerifier implements CertVerifier {
+
+    private VariableX509TrustManager tm;
+    private X509Certificate[] chain;
+    private String authType;
+    private String hostName;
+    private boolean isTrusted;
+    private boolean hostMatched;
+    private ArrayList<String> details = new ArrayList<String>();
+    
+    public HttpsCertVerifier(VariableX509TrustManager tm, 
+                             X509Certificate[] chain, String authType, 
+                             boolean isTrusted, boolean hostMatched,
+                             String hostName) {
+        this.tm = tm;
+        this.chain = chain;
+        this.authType = authType;
+        this.hostName = hostName;
+        this.isTrusted = isTrusted;
+        this.hostMatched = hostMatched;
+    }
+
+    public boolean getAlreadyTrustPublisher() {
+        return isTrusted;
+    }
+
+    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; 
+	boolean CNMisMatch = !hostMatched;
+
+	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;
+	   }
+	}
+
+	String altNames = getNamesForCert(chain[0]);
+
+	if (isUntrusted || hasExpiredCert || hasExpiringCert || notYetValidCert || CNMisMatch) {
+	      if (isUntrusted)
+	        addToDetails(R("SUntrustedCertificate"));
+              if (hasExpiredCert)
+                addToDetails(R("SHasExpiredCert"));
+              if (hasExpiringCert)
+                addToDetails(R("SHasExpiringCert"));
+              if (notYetValidCert)
+                addToDetails(R("SNotYetValidCert"));
+              if (CNMisMatch)
+                  addToDetails(R("SCNMisMatch", altNames, this.hostName));  
+        }
+	
+	
+	return details;
+    }
+
+    private String getNamesForCert(X509Certificate c) {
+        
+        String names = "";
+        
+        
+        // We use the specification from 
+        // http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/X509Certificate.html#getSubjectAlternativeNames()
+        // to determine the type of address
+        int ALTNAME_DNS = 2;
+        int ALTNAME_IP = 7;
+
+        try {
+            Collection<List<?>> subjAltNames = c.getSubjectAlternativeNames();
+            X500Name subjectName = HostnameChecker.getSubjectX500Name(c);
+            DerValue derValue = subjectName.findMostSpecificAttribute
+                                                        (X500Name.commonName_oid);
+            names += derValue.getAsString();
+
+            if (subjAltNames != null) {
+                for (List<?> next : subjAltNames) {
+                    if ( ((Integer)next.get(0)).intValue() == ALTNAME_IP || 
+                            ((Integer)next.get(0)).intValue() == ALTNAME_DNS
+                    ) {
+                        names += ", " + (String)next.get(1);
+                    }
+                }
+            }
+            
+            if (subjAltNames != null)
+                names = names.substring(2); // remove proceeding ", "
+
+        } catch (CertificateParsingException cpe) {
+            cpe.printStackTrace();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+
+        return names;
+    }
+    
+    private void addToDetails(String detail) {
+      if (!details.contains(detail))
+        details.add(detail);
+    }
+
+    private static String R(String key) {
+      return JNLPRuntime.getMessage(key);
+    }
+    
+    private static String R(String key, String arg1, String arg2) {
+        return JNLPRuntime.getMessage(key, new Object[] { arg1, arg2 });
+    }
+
+    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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,285 @@
+/* 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;
+
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+public class SecurityUtil {
+
+	private static final char[] password = "changeit".toCharArray();
+	
+	public static String getTrustedCertsFilename() throws Exception{
+		
+		String homeDir = JNLPRuntime.HOME_DIR;
+		
+		if (homeDir == null) {
+			throw new Exception("Could not access home directory");
+		} else {
+			return JNLPRuntime.CERTIFICATES_FILE;
+		}
+	}
+	
+	public static char[] getTrustedCertsPassword() {
+		return password;
+	}
+	
+    /**
+     * Extracts the CN field from a Certificate principal string. Or, if it
+     * can't find that, return the principal unmodified.
+     * 
+     * This is a simple (and hence 'wrong') version. See
+     * http://www.ietf.org/rfc/rfc2253.txt for all the gory details.
+     */
+    public static String getCN(String principal) {
+
+        /*
+         * FIXME Incomplete
+         * 
+         * This does not implement RFC 2253 completely
+         * 
+         * Issues:
+         * - rfc2253 talks about utf8, java uses utf16.
+         * - theoretically, java should have dealt with all byte encodings
+         *   so we shouldnt even see cases like \FF
+         * - if the above is wrong, then we need to deal with cases like 
+         *   \FF\FF
+         */
+
+        int start = principal.indexOf("CN=");
+        if (start == -1) {
+            return principal;
+        }
+
+        StringBuilder commonName = new StringBuilder();
+
+        boolean inQuotes = false;
+        boolean escaped = false;
+
+        /*
+         * bit 0 = high order bit. bit 1 = low order bit
+         */
+        char[] hexBits = null;
+
+        for (int i = start + 3; i < principal.length(); i++) {
+            char ch = principal.charAt(i);
+            switch (ch) {
+            case '"':
+                if (escaped) {
+                    commonName.append(ch);
+                    escaped = false;
+                } else {
+                    inQuotes = !inQuotes;
+                }
+                break;
+
+            case '\\':
+                if (escaped) {
+                    commonName.append(ch);
+                    escaped = false;
+                } else {
+                    escaped = true;
+                }
+                break;
+
+            case ',':
+                /* fall through */
+            case ';':
+                /* fall through */
+            case '+':
+                if (escaped || inQuotes) {
+                    commonName.append(ch);
+                    if (escaped) {
+                        escaped = false;
+                    }
+                } else {
+                    return commonName.toString();
+                }
+                break;
+
+            default:
+                if (escaped && isHexDigit(ch)) {
+                    hexBits = new char[2];
+                    hexBits[0] = ch;
+                } else if (hexBits != null) {
+                    if (!isHexDigit(ch)) {
+                        /* error parsing */
+                        return "";
+                    }
+                    hexBits[1] = ch;
+                    commonName.append((char) Integer.parseInt(new String(hexBits), 16));
+                    hexBits = null;
+                } else {
+                    commonName.append(ch);
+                }
+                escaped = false;
+            }
+        }
+
+        return commonName.toString();
+
+    }
+
+    private static boolean isHexDigit(char ch) {
+        return ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'));
+    }
+
+	/**
+	 * 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 = certFile.getAbsoluteFile().getParentFile();
+			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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,430 @@
+/* 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,
+        CREATE_DESTKOP_SHORTCUT,
+        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	Mon Mar 29 02:54:20 2010 +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 = 
+			SecurityUtil.getCN(cert.getSubjectX500Principal().getName());
+		String issuerString = 
+			SecurityUtil.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] = SecurityUtil.getCN(c.getSubjectX500Principal().getName())
+		+ " (" + SecurityUtil.getCN(c.getIssuerX500Principal().getName()) + ")";
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/security/VariableX509TrustManager.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,286 @@
+/* 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.util.HostnameChecker;
+import sun.security.validator.ValidatorException;
+
+import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
+
+/**
+ * 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 extends X509ExtendedTrustManager {
+
+    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 (no support for custom here, only system/user)
+     */
+    public void checkClientTrusted(X509Certificate[] chain, String authType, 
+                                   String hostName, String algorithm)
+            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 checkClientTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+        checkClientTrusted(chain, authType, null, null);
+    }
+
+    public void checkServerTrusted(X509Certificate[] chain, String authType, 
+                                   String hostName, String algorithm)
+            throws CertificateException {
+        checkServerTrusted(chain, authType, hostName, false);
+    }
+    
+    public void checkServerTrusted(X509Certificate[] chain, String authType)
+            throws CertificateException {
+        checkServerTrusted(chain, authType, null, null);
+    }
+
+    /**
+     * 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 synchronized void checkServerTrusted(X509Certificate[] chain, 
+                             String authType, String hostName, 
+                             boolean checkOnly) throws CertificateException {
+        CertificateException ce = null;
+        boolean trusted = true;
+        boolean CNMatched = true;
+
+        try {
+            checkAllManagers(chain, authType);
+        } catch (CertificateException e) {
+            trusted = false;
+            ce = e;
+        }
+
+        // If the certificate is not explicitly trusted, we 
+        // need to prompt the user
+        if (!isExplicitlyTrusted(chain, authType)) {
+
+            try {
+                HostnameChecker checker = HostnameChecker
+                        .getInstance(HostnameChecker.TYPE_TLS);
+
+                checker.match(hostName, chain[0]); // only need to match @ 0 for
+                                                   // CN
+
+            } catch (CertificateException e) {
+                CNMatched = false;
+                ce = e;
+            }
+        }
+
+        if (!trusted || !CNMatched) {
+            if (checkOnly) {
+                throw ce;
+            } else {
+
+                boolean b = askUser(chain, authType, trusted, CNMatched, hostName);
+
+                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;
+            }
+        }        
+    }
+    
+    /**
+     * Return if the user explicitly trusted this i.e. in userTrustManager or temporarilyTrusted
+     */
+    private boolean isExplicitlyTrusted(X509Certificate[] chain, String authType) {
+        boolean explicitlyTrusted = false;
+        
+        try {
+            userTrustManager.checkServerTrusted(chain, authType);
+            explicitlyTrusted = true;
+        } catch (ValidatorException uex) {
+            if (temporarilyTrusted.contains(chain[0]))
+                explicitlyTrusted = true;
+        } catch (CertificateException ce) {
+            // do nothing, this means that the cert is not explicitly trusted
+        }
+
+        return explicitlyTrusted;
+        
+    }
+
+    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, 
+                            boolean isTrusted, boolean hostMatched, 
+                            String hostName) {
+    	return SecurityWarningDialog.showCertWarningDialog(
+    	                SecurityWarningDialog.AccessType.UNVERIFIED, null, 
+    	                new HttpsCertVerifier(this, chain, authType, 
+    	                                      isTrusted, hostMatched,
+    	                                      hostName)); 
+    }
+
+    /**
+     * 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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/ExtendedSingleInstanceService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,49 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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 javax.jnlp.SingleInstanceService;
+
+import net.sourceforge.jnlp.JNLPFile;
+
+/**
+ * Extends SingleInstanceService to provide a few additional methods that are
+ * required to initialize SingleInstanceService and check things. These methods
+ * are not exposed publicly
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ * 
+ */
+interface ExtendedSingleInstanceService extends SingleInstanceService {
+
+    /**
+     * Check if the instance identified by this jnlp file is already running
+     * 
+     * @param jnlpFile The JNLPFile that specifies the application
+     * 
+     * @throws InstanceExistsException if an instance of this application
+     *         already exists
+     * 
+     */
+    void checkSingleInstanceRunning(JNLPFile jnlpFile);
+
+    /**
+     * Start a single instance service based on the current application
+     */
+    void initializeSingleInstance();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/InstanceExistsException.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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;
+
+/**
+ * 
+ * This class represents an exception indicating that an application instance
+ * already exists for this jnlp file
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ * 
+ */
+public class InstanceExistsException extends RuntimeException {
+
+    private static final long serialVersionUID = 7950552292795498272L;
+
+    public InstanceExistsException(String message) {
+        super(message);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,276 @@
+// 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.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import javax.jnlp.BasicService;
+import javax.jnlp.ClipboardService;
+import javax.jnlp.DownloadService;
+import javax.jnlp.ExtensionInstallerService;
+import javax.jnlp.FileOpenService;
+import javax.jnlp.FileSaveService;
+import javax.jnlp.PersistenceService;
+import javax.jnlp.PrintService;
+import javax.jnlp.ServiceManager;
+import javax.jnlp.SingleInstanceService;
+import javax.jnlp.UnavailableServiceException;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.runtime.ApplicationInstance;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+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);
+    }
+
+    /**
+     * 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 SingleInstanceService reference, or null if the service is
+     * unavailable.
+     */
+    public static SingleInstanceService getSingleInstanceService() {
+        return (SingleInstanceService) getService("javax.jnlp.SingleInstanceService");
+    }
+    
+    /**
+     * Checks that this application (represented by the jnlp) isnt already running
+     * @param jnlpFile the {@link JNLPFile} that specifies the application
+     * 
+     * @throws InstanceExistsException if an instance of this application already exists
+     */
+    public static void checkExistingSingleInstance(JNLPFile jnlpFile) {
+        ExtendedSingleInstanceService esis = (ExtendedSingleInstanceService) getSingleInstanceService();
+        esis.checkSingleInstanceRunning(jnlpFile);
+    }
+    
+    /**
+     * 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);
+                }
+            };
+
+            try {
+                Object result = AccessController.doPrivileged(invoker);
+
+                if (JNLPRuntime.isDebug())
+                    System.err.println("        result: "+result);
+
+                return result;
+            } catch (PrivilegedActionException e) {
+                // Any exceptions thrown by the actual methods are wrapped by a 
+                // InvocationTargetException, which is further wrapped by the 
+                // PrivilegedActionException. Lets unwrap them to make the 
+                // proxy transparent to the callers
+                if (e.getCause() instanceof InvocationTargetException) {
+                    throw e.getCause().getCause();
+                } else {
+                    throw e.getCause();
+                }
+            }
+
+        }
+    };
+
+    /**
+     * 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) {
+        return checkAccess(null, type, extras);
+    }    
+    
+    /**
+     * 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 app the application which is requesting the check. If null, the current
+     * application is used.
+     * @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(ApplicationInstance app, 
+            SecurityWarningDialog.AccessType type,
+    		Object... extras) {
+
+        if (app == null) {
+            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/SingleInstanceLock.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,194 @@
+// Copyright (C) 2009 Red Hat, Inc.
+//
+// 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.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.BindException;
+import java.net.ServerSocket;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.util.FileUtils;
+
+/**
+ * This class represents a Lock for single instance jnlp applications
+ * 
+ * The lock is per-session, per user.
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ */
+class SingleInstanceLock {
+
+    JNLPFile jnlpFile;
+    File lockFile = null;
+
+    public static final int INVALID_PORT = Integer.MIN_VALUE;
+
+    int port = INVALID_PORT;
+
+    /**
+     * Create an object to manage the instance lock for the specified JNLP file.
+     * 
+     * @param jnlpFile the jnlpfile to create the lock for
+     */
+    public SingleInstanceLock(JNLPFile jnlpFile) {
+        this.jnlpFile = jnlpFile;
+        lockFile = getLockFile();
+
+    }
+
+    /**
+     * Create/overwrite the instance lock for the jnlp file.
+     * 
+     * @param localPort the network port for the lock
+     * @throws IOException on any io problems
+     */
+    public void createWithPort(int localPort) throws IOException {
+
+        BufferedWriter lockFileWriter = new BufferedWriter(new FileWriter(lockFile, false));
+        lockFileWriter.write(String.valueOf(localPort));
+        lockFileWriter.newLine();
+        lockFileWriter.flush();
+        lockFileWriter.close();
+
+    }
+
+    /**
+     * Returns true if the lock if valid. That is, the lock exists, and port it
+     * points to is listening for incoming messages.
+     */
+    public boolean isValid() {
+        return (exists() && getPort() != INVALID_PORT && !isPortFree(getPort()));
+    }
+
+    /**
+     * Returns the port in this lock file.
+     */
+    public int getPort() {
+        if (!exists()) {
+            return INVALID_PORT;
+        }
+
+        try {
+            parseFile();
+        } catch (NumberFormatException e) {
+            port = INVALID_PORT;
+        } catch (IOException e) {
+            port = INVALID_PORT;
+        }
+        return port;
+
+    }
+
+    /**
+     * Returns true if the lock file already exists.
+     */
+    private boolean exists() {
+        return lockFile.exists();
+    }
+
+    /**
+     * Returns true if the port is free.
+     */
+    private boolean isPortFree(int port) {
+        try {
+            ServerSocket socket = new ServerSocket(port);
+            socket.close();
+            return true;
+        } catch (BindException e) {
+            return false;
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Return a file object that represents the lock file. The lock file itself
+     * may or may not exist.
+     */
+    private File getLockFile() {
+        File baseDir = new File(JNLPRuntime.LOCKS_DIR);
+
+        if (!baseDir.isDirectory() && !baseDir.mkdirs()) {
+            throw new RuntimeException(R("RNoLockDir", baseDir));
+        }
+        String lockFileName = getLockFileName();
+        File applicationLockFile = new File(baseDir, lockFileName);
+        return applicationLockFile;
+    }
+
+    /**
+     * Returns the name of the lock file.
+     */
+    private String getLockFileName() {
+        String initialName = "";
+
+        if (jnlpFile.getSourceLocation() != null) {
+            initialName = initialName + jnlpFile.getSourceLocation();
+        } else {
+            initialName = initialName + jnlpFile.getFileLocation();
+        }
+
+        if (jnlpFile.getFileVersion() != null) {
+            initialName = initialName + jnlpFile.getFileVersion().toString();
+        }
+        
+        initialName = initialName + getCurrentDisplay();
+        return FileUtils.sanitizeFileName(initialName);
+
+    }
+
+    /**
+     * Parse the lock file.
+     * 
+     * @throws NumberFormatException
+     * @throws IOException
+     */
+    private void parseFile() throws NumberFormatException, IOException {
+        BufferedReader lockFileReader = new BufferedReader(new FileReader(lockFile));
+        int port = Integer.valueOf(lockFileReader.readLine());
+        lockFileReader.close();
+        this.port = port;
+    }
+
+    /**
+     * Returns a string identifying this display.
+     * 
+     * Implementation note: On systems with X support, this is the DISPLAY
+     * variable
+     * 
+     * @return a string that is guaranteed to be not null.
+     */
+    private String getCurrentDisplay() {
+        String display = System.getenv("DISPLAY");
+        return (display == null) ? "" : display;
+    }
+
+    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 });
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XBasicService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,234 @@
+// 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.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.jnlp.BasicService;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import net.sourceforge.jnlp.InformationDesc;
+import net.sourceforge.jnlp.JARDesc;
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.Launcher;
+import net.sourceforge.jnlp.runtime.ApplicationInstance;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+import net.sourceforge.jnlp.util.PropertiesFile;
+
+/**
+ * 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() {
+        
+        URL url = findFirstURLFromJNLPFile();
+        
+        try {
+            url.openConnection().getInputStream().close();
+            return false;
+        } catch (IOException exception) {
+            return true;
+        }
+    }
+
+    /**
+     * Return the first URL from the jnlp file
+     * Or a default URL if no url found in JNLP file
+     */
+    private URL findFirstURLFromJNLPFile() {
+        
+        ApplicationInstance app = JNLPRuntime.getApplication();
+        
+        if (app != null) {
+            JNLPFile jnlpFile = app.getJNLPFile();
+            
+            URL sourceURL = jnlpFile.getSourceLocation();
+            if (sourceURL != null) {
+                return sourceURL;
+            }
+            
+            URL codeBaseURL = jnlpFile.getCodeBase();
+            if (codeBaseURL != null) {
+                return codeBaseURL;
+            }
+    
+            InformationDesc informationDesc = jnlpFile.getInformation();
+            URL homePage = informationDesc.getHomepage();
+            if (homePage != null) {
+                return homePage;
+            }
+            
+            JARDesc[] jarDescs = jnlpFile.getResources().getJARs();
+            for (JARDesc jarDesc: jarDescs) {
+                return jarDesc.getLocation();
+            }
+        }
+        
+        // this section is only reached if the jnlp file has no jars.
+        // that doesnt seem very likely.
+        URL arbitraryURL;
+        try {
+            arbitraryURL = new URL("http://icedtea.classpath.org");
+        } catch (MalformedURLException malformedURL) {
+            throw new RuntimeException(malformedURL);
+        }
+        
+        return arbitraryURL;
+    }
+
+    /**
+     * 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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/XExtendedService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,54 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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.File;
+import java.io.IOException;
+
+import javax.jnlp.ExtendedService;
+import javax.jnlp.FileContents;
+
+import net.sourceforge.jnlp.security.SecurityWarningDialog;
+
+/**
+ * Implementation of ExtendedService
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ * 
+ */
+public class XExtendedService implements ExtendedService {
+
+    public FileContents openFile(File file) throws IOException {
+
+        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) {
+            return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class,
+                    new XFileContents(file));
+        } else {
+            return null;
+        }
+
+    }
+
+    public FileContents[] openFiles(File[] files) throws IOException {
+        FileContents[] contents = new FileContents[files.length];
+        for (int i = 0; i < files.length; i++) {
+            contents[i] = openFile(files[i]);
+        }
+        return contents;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XExtensionInstallerService.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,108 @@
+// 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.ExtendedService",
+        "javax.jnlp.ExtensionInstallerService", // required
+        "javax.jnlp.PersistenceService",
+        "javax.jnlp.FileOpenService",
+        "javax.jnlp.FileSaveService",
+        "javax.jnlp.ClipboardService",
+        "javax.jnlp.PrintService",
+        "javax.jnlp.SingleInstanceService"
+    };
+
+    private static Object services[] = {
+        ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()),
+        ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()),
+        ServiceUtil.createPrivilegedProxy(ExtendedService.class, new XExtendedService()),
+        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()),
+        ServiceUtil.createPrivilegedProxy(ExtendedSingleInstanceService.class, new XSingleInstanceService())
+    };
+
+
+    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/XSingleInstanceService.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,229 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.jnlp.SingleInstanceListener;
+import javax.management.InstanceAlreadyExistsException;
+
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * This class implements SingleInstanceService
+ * 
+ * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
+ */
+public class XSingleInstanceService implements ExtendedSingleInstanceService {
+
+    boolean initialized = false;
+    List<SingleInstanceListener> listeners = new LinkedList<SingleInstanceListener>();
+
+    /**
+     * Implements a server that listens for arguments from new instances of this
+     * application
+     * 
+     */
+    class SingleInstanceServer implements Runnable {
+
+        SingleInstanceLock lockFile = null;
+
+        public SingleInstanceServer(SingleInstanceLock lockFile) {
+            this.lockFile = lockFile;
+        }
+
+        public void run() {
+            ServerSocket listeningSocket = null;
+            try {
+                listeningSocket = new ServerSocket(0);
+                lockFile.createWithPort(listeningSocket.getLocalPort());
+
+                if (JNLPRuntime.isDebug()) {
+                    System.out.println("Starting SingleInstanceServer on port" + listeningSocket);
+                }
+
+                while (true) {
+                    try {
+                        Socket communicationSocket = listeningSocket.accept();
+                        ObjectInputStream ois = new ObjectInputStream(communicationSocket
+                                .getInputStream());
+                        String[] arguments = (String[]) ois.readObject();
+                        notifySingleInstanceListeners(arguments);
+                    } catch (Exception exception) {
+                        // not much to do here...
+                        exception.printStackTrace();
+                    }
+
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            } finally {
+                if (listeningSocket != null) {
+                    try {
+                        listeningSocket.close();
+                    } catch (IOException e) {
+                        // Give up.
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Create a new XSingleInstanceService
+     */
+    protected XSingleInstanceService() {
+    }
+
+    /**
+     * Initialize the new SingleInstanceService
+     * 
+     * @throws InstanceAlreadyExistsException if the instance already exists
+     */
+    public void initializeSingleInstance() {
+        if (!initialized) {
+            // this is called after the application has started. so safe to use
+            // JNLPRuntime.getApplication()
+            checkSingleInstanceRunning(JNLPRuntime.getApplication().getJNLPFile());
+            initialized = true;
+            SingleInstanceLock lockFile;
+            JNLPFile jnlpFile = JNLPRuntime.getApplication().getJNLPFile();
+            lockFile = new SingleInstanceLock(jnlpFile);
+            if (!lockFile.isValid()) {
+                startListeningServer(lockFile);
+            }
+        }
+
+    }
+
+    /**
+     * Check if another instance of this application is already running
+     * 
+     * @param jnlpFile The {@link JNLPFile} that specifies the application
+     * 
+     * @throws InstanceExistsException if an instance of this application
+     *         already exists
+     */
+    public void checkSingleInstanceRunning(JNLPFile jnlpFile) {
+        SingleInstanceLock lockFile = new SingleInstanceLock(jnlpFile);
+        if (lockFile.isValid()) {
+            int port = lockFile.getPort();
+            if (JNLPRuntime.isDebug()) {
+                System.out.println("Lock file is valid (port=" + port + "). Exiting.");
+            }
+            try {
+                sendProgramArgumentsToExistingApplication(port, jnlpFile.getApplication()
+                        .getArguments());
+                throw new InstanceExistsException(String.valueOf(port));
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    /**
+     * Start the listening server to accept arguments from new isntances of
+     * applications
+     * 
+     * @param lockFile
+     */
+    private void startListeningServer(SingleInstanceLock lockFile) {
+        SingleInstanceServer server = new SingleInstanceServer(lockFile);
+        new Thread(server).start();
+    }
+
+    /**
+     * Send the arguments for this application to the main instance
+     * 
+     * @param port the port at which the SingleInstanceServer is listening at
+     * @param arguments the new arguments
+     * @throws IOException on any io exception
+     */
+    private void sendProgramArgumentsToExistingApplication(int port, String[] arguments)
+            throws IOException {
+        try {
+            Socket serverCommunicationSocket = new Socket((String) null, port);
+            ObjectOutputStream argumentStream = new ObjectOutputStream(serverCommunicationSocket
+                    .getOutputStream());
+            argumentStream.writeObject(arguments);
+            argumentStream.close();
+            serverCommunicationSocket.close();
+
+        } catch (UnknownHostException unknownHost) {
+            if (JNLPRuntime.isDebug()) {
+                System.out.println("Unable to find localhost");
+            }
+            throw new RuntimeException(unknownHost);
+        }
+    }
+
+    /**
+     * Notify any SingleInstanceListener with new arguments
+     * 
+     * @param arguments the new arguments to the application
+     */
+    private void notifySingleInstanceListeners(String[] arguments) {
+        for (SingleInstanceListener listener : listeners) {
+            // TODO this proxy is privileged. should i worry about security in
+            // methods being called?
+            listener.newActivation(arguments);
+        }
+    }
+
+    /**
+     * Add the specified SingleInstanceListener
+     * 
+     * @throws InstanceExistsException, which is likely to terminate the
+     *         application but not guaranteed to
+     */
+    public void addSingleInstanceListener(SingleInstanceListener sil) {
+        initializeSingleInstance();
+
+        if (sil == null) {
+            return;
+        }
+
+        listeners.add(sil);
+    }
+
+    /**
+     * Remove the specified SingleInstanceListener
+     * 
+     * @throws InstanceExistsException if an instance of this single instance
+     *         application already exists
+     * 
+     */
+    public void removeSingleInstanceListener(SingleInstanceListener sil) {
+        initializeSingleInstance();
+
+        if (sil == null) {
+            return;
+        }
+
+        listeners.remove(sil);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/package.html	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,545 @@
+/*
+ * 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;
+        JarFile jarFile = null;
+
+        // certs could be uninitialized if one calls this method directly
+        if (certs == null)
+            certs = new ArrayList<CertPath>();
+        
+        try {
+            jarFile = new JarFile(jarName, true);
+            Vector<JarEntry> entriesVec = new Vector<JarEntry>();
+            byte[] buffer = new byte[8192];
+
+            JarEntry je;
+            Enumeration<JarEntry> entries = jarFile.entries();
+            while (entries.hasMoreElements()) {
+                je = entries.nextElement();
+                entriesVec.addElement(je);
+
+                InputStream is = jarFile.getInputStream(je);
+                try {
+                    int n;
+                    while ((n = is.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();
+                    }
+                }
+            }
+
+            if (jarFile.getManifest() != 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 (jarFile != null) {
+                jarFile.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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,461 @@
+/*
+ * 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: " + SecurityUtil.getCN(((X509Certificate)usercerts
+				.getCertificate(alias)).getSubjectX500Principal().getName()));
+			out.println("Certificate fingerprint (MD5): "
+					+ getCertFingerPrint("MD5", cert));
+			out.println();
+		}
+	}
+
+    /**
+     * 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/FileUtils.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,48 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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;
+
+/**
+ * This class contains a few file-related utility functions. 
+ * 
+ * @author Omair Majid
+ */
+
+public class FileUtils {
+
+    
+    /**
+     * Given an input, return a sanitized form of the input suitable for use as
+     * a file/directory name
+     * 
+     * @param input
+     * @return a sanitized version of the input
+     */
+    public static String sanitizeFileName(String input) {
+
+        /*
+         * FIXME
+         * 
+         * Assuming safe characters are 'a-z','A-Z','0-9', '_', '.'
+         */
+
+        String sanitizedName = input.replaceAll("[^a-zA-Z0-9.]", "_");
+        return sanitizedName;
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/util/PropertiesFile.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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/jnlp/util/XDesktopEntry.java	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,213 @@
+// Copyright (C) 2009 Red Hat, Inc.
+// 
+// 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.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+import net.sourceforge.jnlp.IconDesc;
+import net.sourceforge.jnlp.JNLPFile;
+import net.sourceforge.jnlp.StreamEater;
+import net.sourceforge.jnlp.cache.CacheUtil;
+import net.sourceforge.jnlp.cache.UpdatePolicy;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
+
+/**
+ * This class builds a (freedesktop.org) desktop entry out of a {@link JNLPFile}
+ * . This entry can be used to install desktop shortcuts. See xdg-desktop-icon
+ * (1) and http://standards.freedesktop.org/desktop-entry-spec/latest/ for more
+ * information
+ * 
+ * @author Omair Majid
+ * 
+ */
+public class XDesktopEntry {
+
+    public static final String JAVA_ICON_NAME = "java.png";
+    
+    private JNLPFile file = null;
+    private int iconSize = -1;
+    private String iconLocation = null;
+
+    private int[] VALID_ICON_SIZES = new int[] { 16, 22, 32, 48, 64, 128 };
+
+    /**
+     * Create a XDesktopEntry for the given JNLP file
+     * 
+     * @param file a {@link JNLPFile} that indicates the application to launch
+     */
+    public XDesktopEntry(JNLPFile file) {
+        this.file = file;
+
+        /* looks like a good initial value */
+        iconSize = VALID_ICON_SIZES[2];
+    }
+
+    /**
+     * Returns the contents of the {@link XDesktopEntry} through the
+     * {@link Reader} interface.
+     */
+    public Reader getContentsAsReader() {
+
+        String pathToJavaws = System.getProperty("java.home") + File.separator + "bin"
+                + File.separator + "javaws";
+        File cacheFile = CacheUtil.urlToPath(file.getSourceLocation(), "cache");
+
+        String fileContents = "[Desktop Entry]\n";
+        fileContents += "Version=1.0\n";
+        fileContents += "Name=" + file.getTitle() + "\n";
+        fileContents += "GenericName=Java Web Start Application\n";
+        fileContents += "Comment=" + file.getInformation().getDescription() + "\n";
+        fileContents += "Type=Application\n";
+        if (iconLocation != null) {
+            fileContents += "Icon=" + iconLocation + "\n";
+        } else {
+            fileContents += "Icon=" + JAVA_ICON_NAME + "\n";
+            
+        }
+        if (file.getInformation().getVendor() != null) {
+            fileContents += "Vendor=" + file.getInformation().getVendor() + "\n";
+        }
+        
+        //Shortcut executes the jnlp from cache and system preferred java..
+        fileContents += "Exec=" + "javaws" + " \"" + cacheFile.getAbsolutePath() + "\"\n";
+
+        return new StringReader(fileContents);
+
+    }
+
+    /**
+     * Get the size of the icon (in pixels) for the desktop shortcut
+     */
+    public int getIconSize() {
+        return iconSize;
+    }
+
+    /**
+     * Set the icon size to use for the desktop shortcut
+     * 
+     * @param size the size (in pixels) of the icon to use. Commonly used sizes
+     *        are of 16, 22, 32, 48, 64 and 128
+     */
+    public void setIconSize(int size) {
+        iconSize = size;
+    }
+
+    /**
+     * Create a desktop shortcut for this desktop entry
+     */
+    public void createDesktopShortcut() {
+        try {
+            cacheIcon();
+            installDesktopLauncher();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Install this XDesktopEntry into the user's desktop as a launcher
+     */
+    private void installDesktopLauncher() {
+        File shortcutFile = new File(JNLPRuntime.TMP_DIR + File.separator
+                + FileUtils.sanitizeFileName(file.getTitle()) + ".desktop");
+        try {
+
+            /*
+             * Write out a Java String (UTF-16) as a UTF-8 file
+             */
+
+            OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(shortcutFile),
+                    Charset.forName("UTF-8"));
+            Reader reader = getContentsAsReader();
+
+            char[] buffer = new char[1024];
+            int ret = 0;
+            while (-1 != (ret = reader.read(buffer))) {
+                writer.write(buffer, 0, ret);
+            }
+
+            reader.close();
+            writer.close();
+
+            /*
+             * Install the desktop entry
+             */
+
+            String[] execString = new String[] { "xdg-desktop-icon", "install", "--novendor",
+                    shortcutFile.getCanonicalPath() };
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Execing: " + Arrays.toString(execString));
+            }
+            Process installer = Runtime.getRuntime().exec(execString);
+            new StreamEater(installer.getInputStream()).start();
+            new StreamEater(installer.getErrorStream()).start();
+
+            try {
+                installer.waitFor();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            if (!shortcutFile.delete()) {
+                throw new IOException("Unable to delete temporary file:" + shortcutFile);
+            }
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Cache the icon for the desktop entry
+     */
+    private void cacheIcon() {
+
+        URL iconLocation = file.getInformation().getIconLocation(IconDesc.SHORTCUT, iconSize,
+                iconSize);
+
+        if (iconLocation == null) {
+            iconLocation = file.getInformation().getIconLocation(IconDesc.DEFAULT, iconSize,
+                    iconSize);
+        }
+
+        if (iconLocation != null) {
+            String location = CacheUtil.getCachedResource(iconLocation, null, UpdatePolicy.SESSION)
+                    .toString();
+            if (!location.startsWith("file:")) {
+                throw new RuntimeException("Unable to cache icon");
+            }
+
+            this.iconLocation = location.substring("file:".length());
+
+            if (JNLPRuntime.isDebug()) {
+                System.err.println("Cached desktop shortcut icon: " + this.iconLocation);
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/nanoxml/XMLElement.java	Mon Mar 29 02:54:20 2010 +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	Mon Mar 29 02:54:20 2010 +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;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/ecj/getannotation-cast.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,24 @@
+diff -urN openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java
+--- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java	2008-08-28 04:12:12.000000000 -0400
++++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java	2008-11-05 17:18:36.000000000 -0500
+@@ -1154,7 +1154,7 @@
+             Set<BitSet> getterIndexSets = newSet();
+             for (Constructor<?> constr : annotatedConstrList) {
+                 String[] propertyNames =
+-                    constr.getAnnotation(propertyNamesClass).value();
++		    ((ConstructorProperties)constr.getAnnotation(propertyNamesClass)).value();
+ 
+                 Type[] paramTypes = constr.getGenericParameterTypes();
+                 if (paramTypes.length != propertyNames.length) {
+diff -urN openjdk.orig/jdk/src/share/classes/java/beans/MetaData.java openjdk/jdk/src/share/classes/java/beans/MetaData.java
+--- openjdk.orig/jdk/src/share/classes/java/beans/MetaData.java	2008-08-28 04:12:48.000000000 -0400
++++ openjdk/jdk/src/share/classes/java/beans/MetaData.java	2008-11-05 17:18:36.000000000 -0500
+@@ -1628,7 +1628,7 @@
+     }
+ 
+     private static String[] getAnnotationValue(Constructor<?> constructor) {
+-        ConstructorProperties annotation = constructor.getAnnotation(ConstructorProperties.class);
++        ConstructorProperties annotation = ((ConstructorProperties) constructor.getAnnotation(ConstructorProperties.class));
+         return (annotation != null)
+                 ? annotation.value()
+                 : null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/ecj/override.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,209 @@
+diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
+--- openjdk-ecj.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	2009-12-15 00:04:14.000000000 +0000
++++ openjdk-ecj/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	2009-12-15 00:09:04.000000000 +0000
+@@ -200,7 +200,6 @@
+         super.uninstallListeners();
+     }
+ 
+-    @Override
+     public SynthContext getContext(JComponent c) {
+         return getContext(c, getComponentState(c));
+     }
+@@ -273,7 +272,6 @@
+     // end UI Initialization
+     //======================
+ 
+-    @Override
+     public void propertyChange(PropertyChangeEvent e) {
+         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
+             updateStyle(comboBox);
+@@ -318,7 +316,6 @@
+         }
+     }
+ 
+-    @Override
+     public void paintBorder(SynthContext context, Graphics g, int x,
+                             int y, int w, int h) {
+         context.getPainter().paintComboBoxBorder(context, g, x, y, w, h);
+@@ -424,7 +421,6 @@
+             setText(" ");
+         }
+ 
+-        @Override
+         public Component getListCellRendererComponent(JList list, Object value,
+                          int index, boolean isSelected, boolean cellHasFocus) {
+             setName("ComboBox.listRenderer");
+@@ -491,7 +487,6 @@
+             editor.setName("ComboBox.textField");
+         }
+ 
+-        @Override
+         public Component getEditorComponent() {
+             return editor;
+         }
+@@ -501,7 +496,6 @@
+          *
+          * @param anObject the displayed value of the editor
+          */
+-        @Override
+         public void setItem(Object anObject) {
+             String text;
+ 
+@@ -517,7 +511,6 @@
+             }
+         }
+ 
+-        @Override
+         public Object getItem() {
+             Object newValue = editor.getText();
+ 
+@@ -540,18 +533,15 @@
+             return newValue;
+         }
+ 
+-        @Override
+         public void selectAll() {
+             editor.selectAll();
+             editor.requestFocus();
+         }
+ 
+-        @Override
+         public void addActionListener(ActionListener l) {
+             editor.addActionListener(l);
+         }
+ 
+-        @Override
+         public void removeActionListener(ActionListener l) {
+             editor.removeActionListener(l);
+         }
+@@ -685,27 +675,22 @@
+         // MouseListener/MouseMotionListener Methods
+         //------------------------------------------------------------------
+ 
+-        @Override
+         public void mouseEntered(MouseEvent mouseEvent) {
+             updateOver(true);
+         }
+ 
+-        @Override
+         public void mouseExited(MouseEvent mouseEvent) {
+             updateOver(false);
+         }
+ 
+-        @Override
+         public void mousePressed(MouseEvent mouseEvent) {
+             updatePressed(true);
+         }
+ 
+-        @Override
+         public void mouseReleased(MouseEvent mouseEvent) {
+             updatePressed(false);
+         }
+ 
+-        @Override
+         public void mouseClicked(MouseEvent e) {}
+ 
+         //------------------------------------------------------------------
+@@ -722,16 +707,13 @@
+          * This bug was only noticed when acting as a button, but may be generally
+          * present. If so, remove the if() block
+          */
+-        @Override
+         public void popupMenuCanceled(PopupMenuEvent e) {
+             if (shouldActLikeButton() || pressedWhenPopupVisible) {
+                 comboBox.repaint();
+             }
+         }
+ 
+-        @Override
+         public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
+-        @Override
+         public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
+     }
+ 
+diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
+--- openjdk-ecj.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	2009-12-09 16:38:59.000000000 +0000
++++ openjdk-ecj/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	2009-12-09 16:38:39.000000000 +0000
+@@ -832,7 +832,6 @@
+             tk.addPropertyChangeListener(key, this);
+         }
+ 
+-        @Override
+         public void propertyChange(PropertyChangeEvent pce) {
+             UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+             if (defaults.getBoolean("Synth.doNotSetTextAA")) {
+@@ -901,7 +900,6 @@
+             if (!isUpdatePending()) {
+                 setUpdatePending(true);
+                 Runnable uiUpdater = new Runnable() {
+-                    @Override
+                     public void run() {
+                         updateAllUIs();
+                         setUpdatePending(false);
+@@ -918,7 +916,6 @@
+     }
+ 
+     private class Handler implements PropertyChangeListener {
+-        @Override
+         public void propertyChange(PropertyChangeEvent evt) {
+             String propertyName = evt.getPropertyName();
+             Object newValue = evt.getNewValue();
+diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
+--- openjdk-ecj.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	2009-12-15 00:31:41.000000000 +0000
++++ openjdk-ecj/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	2009-12-15 00:32:03.000000000 +0000
+@@ -154,7 +154,6 @@
+         tree.addPropertyChangeListener(this);
+     }
+ 
+-    @Override
+     public SynthContext getContext(JComponent c) {
+         return getContext(c, getComponentState(c));
+     }
+diff -Nru openjdk.orig/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java openjdk/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
+--- openjdk-ecj.orig/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	2009-12-15 00:44:58.000000000 +0000
++++ openjdk-ecj/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	2009-12-15 00:45:15.000000000 +0000
+@@ -701,7 +701,6 @@
+             this.delegate = delegate;
+         }
+ 
+-        @Override
+         public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+             Component c = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ 
+diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java
+--- openjdk-ecj.orig/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	2010-01-16 03:11:22.000000000 +0000
++++ openjdk-ecj/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	2010-01-16 03:11:57.000000000 +0000
+@@ -572,7 +572,7 @@
+         /*
+          * Return the certificate's revocation status code
+          */
+-        @Override public CertStatus getCertStatus() {
++        public CertStatus getCertStatus() {
+             return certStatus;
+         }
+ 
+@@ -580,11 +580,11 @@
+             return certId;
+         }
+ 
+-        @Override public Date getRevocationTime() {
++        public Date getRevocationTime() {
+             return (Date) revocationTime.clone();
+         }
+ 
+-        @Override public Reason getRevocationReason() {
++        public Reason getRevocationReason() {
+             return revocationReason;
+         }
+ 
+diff -r 697e3f8cac33 src/share/classes/sun/net/www/protocol/https/HttpsClient.java
+--- openjdk.orig/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Mar 24 17:05:49 2010 +0000
++++ openjdk/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Sun Mar 28 12:55:34 2010 +0100
+@@ -624,7 +624,6 @@
+      * a given connection may change.  When sessions change, so may
+      * peer identities and cipher suites.
+      */
+-    @Override
+     public void handshakeCompleted(HandshakeCompletedEvent event)
+     {
+         session = event.getSession();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/extensions/liveconnect-dist.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,76 @@
+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-11-11 02:53:36.000000000 +0000
+@@ -0,0 +1,28 @@
++#
++# 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 \
++     sun/applet
++
++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-11-11 02:52:44.000000000 +0000
++++ openjdk/jdk/make/common/internal/ImportComponents.gmk	2009-11-11 02:57:32.000000000 +0000
+@@ -49,6 +49,9 @@
+ 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))
+@@ -123,6 +126,7 @@
+ $(call import-one-sources,JAXP_DIST,$1)
+ $(call import-one-sources,JAXWS_DIST,$1)
+ $(call import-one-sources,NETX_DIST,$1)
++$(call import-one-sources,LIVECONNECT_DIST,$1)
+ endef
+ 
+ # Import all component docs into directory $1 (optional)
+@@ -162,6 +166,7 @@
+ $(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-11-11 02:52:44.000000000 +0000
++++ openjdk/jdk/make/common/shared/Defs.gmk	2009-11-11 02:13:22.000000000 +0000
+@@ -365,6 +365,11 @@
+ 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/extensions/liveconnect.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,87 @@
+diff -Nru openjdk.orig/jdk/make/docs/NON_CORE_PKGS.gmk openjdk/jdk/make/docs/NON_CORE_PKGS.gmk
+--- openjdk.orig/jdk/make/docs/NON_CORE_PKGS.gmk	2010-03-15 19:46:02.000000000 +0000
++++ openjdk/jdk/make/docs/NON_CORE_PKGS.gmk	2010-03-15 20:19:29.000000000 +0000
+@@ -86,6 +86,8 @@
+ 
+ JNLP_PKGS        = javax.jnlp
+ 
++JAVASCRIPT_PKGS  = netscape.javascript
++
+ # non-core packages in rt.jar
+ NON_CORE_PKGS    = $(DOMAPI_PKGS) \
+                    $(MGMT_PKGS) \
+@@ -94,4 +96,5 @@
+                    $(OLD_JSSE_PKGS) \
+                    $(HTTPSERVER_PKGS) \
+                    $(SMARTCARDIO_PKGS) \
+-                   $(JNLP_PKGS)
++                   $(JNLP_PKGS) \
++                   $(JAVASCRIPT_PKGS)
+diff -Nru openjdk.orig/jdk/make/sun/Makefile openjdk/jdk/make/sun/Makefile
+--- openjdk.orig/jdk/make/sun/Makefile	2010-02-17 03:14:13.000000000 +0000
++++ openjdk/jdk/make/sun/Makefile	2010-03-15 20:18:31.000000000 +0000
+@@ -66,6 +66,7 @@
+           $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
+ 	  font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
+ 	  jawt text nio launcher management $(ORG_SUBDIR) \
++	  plugin \
+           native2ascii serialver tools jconsole
+ 
+ all build clean clobber::
+diff -Nru openjdk.orig/jdk/make/sun/plugin/Makefile openjdk/jdk/make/sun/plugin/Makefile
+--- openjdk.orig/jdk/make/sun/plugin/Makefile	1970-01-01 01:00:00.000000000 +0100
++++ openjdk/jdk/make/sun/plugin/Makefile	2010-03-15 20:18:31.000000000 +0000
+@@ -0,0 +1,53 @@
++#
++# 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.
++#
++
++#
++# Makefile for pluginappletviewer wrapper.
++#
++
++BUILDDIR = ../..
++PACKAGE = sun.applet
++PRODUCT = sun
++PROGRAM = pluginappletviewer
++include $(BUILDDIR)/common/Defs.gmk
++
++#
++# Files to compile.
++#
++AUTO_FILES_JAVA_DIRS = sun/applet
++
++ifneq ($(PLATFORM), windows)
++  #
++  # Anything with a GUI needs X11 to be linked in.
++  #
++  OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 
++endif # PLATFORM
++
++#
++# Rules
++#
++JAVA_ARGS = { "sun.applet.PluginMain" }
++include $(BUILDDIR)/common/Program.gmk
++
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/extensions/netx-dist.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,86 @@
+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 09:18:45.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-29 02:09:27.000000000 +0100
++++ openjdk/jdk/make/common/internal/ImportComponents.gmk	2009-05-29 02:10:56.000000000 +0100
+@@ -46,6 +46,9 @@
+ ifndef JAXWS_DIST
+   include $(BUILDDIR)/common/internal/Defs-jaxws.gmk
+ endif
++ifndef NETX_DIST
++  include $(BUILDDIR)/common/internal/Defs-netx.gmk
++endif
+ 
+ # Clean up these lists so empty lists are empty
+ IMPORT_TOOLS_PACKAGES := $(strip $(IMPORT_TOOLS_PACKAGES))
+@@ -119,6 +122,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 +161,7 @@
+ $(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)
+ 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-29 02:09:27.000000000 +0100
++++ openjdk/jdk/make/common/shared/Defs.gmk	2009-05-29 02:11:18.000000000 +0100
+@@ -344,6 +344,11 @@
+ else
+   JAXWS_DIST =
+ endif
++ifdef ALT_NETX_DIST
++  NETX_DIST := $(call FullPath,$(ALT_NETX_DIST))
++else
++  NETX_DIST =
++endif
+ 
+ # HOTSPOT_DOCS_IMPORT_PATH: Path to hotspot docs files to import into the docs generation
+ ifdef ALT_HOTSPOT_DOCS_IMPORT_PATH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/extensions/netx-umask.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,164 @@
+--- openjdk/jdk/make/launchers/Makefile.launcher.orig	2008-07-09 12:49:00.000000000 -0400
++++ openjdk/jdk/make/launchers/Makefile.launcher	2008-07-09 12:49:40.000000000 -0400
+@@ -148,6 +148,16 @@
+   endif
+ endif
+ 
++# pluginappletviewer only
++ifeq ($(PROGRAM), pluginappletviewer)
++  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
++endif
++
++# javaws only
++ifeq ($(PROGRAM), javaws)
++  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
++endif
++
+ # GUI tools
+ ifeq ($(GUI_TOOL),true)
+   ifneq ($(PLATFORM), windows)
+--- openjdk/jdk/src/share/bin/java.c.orig	2008-07-09 12:48:35.000000000 -0400
++++ openjdk/jdk/src/share/bin/java.c	2008-07-09 12:36:11.000000000 -0400
+@@ -56,6 +56,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/stat.h>
+ 
+ #include <jni.h>
+ #include <jvm.h>
+@@ -69,6 +70,8 @@
+ #define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
+ #endif
+ 
++#define MAXMASK 4095 /* Same as octal 07777 */
++
+ /*
+  * The following environment variable is used to influence the behavior
+  * of the jre exec'd through the SelectVersion routine.  The command line
+@@ -184,6 +187,10 @@
+ 
+ int JNICALL JavaMain(void * args); /* entry point                  */
+ 
++/* umask things */
++static int FindUMask(int *, char ***, int *);
++static int VerifyMask(char *, int*);
++
+ struct JavaMainArgs {
+   int     argc;
+   char ** argv;
+@@ -307,6 +314,26 @@
+     SetClassPath(s);
+ #endif
+ 
++#ifdef USE_UMASK
++	/* Set umask */
++	int mask;
++    // Check to see if we can find a umask on the command line.
++    if (FindUMask(&argc, &argv, &mask) < 0)
++    {
++        // We didn't find a umask, so fall back to the default one.
++        char * defaultMask = (char *) JLI_MemAlloc(5 * sizeof(char));
++        strcpy(defaultMask, USE_UMASK);
++        int converted;
++        VerifyMask(defaultMask, &converted);
++        JLI_MemFree(defaultMask);
++		umask(converted); /* from sys/stat.h */
++    }
++    else
++    {
++		umask(mask);
++    }
++#endif
++
+     /*
+      *  Parse command line options; if the return value of
+      *  ParseArguments is false, the program should exit.
+@@ -2011,3 +2038,87 @@
+     }
+     DoSplashSetFileJarName(file_name, jar_name);
+ }
++
++/**
++ * Searches argv to find any parameters that start with "-umask=".
++ * Sets maskToSet with the mask if a -umask is found, and if the mask
++ * supplied is valid. Returns 1 if a valid mask was found and set,
++ * -1 otherwise.
++ */
++int FindUMask(int *pargc, char *** pargv, int *maskToSet)
++{
++    int found_mask = -1;
++
++    // our handles to the original list
++    int argc = *pargc;
++    char **argv = *pargv;
++
++    // the new set
++    int nargc = argc;
++    char ** nargv = (char **) JLI_MemAlloc((nargc + 1) * sizeof(char *));
++
++    // set the original set to the new set
++    *pargv = nargv;
++    *pargc = nargc;
++
++    char *maskString = (char *) JLI_MemAlloc(6 * sizeof(char *));
++	int i;
++    for (i = 0; i < argc; i++)
++    {
++        char *arg = argv[i];
++        if (strncmp(arg, "-umask=",7) == 0)
++        {
++            strncpy(maskString, arg+7, 5);
++
++            if (VerifyMask(maskString, maskToSet) < 0)
++            {
++                printf("Invalid umask %s, application stopped.\n", maskString);
++                exit(1);
++            }
++
++            found_mask = 1;
++            nargc--;
++            (*pargc)--;
++        }
++        else
++        {
++            *nargv++ = arg;
++        }
++    }
++
++    JLI_MemFree(maskString);
++
++    return found_mask;
++}
++
++/**
++ * Takes an octal mask in string form, and converts it to
++ * decimal form in convertedMask. The decimal form can then be
++ * easily passed to umask(). Returns 1 if the mask is valid, -1 otherwise.
++ */
++int VerifyMask(char * maskString, int * convertedMask)
++{
++    // Borrowed from coreutils modechange.c
++    if ('0' <= *maskString && *maskString < '8')
++    {
++        unsigned int decimal_mode = 0;
++
++        do {
++            decimal_mode = 8 * decimal_mode + *maskString++ - '0';
++        } while ('0' <= *maskString && *maskString < '8');
++
++        if (decimal_mode > MAXMASK)
++            return -1;
++        else if (*maskString)
++            return -1;
++        else
++            *convertedMask = decimal_mode;
++
++        return 1;
++    }
++    else
++    {
++        return -1;
++    }
++
++}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/extensions/netx.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,137 @@
+diff -c openjdk.orig/jdk/make/launchers/Makefile openjdk/jdk/make/launchers/Makefile
+--- openjdk.orig/jdk/make/launchers/Makefile	2008-06-29 09:45:56.000000000 -0400
++++ openjdk/jdk/make/launchers/Makefile	2008-06-29 09:47:01.000000000 -0400
+@@ -67,6 +67,7 @@
+ $(call make-launcher, javadoc, com.sun.tools.javadoc.Main, , )
+ $(call make-launcher, javah, com.sun.tools.javah.Main, , )
+ $(call make-launcher, javap, sun.tools.javap.Main, , )
++$(call make-launcher, javaws, net.sourceforge.jnlp.runtime.Boot, , )
+ $(call make-launcher, jconsole, sun.tools.jconsole.JConsole, \
+   -J-Djconsole.showOutputViewer, )
+ $(call make-launcher, jdb, com.sun.tools.example.debug.tty.TTY, , )
+diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java
+--- openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2008-01-12 15:53:45.000000000 -0500
++++ openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2008-02-04 11:51:20.000000000 -0500
+@@ -42,25 +42,25 @@
+  *
+  * @author      Arthur van Hoff
+  */
+-class AppletViewerPanel extends AppletPanel {
++public class AppletViewerPanel extends AppletPanel {
+ 
+     /* Are we debugging? */
+-    static boolean debug = false;
++    protected static boolean debug = false;
+ 
+     /**
+      * The document url.
+      */
+-    URL documentURL;
++    protected URL documentURL;
+ 
+     /**
+      * The base url.
+      */
+-    URL baseURL;
++    protected URL baseURL;
+ 
+     /**
+      * The attributes of the applet.
+      */
+-    Hashtable atts;
++    protected Hashtable atts;
+ 
+     /*
+      * JDK 1.1 serialVersionUID
+@@ -70,7 +70,7 @@
+     /**
+      * Construct an applet viewer and start the applet.
+      */
+-    AppletViewerPanel(URL documentURL, Hashtable atts) {
++    protected AppletViewerPanel(URL documentURL, Hashtable atts) {
+         this.documentURL = documentURL;
+         this.atts = atts;
+ 
+@@ -202,12 +202,12 @@
+         return (AppletContext)getParent();
+     }
+ 
+-    static void debug(String s) {
++    protected static void debug(String s) {
+         if(debug)
+             System.err.println("AppletViewerPanel:::" + s);
+     }
+ 
+-    static void debug(String s, Throwable t) {
++    protected static void debug(String s, Throwable t) {
+         if(debug) {
+             t.printStackTrace();
+             debug(s);
+diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/AppletPanel.java openjdk/jdk/src/share/classes/sun/applet/AppletPanel.java
+--- openjdk.orig/jdk/src/share/classes/sun/applet/AppletPanel.java	2008-03-26 04:58:12.000000000 -0400
++++ openjdk/jdk/src/share/classes/sun/applet/AppletPanel.java	2008-04-07 21:55:56.000000000 -0400
+@@ -68,7 +68,7 @@
+     /**
+      * The applet (if loaded).
+      */
+-    Applet applet;
++    protected Applet applet;
+ 
+     /**
+      * Applet will allow initialization.  Should be
+@@ -117,7 +117,7 @@
+     /**
+      * The thread for the applet.
+      */
+-    Thread handler;
++    protected Thread handler;
+ 
+ 
+     /**
+@@ -162,7 +162,8 @@
+      * Creates a thread to run the applet. This method is called
+      * each time an applet is loaded and reloaded.
+      */
+-    synchronized void createAppletThread() {
++	//Overridden by NetxPanel.
++    protected synchronized void createAppletThread() {
+         // Create a thread group for the applet, and start a new
+         // thread to load the applet.
+         String nm = "applet-" + getCode();
+@@ -306,7 +307,7 @@
+     /**
+      * Get an event from the queue.
+      */
+-    synchronized AppletEvent getNextEvent() throws InterruptedException {
++    protected synchronized AppletEvent getNextEvent() throws InterruptedException {
+         while (queue == null || queue.isEmpty()) {
+             wait();
+         }
+@@ -695,7 +696,8 @@
+      * applet event processing so that it can be gracefully interrupted from
+      * things like HotJava.
+      */
+-    private void runLoader() {
++	//Overridden by NetxPanel.
++    protected void runLoader() {
+         if (status != APPLET_DISPOSE) {
+             showAppletStatus("notdisposed");
+             return;
+--- openjdk/jdk/make/docs/NON_CORE_PKGS.gmk.orig	2009-06-04 11:02:18.000000000 -0400
++++ openjdk/jdk/make/docs/NON_CORE_PKGS.gmk	2009-06-04 11:02:45.000000000 -0400
+@@ -84,6 +84,8 @@
+ 
+ SMARTCARDIO_PKGS = javax.smartcardio
+ 
++JNLP_PKGS        = javax.jnlp
++
+ # non-core packages in rt.jar
+ NON_CORE_PKGS    = $(DOMAPI_PKGS) \
+                    $(MGMT_PKGS) \
+@@ -91,4 +93,5 @@
+                    $(JGSS_PKGS) \
+                    $(OLD_JSSE_PKGS) \
+                    $(HTTPSERVER_PKGS) \
+-                   $(SMARTCARDIO_PKGS)
++                   $(SMARTCARDIO_PKGS) \
++                   $(JNLP_PKGS)
--- a/patches/icedtea-copy-plugs.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-diff -urN openjdk.orig/jdk/make/common/internal/BinaryPlugs.gmk openjdk/jdk/make/common/internal/BinaryPlugs.gmk
---- openjdk.orig/jdk/make/common/internal/BinaryPlugs.gmk	2008-08-28 04:10:47.000000000 -0400
-+++ openjdk/jdk/make/common/internal/BinaryPlugs.gmk	2008-11-05 17:20:46.000000000 -0500
-@@ -49,33 +49,32 @@
- com/sun/jmx/snmp/SnmpDataTypeEnums.class \
- com/sun/jmx/snmp/SnmpDefinitions.class \
- com/sun/jmx/snmp/SnmpOid.class \
--com/sun/jmx/snmp/SnmpOidDatabase.class \
--com/sun/jmx/snmp/SnmpOidDatabaseSupport.class \
- com/sun/jmx/snmp/SnmpOidRecord.class \
- com/sun/jmx/snmp/SnmpOidTable.class \
- com/sun/jmx/snmp/SnmpOidTableSupport.class \
- com/sun/jmx/snmp/SnmpParameters.class \
- com/sun/jmx/snmp/SnmpPduPacket.class \
- com/sun/jmx/snmp/SnmpPeer.class \
-+rt/com/sun/jmx/snmp/SnmpSession.class \
- com/sun/jmx/snmp/SnmpTimeticks.class \
- com/sun/jmx/snmp/SnmpVarBind.class \
- com/sun/jmx/snmp/SnmpVarBindList.class \
--com/sun/jmx/snmp/Timestamp.class \
- com/sun/jmx/snmp/daemon/SendQ.class \
- com/sun/jmx/snmp/daemon/SnmpInformRequest.class \
--com/sun/jmx/snmp/daemon/SnmpQManager.class \
--com/sun/jmx/snmp/daemon/SnmpRequestCounter.class \
--com/sun/jmx/snmp/daemon/SnmpResponseHandler.class \
--com/sun/jmx/snmp/daemon/SnmpSendServer.class \
--com/sun/jmx/snmp/daemon/SnmpSession.class \
--com/sun/jmx/snmp/daemon/SnmpSocket.class \
--com/sun/jmx/snmp/daemon/SnmpTimerServer.class \
--com/sun/jmx/snmp/daemon/WaitQ.class
-+com/sun/jmx/snmp/daemon/SnmpSession.class
- 
- # Class list temp files (used by both import and export of plugs)
- 
-+PLUG_GNU_CLASS_NAMES = gnu
-+
-+PLUG_JAVAX_CLASS_NAMES = javax/jnlp
-+
-+PLUG_NETX_CLASS_NAMES = net
-+
-+PLUG_NETSCAPE_CLASS_NAMES = netscape
-+
- PLUG_TEMPDIR=$(ABS_TEMPDIR)/plugs
--PLUG_CLASS_AREAS = jmf
-+PLUG_CLASS_AREAS = jmf gnu javax netx netscape
- PLUG_CLISTS = $(PLUG_CLASS_AREAS:%=$(PLUG_TEMPDIR)/%.clist)
- 
- # Create jargs file command
-@@ -93,11 +92,39 @@
- 	@for i in $(PLUG_JMF_CLASS_NAMES) ; do \
- 	  $(ECHO) "$$i" >> $@; \
- 	done
-+$(PLUG_TEMPDIR)/gnu.clist:
-+	@$(prep-target)
-+	@for i in $(PLUG_GNU_CLASS_NAMES) ; do \
-+	  $(ECHO) "$$i" >> $@ ; \
-+	done
-+$(PLUG_TEMPDIR)/javax.clist:
-+	@$(prep-target)
-+	@for i in $(PLUG_JAVAX_CLASS_NAMES) ; do \
-+	  $(ECHO) "$$i" >> $@ ; \
-+	done
-+$(PLUG_TEMPDIR)/netx.clist:
-+	@$(prep-target)
-+	@for i in $(PLUG_NETX_CLASS_NAMES) ; do \
-+	  $(ECHO) "$$i" >> $@ ; \
-+	done
-+$(PLUG_TEMPDIR)/netscape.clist:
-+	@$(prep-target)
-+	@for i in $(PLUG_NETSCAPE_CLASS_NAMES) ; do \
-+	  $(ECHO) "$$i" >> $@ ; \
-+	done
- $(PLUG_TEMPDIR)/all.clist: $(PLUG_CLISTS)
- 	@$(prep-target)
- 	$(CAT) $(PLUG_CLISTS) > $@
- $(PLUG_TEMPDIR)/jmf.jargs: $(PLUG_TEMPDIR)/jmf.clist
- 	$(plug-create-jargs)
-+$(PLUG_TEMPDIR)/gnu.jargs: $(PLUG_TEMPDIR)/gnu.clist
-+	$(plug-create-jargs)
-+$(PLUG_TEMPDIR)/javax.jargs: $(PLUG_TEMPDIR)/javax.clist
-+	$(plug-create-jargs)
-+$(PLUG_TEMPDIR)/netx.jargs: $(PLUG_TEMPDIR)/netx.clist
-+	$(plug-create-jargs)
-+$(PLUG_TEMPDIR)/netscape.jargs: $(PLUG_TEMPDIR)/netscape.clist
-+	$(plug-create-jargs)
- $(PLUG_TEMPDIR)/all.jargs: $(PLUG_TEMPDIR)/all.clist
- 	$(plug-create-jargs)
- 
-@@ -125,9 +152,9 @@
- # Import classes command
- 
- define import-binary-plug-classes
--@$(MKDIR) -p $(CLASSDESTDIR)
-+$(MKDIR) -p $(CLASSDESTDIR)
- @$(CAT) $1 | $(SED) -e 's/^/PLUG IMPORT: /'
--($(CD) $(CLASSDESTDIR) && $(BOOT_JAR_CMD) xf $(PLUG_IMPORT_JARFILE) @$1)
-+($(CD) $(CLASSDESTDIR) && $(BOOT_JAR_CMD) xf $(PLUG_IMPORT_JARFILE) `$(CAT) $1`)
- endef # import-binary-plug-classes
- 
- else # IMPORT_BINARY_PLUGS
-@@ -153,11 +180,23 @@
- 
- import-binary-plug-jmf-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/jmf.clist
- 	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/jmf.clist)
-+import-binary-plug-gnu-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/gnu.clist
-+	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/gnu.clist)
-+import-binary-plug-javax-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/javax.clist
-+	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/javax.clist)
-+import-binary-plug-netx-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/netx.clist
-+	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/netx.clist)
-+import-binary-plug-netscape-classes: $(PLUG_IMPORT_JARFILE) $(PLUG_TEMPDIR)/netscape.clist
-+	$(call import-binary-plug-classes,$(PLUG_TEMPDIR)/netscape.clist)
- 
- # Import all classes from the jar file
- 
- import-binary-plug-jar: \
--	     import-binary-plug-jmf-classes
-+	     import-binary-plug-jmf-classes \
-+	     import-binary-plug-gnu-classes \
-+	     import-binary-plug-javax-classes \
-+	     import-binary-plug-netx-classes \
-+	     import-binary-plug-netscape-classes
- 
- # Binary plug start/complete messages
- 
-diff -urN openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java
---- openjdk.orig/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java	2008-08-28 04:12:12.000000000 -0400
-+++ openjdk/jdk/src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java	2008-11-05 17:18:36.000000000 -0500
-@@ -1154,7 +1154,7 @@
-             Set<BitSet> getterIndexSets = newSet();
-             for (Constructor<?> constr : annotatedConstrList) {
-                 String[] propertyNames =
--                    constr.getAnnotation(propertyNamesClass).value();
-+		    ((ConstructorProperties)constr.getAnnotation(propertyNamesClass)).value();
- 
-                 Type[] paramTypes = constr.getGenericParameterTypes();
-                 if (paramTypes.length != propertyNames.length) {
-diff -urN openjdk.orig/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java openjdk/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java
---- openjdk.orig/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java	2008-08-28 04:12:14.000000000 -0400
-+++ openjdk/jdk/src/share/classes/com/sun/jmx/snmp/SnmpPduTrap.java	2008-11-05 17:18:36.000000000 -0500
-@@ -78,6 +78,9 @@
-      */
-     public long            timeStamp ;
- 
-+    // TODO: IcedTea: I am a stub.
-+    static public int trapAuthenticationFailure = 0;
-+
- 
- 
-     /**
-diff -urN openjdk.orig/jdk/src/share/classes/java/beans/MetaData.java openjdk/jdk/src/share/classes/java/beans/MetaData.java
---- openjdk.orig/jdk/src/share/classes/java/beans/MetaData.java	2008-08-28 04:12:48.000000000 -0400
-+++ openjdk/jdk/src/share/classes/java/beans/MetaData.java	2008-11-05 17:18:36.000000000 -0500
-@@ -1628,7 +1628,7 @@
-     }
- 
-     private static String[] getAnnotationValue(Constructor<?> constructor) {
--        ConstructorProperties annotation = constructor.getAnnotation(ConstructorProperties.class);
-+        ConstructorProperties annotation = ((ConstructorProperties) constructor.getAnnotation(ConstructorProperties.class));
-         return (annotation != null)
-                 ? annotation.value()
-                 : null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-jtreg-httpTest.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -0,0 +1,37 @@
+--- /dev/null		2010-03-18 17:24:04.000000000 +0100
++++ openjdk/jdk/test/java/net/URL/TestHttps.java	2010-03-18 17:24:04.000000000 +0100
+@@ -0,0 +1,34 @@
++/*
++ * Copyright 2010 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.
++ *
++ * 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.
++ */
++
++
++/* @test
++ * @summary This test check if the cacerts keytool database is configured properly and SSL is really working. The test should not fail if SSL is working.
++ */
++
++import java.io.IOException;
++
++import java.net.URL;
++import java.net.URLConnection;
++
++public class TestHttps {
++    public static void main(String[] args) throws IOException {
++        new URL("https://www.verisign.com/").openConnection().connect();
++    }
++}
--- a/patches/icedtea-liveconnect.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-diff -urN openjdk.orig/jdk/make/sun/Makefile openjdk/jdk/make/sun/Makefile
---- openjdk.orig/jdk/make/sun/Makefile	2008-07-10 15:54:44.000000000 -0400
-+++ openjdk/jdk/make/sun/Makefile	2008-09-18 14:28:41.000000000 -0400
-@@ -66,6 +66,7 @@
-           $(HEADLESS_SUBDIR) $(DGA_SUBDIR) \
- 	  font jpeg cmm applet rmi beans $(JDBC_SUBDIR) \
- 	  jawt text nio launcher management $(ORG_SUBDIR) \
-+	  plugin \
-           native2ascii serialver tools jconsole
- 
- all build clean clobber::
-diff -urN openjdk.orig/jdk/make/sun/plugin/Makefile openjdk/jdk/make/sun/plugin/Makefile
---- openjdk.orig/jdk/make/sun/plugin/Makefile	1969-12-31 19:00:00.000000000 -0500
-+++ openjdk/jdk/make/sun/plugin/Makefile	2008-09-18 14:28:41.000000000 -0400
-@@ -0,0 +1,53 @@
-+#
-+# 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.
-+#
-+
-+#
-+# Makefile for pluginappletviewer wrapper.
-+#
-+
-+BUILDDIR = ../..
-+PACKAGE = sun.applet
-+PRODUCT = sun
-+PROGRAM = pluginappletviewer
-+include $(BUILDDIR)/common/Defs.gmk
-+
-+#
-+# Files to compile.
-+#
-+AUTO_FILES_JAVA_DIRS = sun/applet
-+
-+ifneq ($(PLATFORM), windows)
-+  #
-+  # Anything with a GUI needs X11 to be linked in.
-+  #
-+  OTHER_LDLIBS += -L$(OPENWIN_LIB) -lX11 
-+endif # PLATFORM
-+
-+#
-+# Rules
-+#
-+JAVA_ARGS = { "sun.applet.PluginMain" }
-+include $(BUILDDIR)/common/Program.gmk
-+
---- openjdk/jdk/make/docs/NON_CORE_PKGS.gmk.orig	2009-06-10 17:48:57.000000000 -0400
-+++ openjdk/jdk/make/docs/NON_CORE_PKGS.gmk	2009-06-10 17:49:59.000000000 -0400
-@@ -82,11 +82,14 @@
- TREEAPI_PKGS 	 = com.sun.source.tree \
- 		   com.sun.source.util
- 
-+JAVASCRIPT_PKGS  = netscape.javascript
-+
- SMARTCARDIO_PKGS = javax.smartcardio
- 
- # non-core packages in rt.jar
- NON_CORE_PKGS    = $(DOMAPI_PKGS) \
-                    $(MGMT_PKGS) \
-+                   $(JAVASCRIPT_PKGS) \
-                    $(JAAS_PKGS) \
-                    $(JGSS_PKGS) \
-                    $(OLD_JSSE_PKGS) \
--- a/patches/icedtea-override.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
---- openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	2009-12-15 00:04:14.000000000 +0000
-+++ openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	2009-12-15 00:09:04.000000000 +0000
-@@ -200,7 +200,6 @@
-         super.uninstallListeners();
-     }
- 
--    @Override
-     public SynthContext getContext(JComponent c) {
-         return getContext(c, getComponentState(c));
-     }
-@@ -273,7 +272,6 @@
-     // end UI Initialization
-     //======================
- 
--    @Override
-     public void propertyChange(PropertyChangeEvent e) {
-         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
-             updateStyle(comboBox);
-@@ -318,7 +316,6 @@
-         }
-     }
- 
--    @Override
-     public void paintBorder(SynthContext context, Graphics g, int x,
-                             int y, int w, int h) {
-         context.getPainter().paintComboBoxBorder(context, g, x, y, w, h);
-@@ -424,7 +421,6 @@
-             setText(" ");
-         }
- 
--        @Override
-         public Component getListCellRendererComponent(JList list, Object value,
-                          int index, boolean isSelected, boolean cellHasFocus) {
-             setName("ComboBox.listRenderer");
-@@ -491,7 +487,6 @@
-             editor.setName("ComboBox.textField");
-         }
- 
--        @Override
-         public Component getEditorComponent() {
-             return editor;
-         }
-@@ -501,7 +496,6 @@
-          *
-          * @param anObject the displayed value of the editor
-          */
--        @Override
-         public void setItem(Object anObject) {
-             String text;
- 
-@@ -517,7 +511,6 @@
-             }
-         }
- 
--        @Override
-         public Object getItem() {
-             Object newValue = editor.getText();
- 
-@@ -540,18 +533,15 @@
-             return newValue;
-         }
- 
--        @Override
-         public void selectAll() {
-             editor.selectAll();
-             editor.requestFocus();
-         }
- 
--        @Override
-         public void addActionListener(ActionListener l) {
-             editor.addActionListener(l);
-         }
- 
--        @Override
-         public void removeActionListener(ActionListener l) {
-             editor.removeActionListener(l);
-         }
-@@ -685,27 +675,22 @@
-         // MouseListener/MouseMotionListener Methods
-         //------------------------------------------------------------------
- 
--        @Override
-         public void mouseEntered(MouseEvent mouseEvent) {
-             updateOver(true);
-         }
- 
--        @Override
-         public void mouseExited(MouseEvent mouseEvent) {
-             updateOver(false);
-         }
- 
--        @Override
-         public void mousePressed(MouseEvent mouseEvent) {
-             updatePressed(true);
-         }
- 
--        @Override
-         public void mouseReleased(MouseEvent mouseEvent) {
-             updatePressed(false);
-         }
- 
--        @Override
-         public void mouseClicked(MouseEvent e) {}
- 
-         //------------------------------------------------------------------
-@@ -722,16 +707,13 @@
-          * This bug was only noticed when acting as a button, but may be generally
-          * present. If so, remove the if() block
-          */
--        @Override
-         public void popupMenuCanceled(PopupMenuEvent e) {
-             if (shouldActLikeButton() || pressedWhenPopupVisible) {
-                 comboBox.repaint();
-             }
-         }
- 
--        @Override
-         public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
--        @Override
-         public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
-     }
- 
-diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
---- openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	2009-12-09 16:38:59.000000000 +0000
-+++ openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	2009-12-09 16:38:39.000000000 +0000
-@@ -832,7 +832,6 @@
-             tk.addPropertyChangeListener(key, this);
-         }
- 
--        @Override
-         public void propertyChange(PropertyChangeEvent pce) {
-             UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-             if (defaults.getBoolean("Synth.doNotSetTextAA")) {
-@@ -901,7 +900,6 @@
-             if (!isUpdatePending()) {
-                 setUpdatePending(true);
-                 Runnable uiUpdater = new Runnable() {
--                    @Override
-                     public void run() {
-                         updateAllUIs();
-                         setUpdatePending(false);
-@@ -918,7 +916,6 @@
-     }
- 
-     private class Handler implements PropertyChangeListener {
--        @Override
-         public void propertyChange(PropertyChangeEvent evt) {
-             String propertyName = evt.getPropertyName();
-             Object newValue = evt.getNewValue();
-diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
---- openjdk.orig/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	2009-12-15 00:31:41.000000000 +0000
-+++ openjdk/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	2009-12-15 00:32:03.000000000 +0000
-@@ -154,7 +154,6 @@
-         tree.addPropertyChangeListener(this);
-     }
- 
--    @Override
-     public SynthContext getContext(JComponent c) {
-         return getContext(c, getComponentState(c));
-     }
-diff -Nru openjdk.orig/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java openjdk/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
---- openjdk.orig/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	2009-12-15 00:44:58.000000000 +0000
-+++ openjdk/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	2009-12-15 00:45:15.000000000 +0000
-@@ -701,7 +701,6 @@
-             this.delegate = delegate;
-         }
- 
--        @Override
-         public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
-             Component c = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
- 
-diff -Nru openjdk.orig/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java
---- openjdk.orig/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	2010-01-16 03:11:22.000000000 +0000
-+++ openjdk/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	2010-01-16 03:11:57.000000000 +0000
-@@ -572,7 +572,7 @@
-         /*
-          * Return the certificate's revocation status code
-          */
--        @Override public CertStatus getCertStatus() {
-+        public CertStatus getCertStatus() {
-             return certStatus;
-         }
- 
-@@ -580,11 +580,11 @@
-             return certId;
-         }
- 
--        @Override public Date getRevocationTime() {
-+        public Date getRevocationTime() {
-             return (Date) revocationTime.clone();
-         }
- 
--        @Override public Reason getRevocationReason() {
-+        public Reason getRevocationReason() {
-             return revocationReason;
-         }
- 
-diff -r 697e3f8cac33 src/share/classes/sun/net/www/protocol/https/HttpsClient.java
---- openjdk.orig/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Wed Mar 24 17:05:49 2010 +0000
-+++ openjdk/jdk/src/share/classes/sun/net/www/protocol/https/HttpsClient.java	Sun Mar 28 12:55:34 2010 +0100
-@@ -624,7 +624,6 @@
-      * a given connection may change.  When sessions change, so may
-      * peer identities and cipher suites.
-      */
--    @Override
-     public void handshakeCompleted(HandshakeCompletedEvent event)
-     {
-         session = event.getSession();
--- a/patches/icedtea-plugin.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1301 +0,0 @@
-diff -urN openjdk.orig/jdk/make/launchers/Makefile openjdk/jdk/make/launchers/Makefile
---- openjdk.orig/jdk/make/launchers/Makefile	2008-06-29 09:40:07.000000000 -0400
-+++ openjdk/jdk/make/launchers/Makefile	2008-06-29 09:40:16.000000000 -0400
-@@ -92,6 +92,7 @@
-   -J-Dcom.sun.CORBA.activation.Port=1049 \
-   -J-Dcom.sun.CORBA.POA.ORBServerId=1, )
- $(call make-launcher, pack200, com.sun.java.util.jar.pack.Driver, , --pack)
-+$(call make-launcher, pluginappletviewer, sun.applet.PluginMain, , )
- $(call make-launcher, policytool, sun.security.tools.PolicyTool, , )
- $(call make-launcher, rmic, sun.rmi.rmic.Main, , )
- $(call make-launcher, rmid, sun.rmi.server.Activation, , )
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/PluginMain.java openjdk/jdk/src/share/classes/sun/applet/PluginMain.java
---- openjdk.orig/jdk/src/share/classes/sun/applet/PluginMain.java	1969-12-31 19:00:00.000000000 -0500
-+++ openjdk/jdk/src/share/classes/sun/applet/PluginMain.java	2008-01-14 14:18:53.000000000 -0500
-@@ -0,0 +1,274 @@
-+/*
-+ * Copyright 1999-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 sun.applet;
-+
-+import java.io.*;
-+import java.lang.reflect.Method;
-+import java.lang.reflect.InvocationTargetException;
-+import java.net.*;
-+import java.nio.charset.Charset;
-+import java.util.*;
-+import sun.net.www.ParseUtil;
-+
-+class PluginParseRequest
-+{
-+  long handle;
-+  String tag;
-+  String documentbase;
-+  boolean alreadySent;
-+}
-+
-+/**
-+ * The main entry point into PluginAppletViewer.
-+ */
-+public class PluginMain
-+{
-+    // A mapping of instance IDs to PluginAppletViewers.
-+    private static HashMap appletWindows = new HashMap();
-+    private static HashMap parseRequests = new HashMap();
-+    private static String currentKey;
-+    private static PluginAppletViewer currentWindow;
-+    private static PluginParseRequest currentRequest;
-+    private static BufferedReader pluginInputStream;
-+    private static BufferedWriter pluginOutputStream;
-+    // This is used in init().	Getting rid of this is desirable but depends
-+    // on whether the property that uses it is necessary/standard.
-+    public static final String theVersion = System.getProperty("java.version");
-+
-+    /**
-+     * The main entry point into AppletViewer.
-+     */
-+    public static void main(String args[])
-+	throws IOException
-+    {
-+	if(args.length != 2) {
-+	    // Indicate to plugin that appletviewer is installed correctly.
-+	    System.exit(0);
-+	}
-+	// INSTALL THE SECURITY MANAGER
-+	init();
-+	start(new FileInputStream(args[0]), new FileOutputStream(args[1]));
-+	System.exit(0);
-+    }
-+
-+    private static void init() {
-+	Properties avProps = new Properties();
-+
-+	// ADD OTHER RANDOM PROPERTIES
-+	// XXX 5/18 need to revisit why these are here, is there some
-+	// standard for what is available?
-+
-+	// Standard browser properties
-+	avProps.put("browser", "sun.applet.AppletViewer");
-+	avProps.put("browser.version", "1.06");
-+	avProps.put("browser.vendor", "Sun Microsystems Inc.");
-+	avProps.put("http.agent", "Java(tm) 2 SDK, Standard Edition v" + theVersion);
-+
-+	// Define which packages can be extended by applets
-+	// XXX 5/19 probably not needed, not checked in AppletSecurity
-+	avProps.put("package.restrict.definition.java", "true");
-+	avProps.put("package.restrict.definition.sun", "true");
-+
-+	// Define which properties can be read by applets.
-+	// A property named by "key" can be read only when its twin
-+	// property "key.applet" is true.  The following ten properties
-+	// are open by default.	 Any other property can be explicitly
-+	// opened up by the browser user by calling appletviewer with
-+	// -J-Dkey.applet=true
-+	avProps.put("java.version.applet", "true");
-+	avProps.put("java.vendor.applet", "true");
-+	avProps.put("java.vendor.url.applet", "true");
-+	avProps.put("java.class.version.applet", "true");
-+	avProps.put("os.name.applet", "true");
-+	avProps.put("os.version.applet", "true");
-+	avProps.put("os.arch.applet", "true");
-+	avProps.put("file.separator.applet", "true");
-+	avProps.put("path.separator.applet", "true");
-+	avProps.put("line.separator.applet", "true");
-+
-+	// Read in the System properties.  If something is going to be
-+	// over-written, warn about it.
-+	Properties sysProps = System.getProperties();
-+	for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) {
-+	    String key = (String) e.nextElement();
-+	    String val = (String) sysProps.getProperty(key);
-+	    avProps.setProperty(key, val);
-+	}
-+
-+	// INSTALL THE PROPERTY LIST
-+	System.setProperties(avProps);
-+
-+	// Create and install the security manager
-+	System.setSecurityManager(new AppletSecurity());
-+
-+	// REMIND: Create and install a socket factory!
-+    }
-+
-+    static void registerWindow(PluginAppletViewer pluginappletviewer)
-+    {
-+	appletWindows.put(currentKey, pluginappletviewer);
-+	currentWindow = (PluginAppletViewer)appletWindows.get(currentKey);
-+    }
-+
-+    private static void deregisterWindow(PluginAppletViewer pluginappletviewer)
-+    {
-+	appletWindows.remove(currentWindow);
-+	currentWindow.dispose();
-+	currentWindow = null;
-+    }
-+
-+    static void start(InputStream inputstream, OutputStream outputstream)
-+	throws MalformedURLException, IOException
-+    {
-+	// Set up input and output pipes.  Use UTF-8 encoding.
-+	pluginInputStream =
-+	    new BufferedReader(new InputStreamReader(inputstream,
-+						     Charset.forName("UTF-8")));
-+	pluginOutputStream =
-+	    new BufferedWriter(new OutputStreamWriter
-+			       (outputstream, Charset.forName("UTF-8")));
-+
-+	write("running");
-+
-+	// Read first message.
-+	String message = read();
-+
-+	while(true) {
-+	    if (message.startsWith("instance")) {
-+		// Read applet instance identifier.
-+		currentKey = message.substring("instance".length() + 1);
-+		currentWindow =
-+		    (PluginAppletViewer)appletWindows.get(currentKey);
-+		currentRequest = null;
-+		if (currentWindow == null) {
-+		    if (!parseRequests.containsKey(currentKey))
-+			parseRequests.put(currentKey, new PluginParseRequest());
-+		    currentRequest =
-+			(PluginParseRequest)parseRequests.get(currentKey);
-+		}
-+	    } else if (message.startsWith("tag")) {
-+		if (currentRequest != null) {
-+		    int index = message.indexOf(' ', "tag".length() + 1);
-+		    currentRequest.documentbase =
-+			message.substring("tag".length() + 1, index);
-+		    currentRequest.tag = message.substring(index + 1);
-+		    if (currentRequest.handle != 0
-+			&& !currentRequest.alreadySent) {
-+			PluginAppletViewer.parse
-+			    (currentRequest.handle, 1, 1,
-+			     new StringReader(currentRequest.tag),
-+			     new URL(currentRequest.documentbase));
-+			parseRequests.remove(currentKey);
-+		    }
-+		}
-+	    } else if (message.startsWith("handle")) {
-+		if (currentRequest != null) {
-+		    currentRequest.handle = Long.parseLong
-+			(message.substring("handle".length() + 1, 
-+						message.indexOf("width") - 1));
-+		    int width = Integer.parseInt(message.substring
-+					(message.indexOf("width") + 
-+					"width".length() + 1, 
-+					message.indexOf("height") - 1));
-+		    int height = Integer.parseInt(message.substring(
-+					message.indexOf("height") + 
-+					"height".length() + 1));
-+		    if (currentRequest.tag != null
-+		       && !currentRequest.alreadySent) {
-+			PluginAppletViewer.parse
-+			    (currentRequest.handle, width, height,
-+			     new StringReader(currentRequest.tag),
-+			     new URL(currentRequest.documentbase));
-+			parseRequests.remove(currentKey);
-+		    }
-+		}
-+	    } else if (message.startsWith("width")) {
-+		int width =
-+		    Integer.parseInt(message.substring("width".length() + 1));
-+		int height = currentWindow.getHeight();
-+		currentWindow.updateAtts(width, height);
-+	 	currentWindow.setSize(width, height);
-+	    } else if (message.startsWith("height")) {
-+		int height =
-+		    Integer.parseInt(message.substring("height".length() + 1));
-+		int width = currentWindow.getWidth();
-+		currentWindow.updateAtts(width, height);
-+	        currentWindow.setSize(width, height);
-+	    } else if (message.startsWith("destroy")
-+		       && currentWindow != null) {
-+		deregisterWindow(currentWindow);
-+	    }
-+
-+	    // Read next message.
-+	    message = read();
-+	}
-+    }
-+
-+    /**
-+     * Write string to plugin.
-+     * 
-+     * @param message the message to write
-+     *
-+     * @exception IOException if an error occurs
-+     */
-+    static void write(String message)
-+	throws IOException
-+    {
-+	pluginOutputStream.write(message, 0, message.length());
-+	pluginOutputStream.newLine();
-+	pluginOutputStream.flush();
-+
-+	System.err.println("  PIPE: appletviewer wrote: " + message);
-+    }
-+
-+    /**
-+     * Read string from plugin.
-+     *
-+     * @return the read string
-+     *
-+     * @exception IOException if an error occurs
-+     */
-+    static String read()
-+	throws IOException
-+    {
-+	String message = pluginInputStream.readLine();
-+	System.err.println("  PIPE: appletviewer read: " + message);
-+	if (message == null || message.equals("shutdown")) {
-+	    try {
-+		// Close input/output channels to plugin.
-+		pluginInputStream.close();
-+		pluginOutputStream.close();
-+	    } catch (IOException exception) {
-+		// Deliberately ignore IOException caused by broken
-+		// pipe since plugin may have already detached.
-+	    }
-+
-+	    System.err.println("APPLETVIEWER: exiting appletviewer");
-+	    System.exit(0);
-+	}
-+	return message;
-+    }
-+}
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/PluginAppletViewer.java openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java
---- openjdk.orig/jdk/src/share/classes/sun/applet/PluginAppletViewer.java	2008-06-24 22:55:57.286013713 -0400
-+++ openjdk/jdk/src/share/classes/sun/applet/PluginAppletViewer.java	2008-06-29 10:34:07.000000000 -0400
-@@ -0,0 +1,1008 @@
-+/*
-+ * Copyright 1995-2004 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 sun.applet;
-+
-+import java.util.*;
-+import java.io.*;
-+import java.awt.*;
-+import java.awt.event.*;
-+import java.awt.print.*;
-+import javax.print.attribute.*;
-+import java.applet.*;
-+import java.net.URL;
-+import java.net.MalformedURLException;
-+import java.net.SocketPermission;
-+import sun.misc.Ref;
-+import java.security.AccessController;
-+import java.security.PrivilegedAction;
-+import java.lang.reflect.InvocationTargetException;
-+import java.lang.reflect.Method;
-+import sun.awt.SunToolkit;
-+import sun.awt.AppContext;
-+import sun.awt.X11.*;
-+import java.lang.ref.WeakReference;
-+import net.sourceforge.jnlp.NetxPanel;
-+
-+/**
-+ * Lets us construct one using unix-style one shot behaviors
-+ */
-+
-+class PluginAppletViewerFactory
-+{
-+    public PluginAppletViewer createAppletViewer(long handle, int x, int y,
-+						 URL doc, Hashtable atts) {
-+        PluginAppletViewer pluginappletviewer = new PluginAppletViewer(handle, x, y, doc, atts, System.out, this);
-+        PluginMain.registerWindow(pluginappletviewer);
-+        return pluginappletviewer;
-+    }
-+
-+    public boolean isStandalone()
-+    {
-+        return false;
-+    }
-+}
-+
-+/*
-+ */
-+public class PluginAppletViewer extends XEmbeddedFrame
-+    implements AppletContext, Printable {
-+    /**
-+     * Some constants...
-+     */
-+    private static String defaultSaveFile = "Applet.ser";
-+
-+    /**
-+     * The panel in which the applet is being displayed.
-+     */
-+    AppletViewerPanel panel;
-+
-+    /**
-+     * The status line.
-+     */
-+    Label label;
-+
-+    /**
-+     * output status messages to this stream
-+     */
-+
-+    PrintStream statusMsgStream;
-+
-+    /**
-+     * For cloning
-+     */
-+    PluginAppletViewerFactory factory;
-+
-+    /**
-+     * Create the applet viewer
-+     */
-+    public PluginAppletViewer(long handle, int x, int y, final URL doc,
-+                              final Hashtable atts, PrintStream statusMsgStream,
-+                              PluginAppletViewerFactory factory) {
-+        super(handle, true);
-+    	this.factory = factory;
-+	this.statusMsgStream = statusMsgStream;
-+
-+	try {
-+		panel = new NetxPanel(doc, atts);
-+		AppletViewerPanel.debug("Using NetX panel");
-+	} catch (Exception ex) {
-+		AppletViewerPanel.debug("Unable to start NetX applet - defaulting to Sun applet", ex);
-+		panel = new AppletViewerPanel(doc, atts);
-+	}
-+	add("Center", panel);
-+	panel.init();
-+	appletPanels.addElement(panel);
-+
-+	pack();
-+	setVisible(true);
-+
-+	WindowListener windowEventListener = new WindowAdapter() {
-+
-+	    public void windowClosing(WindowEvent evt) {
-+		appletClose();
-+	    }
-+
-+	    public void windowIconified(WindowEvent evt) {
-+		appletStop();
-+	    }
-+
-+	    public void windowDeiconified(WindowEvent evt) {
-+		appletStart();
-+	    }
-+	};
-+
-+	class AppletEventListener implements AppletListener  
-+	{
-+	    final Frame frame;
-+
-+	    public AppletEventListener(Frame frame)
-+	    {
-+		this.frame = frame;
-+	    }
-+
-+	    public void appletStateChanged(AppletEvent evt) 
-+	    {
-+		AppletPanel src = (AppletPanel)evt.getSource();
-+
-+		switch (evt.getID()) {
-+                    case AppletPanel.APPLET_RESIZE: {
-+			if(src != null) {
-+			    resize(preferredSize());
-+			    validate();
-+                        }
-+			break;
-+		    }
-+		    case AppletPanel.APPLET_LOADING_COMPLETED: {
-+			Applet a = src.getApplet(); // sun.applet.AppletPanel
-+			
-+			// Fixed #4754451: Applet can have methods running on main
-+			// thread event queue. 
-+			// 
-+			// The cause of this bug is that the frame of the applet 
-+			// is created in main thread group. Thus, when certain 
-+			// AWT/Swing events are generated, the events will be
-+			// dispatched through the wrong event dispatch thread.
-+			//
-+			// To fix this, we rearrange the AppContext with the frame,
-+			// so the proper event queue will be looked up.
-+			//
-+			// Swing also maintains a Frame list for the AppContext,
-+			// so we will have to rearrange it as well.
-+			//
-+			if (a != null)
-+			    AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a));
-+			else
-+			    AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext());
-+
-+			break;
-+		    }
-+		}
-+	    }
-+	};
-+
-+	ComponentListener componentListener = new ComponentAdapter() {
-+		public void componentResized(ComponentEvent event)
-+  		{
-+		    if (panel != null)
-+		      {
-+		        ComponentListener[] l = panel.getComponentListeners();
-+		        for (int i = 0; i < l.length; i++)
-+		          l[i].componentResized(event);
-+			panel.validate();
-+		      }
-+		  }
-+
-+		public void componentMoved(ComponentEvent event)
-+		  {
-+		    if (panel != null)
-+		      {
-+		        ComponentListener[] l = panel.getComponentListeners();
-+		        for (int i = 0; i < l.length; i++)
-+		          l[i].componentMoved(event);
-+			panel.validate();
-+		      }
-+		  }
-+        };
-+
-+	HierarchyBoundsListener hierarchyBoundsListener = new HierarchyBoundsAdapter() {
-+		public void ancestorMoved(HierarchyEvent e)
-+		  {
-+		     if (panel != null)
-+                      {
-+		        HierarchyBoundsListener[] l = panel.getHierarchyBoundsListeners();
-+		        for (int i = 0; i < l.length; i++)
-+		          l[i].ancestorMoved(e);
-+			panel.validate();
-+		      }
-+		  }
-+
-+		public void ancestorResized(HierarchyEvent e)
-+		  {
-+		    if (panel != null)
-+		      {
-+		        HierarchyBoundsListener[] l = panel.getHierarchyBoundsListeners();
-+		        for (int i = 0; i < l.length; i++)
-+		          l[i].ancestorResized(e);
-+			panel.validate();
-+		      }
-+		  }
-+	};
-+
-+	addWindowListener(windowEventListener);
-+        addComponentListener(componentListener);
-+        addHierarchyBoundsListener(hierarchyBoundsListener);
-+	panel.addAppletListener(new AppletEventListener(this));
-+
-+	// Start the applet
-+        showStatus(amh.getMessage("status.start"));
-+	initEventQueue();
-+    }
-+
-+    /**
-+     * Send the initial set of events to the appletviewer event queue.
-+     * On start-up the current behaviour is to load the applet and call
-+     * Applet.init() and Applet.start().
-+     */
-+    private void initEventQueue() {
-+	// appletviewer.send.event is an undocumented and unsupported system
-+	// property which is used exclusively for testing purposes.
-+	String eventList = System.getProperty("appletviewer.send.event");
-+
-+	if (eventList == null) {
-+	    // Add the standard events onto the event queue.
-+	    panel.sendEvent(AppletPanel.APPLET_LOAD);
-+	    panel.sendEvent(AppletPanel.APPLET_INIT);
-+	    panel.sendEvent(AppletPanel.APPLET_START);
-+	} else {
-+	    // We're testing AppletViewer.  Force the specified set of events
-+	    // onto the event queue, wait for the events to be processed, and
-+	    // exit.
-+
-+	    // The list of events that will be executed is provided as a
-+	    // ","-separated list.  No error-checking will be done on the list.
-+  	    String [] events = splitSeparator(",", eventList);
-+
-+ 	    for (int i = 0; i < events.length; i++) {
-+ 		System.out.println("Adding event to queue: " + events[i]);
-+ 		if (events[i].equals("dispose"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_DISPOSE);
-+ 		else if (events[i].equals("load"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_LOAD);
-+ 		else if (events[i].equals("init"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_INIT);
-+ 		else if (events[i].equals("start"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_START);
-+ 		else if (events[i].equals("stop"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_STOP);
-+ 		else if (events[i].equals("destroy"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_DESTROY);
-+ 		else if (events[i].equals("quit"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_QUIT);
-+ 		else if (events[i].equals("error"))
-+ 		    panel.sendEvent(AppletPanel.APPLET_ERROR);
-+ 		else
-+		    // non-fatal error if we get an unrecognized event
-+ 		    System.out.println("Unrecognized event name: " + events[i]);
-+ 	    }
-+
-+  	    while (!panel.emptyEventQueue()) ;
-+ 	    appletSystemExit();
-+	}
-+    }
-+
-+    /**
-+     * Split a string based on the presence of a specified separator.  Returns
-+     * an array of arbitrary length.  The end of each element in the array is
-+     * indicated by the separator of the end of the string.  If there is a
-+     * separator immediately before the end of the string, the final element
-+     * will be empty.  None of the strings will contain the separator.  Useful
-+     * when separating strings such as "foo/bar/bas" using separator "/".
-+     *
-+     * @param sep  The separator.
-+     * @param s    The string to split.
-+     * @return     An array of strings.  Each string in the array is determined
-+     *             by the location of the provided sep in the original string,
-+     *             s.  Whitespace not stripped.
-+     */
-+    private String [] splitSeparator(String sep, String s) {
-+ 	Vector v = new Vector();
-+	int tokenStart = 0;
-+	int tokenEnd   = 0;
-+
-+	while ((tokenEnd = s.indexOf(sep, tokenStart)) != -1) {
-+	    v.addElement(s.substring(tokenStart, tokenEnd));
-+	    tokenStart = tokenEnd+1;
-+	}
-+	// Add the final element.
-+	v.addElement(s.substring(tokenStart));
-+
-+	String [] retVal = new String[v.size()];
-+	v.copyInto(retVal);
-+ 	return retVal;
-+    }
-+
-+    /*
-+     * Methods for java.applet.AppletContext
-+     */
-+
-+    private static Map audioClips = new HashMap();
-+
-+    /**
-+     * Get an audio clip.
-+     */
-+    public AudioClip getAudioClip(URL url) {
-+	checkConnect(url);
-+	synchronized (audioClips) {
-+	    AudioClip clip = (AudioClip)audioClips.get(url);
-+	    if (clip == null) {
-+		audioClips.put(url, clip = new AppletAudioClip(url));
-+	    }
-+	    return clip;
-+	}
-+    }
-+
-+    private static Map imageRefs = new HashMap();
-+
-+    /**
-+     * Get an image.
-+     */
-+    public Image getImage(URL url) {
-+	return getCachedImage(url);
-+    }
-+
-+    static Image getCachedImage(URL url) {
-+	// System.getSecurityManager().checkConnection(url.getHost(), url.getPort());
-+	return (Image)getCachedImageRef(url).get();
-+    }
-+
-+    /**
-+     * Get an image ref.
-+     */
-+    static Ref getCachedImageRef(URL url) {
-+	synchronized (imageRefs) {
-+	    AppletImageRef ref = (AppletImageRef)imageRefs.get(url);
-+	    if (ref == null) {
-+		ref = new AppletImageRef(url);
-+		imageRefs.put(url, ref);
-+	    }
-+	    return ref;
-+	}
-+    }
-+
-+    /**
-+     * Flush the image cache.
-+     */
-+    static void flushImageCache() {
-+	imageRefs.clear();
-+    }
-+
-+    static Vector appletPanels = new Vector();
-+
-+    /**
-+     * Get an applet by name.
-+     */
-+    public Applet getApplet(String name) {
-+	AppletSecurity security = (AppletSecurity)System.getSecurityManager();
-+	name = name.toLowerCase();
-+	SocketPermission panelSp =
-+	    new SocketPermission(panel.getCodeBase().getHost(), "connect");
-+	for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
-+	    AppletPanel p = (AppletPanel)e.nextElement();
-+	    String param = p.getParameter("name");
-+	    if (param != null) {
-+		param = param.toLowerCase();
-+	    }
-+	    if (name.equals(param) &&
-+		p.getDocumentBase().equals(panel.getDocumentBase())) {
-+
-+		SocketPermission sp =
-+		    new SocketPermission(p.getCodeBase().getHost(), "connect");
-+
-+		if (panelSp.implies(sp)) {
-+		    return p.applet;
-+		}
-+	    }
-+	}
-+	return null;
-+    }
-+
-+    /**
-+     * Return an enumeration of all the accessible
-+     * applets on this page.
-+     */
-+    public Enumeration getApplets() {
-+	AppletSecurity security = (AppletSecurity)System.getSecurityManager();
-+	Vector v = new Vector();
-+	SocketPermission panelSp =
-+	    new SocketPermission(panel.getCodeBase().getHost(), "connect");
-+
-+	for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
-+	    AppletPanel p = (AppletPanel)e.nextElement();
-+	    if (p.getDocumentBase().equals(panel.getDocumentBase())) {
-+
-+		SocketPermission sp =
-+		    new SocketPermission(p.getCodeBase().getHost(), "connect");
-+		if (panelSp.implies(sp)) {
-+		    v.addElement(p.applet);
-+		}
-+	    }
-+	}
-+	return v.elements();
-+    }
-+
-+    /**
-+     * Ignore.
-+     */
-+    public void showDocument(URL url) {
-+	showDocument(url, "_self");
-+    }
-+
-+    /**
-+     * Ignore.
-+     */
-+    public void showDocument(URL url, String target) {
-+	try {
-+	    PluginMain.write("url " + url + " " + target);
-+	} catch (IOException exception) {
-+	    // Deliberately ignore IOException.  showDocument may be
-+	    // called from threads other than the main thread after
-+	    // PluginMain.pluginOutputStream has been closed.
-+	}
-+    }
-+
-+    /**
-+     * Show status.
-+     */
-+    public void showStatus(String status) {
-+	try {
-+	    PluginMain.write("status " + status);
-+	} catch (IOException exception) {
-+	    // Deliberately ignore IOException.  showStatus may be
-+	    // called from threads other than the main thread after
-+	    // PluginMain.pluginOutputStream has been closed.
-+	}
-+    }
-+
-+    public void setStream(String key, InputStream stream)throws IOException{
-+	// We do nothing.
-+    }
-+
-+    public InputStream getStream(String key){
-+	// We do nothing.
-+	return null;
-+    }
-+
-+    public Iterator getStreamKeys(){
-+	// We do nothing.
-+	return null;
-+    }
-+
-+    /**
-+     * System parameters.
-+     */
-+    static Hashtable systemParam = new Hashtable();
-+
-+    static {
-+	systemParam.put("codebase", "codebase");
-+	systemParam.put("code", "code");
-+	systemParam.put("alt", "alt");
-+	systemParam.put("width", "width");
-+	systemParam.put("height", "height");
-+	systemParam.put("align", "align");
-+	systemParam.put("vspace", "vspace");
-+	systemParam.put("hspace", "hspace");
-+    }
-+
-+    /**
-+     * Print the HTML tag.
-+     */
-+    public static void printTag(PrintStream out, Hashtable atts) {
-+	out.print("<applet");
-+
-+	String v = (String)atts.get("codebase");
-+	if (v != null) {
-+	    out.print(" codebase=\"" + v + "\"");
-+	}
-+
-+	v = (String)atts.get("code");
-+	if (v == null) {
-+	    v = "applet.class";
-+	}
-+	out.print(" code=\"" + v + "\"");
-+	v = (String)atts.get("width");
-+	if (v == null) {
-+	    v = "150";
-+	}
-+	out.print(" width=" + v);
-+
-+	v = (String)atts.get("height");
-+	if (v == null) {
-+	    v = "100";
-+	}
-+	out.print(" height=" + v);
-+
-+	v = (String)atts.get("name");
-+	if (v != null) {
-+	    out.print(" name=\"" + v + "\"");
-+	}
-+	out.println(">");
-+
-+	// A very slow sorting algorithm
-+	int len = atts.size();
-+	String params[] = new String[len];
-+	len = 0;
-+	for (Enumeration e = atts.keys() ; e.hasMoreElements() ;) {
-+	    String param = (String)e.nextElement();
-+	    int i = 0;
-+	    for (; i < len ; i++) {
-+		if (params[i].compareTo(param) >= 0) {
-+		    break;
-+		}
-+	    }
-+	    System.arraycopy(params, i, params, i + 1, len - i);
-+	    params[i] = param;
-+	    len++;
-+	}
-+
-+	for (int i = 0 ; i < len ; i++) {
-+	    String param = params[i];
-+	    if (systemParam.get(param) == null) {
-+		out.println("<param name=" + param +
-+			    " value=\"" + atts.get(param) + "\">");
-+	    }
-+	}
-+	out.println("</applet>");
-+    }
-+
-+    /**
-+     * Make sure the attributes are up-to-date.
-+     */
-+    public void updateAtts(int width, int height) {
-+	panel.atts.remove("width");
-+	panel.atts.remove("height");
-+	panel.atts.put("width", new Integer(width).toString());
-+	panel.atts.put("height", new Integer(height).toString());
-+    }
-+
-+    /**
-+     * Restart the applet.
-+     */
-+    void appletRestart() {
-+	panel.sendEvent(AppletPanel.APPLET_STOP);
-+	panel.sendEvent(AppletPanel.APPLET_DESTROY);
-+	panel.sendEvent(AppletPanel.APPLET_INIT);
-+	panel.sendEvent(AppletPanel.APPLET_START);
-+    }
-+
-+    /**
-+     * Reload the applet.
-+     */
-+    void appletReload() {
-+	panel.sendEvent(AppletPanel.APPLET_STOP);
-+	panel.sendEvent(AppletPanel.APPLET_DESTROY);
-+	panel.sendEvent(AppletPanel.APPLET_DISPOSE);
-+
-+	/**
-+	 * Fixed #4501142: Classlaoder sharing policy doesn't 
-+	 * take "archive" into account. This will be overridden
-+	 * by Java Plug-in.			[stanleyh]
-+	 */
-+	AppletPanel.flushClassLoader(panel.getClassLoaderCacheKey());
-+
-+        /*
-+         * Make sure we don't have two threads running through the event queue
-+         * at the same time.
-+         */
-+        try {
-+            panel.joinAppletThread();
-+	    panel.release();
-+        } catch (InterruptedException e) {
-+            return;   // abort the reload
-+        }
-+
-+        panel.createAppletThread();
-+	panel.sendEvent(AppletPanel.APPLET_LOAD);
-+	panel.sendEvent(AppletPanel.APPLET_INIT);
-+	panel.sendEvent(AppletPanel.APPLET_START);
-+    }
-+
-+    public int print(Graphics graphics, PageFormat pf, int pageIndex) {
-+        return Printable.NO_SUCH_PAGE;
-+    }
-+
-+    /**
-+     * Start the applet.
-+     */
-+    void appletStart() {
-+	panel.sendEvent(AppletPanel.APPLET_START);
-+    }
-+
-+    /**
-+     * Stop the applet.
-+     */
-+    void appletStop() {
-+	panel.sendEvent(AppletPanel.APPLET_STOP);
-+    }
-+
-+    /**
-+     * Shutdown a viewer.
-+     * Stop, Destroy, Dispose and Quit a viewer
-+     */
-+    private void appletShutdown(AppletPanel p) {
-+	p.sendEvent(AppletPanel.APPLET_STOP);
-+	p.sendEvent(AppletPanel.APPLET_DESTROY);
-+	p.sendEvent(AppletPanel.APPLET_DISPOSE);
-+	p.sendEvent(AppletPanel.APPLET_QUIT);
-+    }
-+
-+    /**
-+     * Close this viewer.
-+     * Stop, Destroy, Dispose and Quit an AppletView, then
-+     * reclaim resources and exit the program if this is
-+     * the last applet.
-+     */
-+    void appletClose() {
-+
-+	// The caller thread is event dispatch thread, so
-+	// spawn a new thread to avoid blocking the event queue
-+	// when calling appletShutdown.
-+	//
-+	final AppletPanel p = panel;
-+
-+	new Thread(new Runnable()
-+	{
-+	    public void run()
-+	    {
-+    		appletShutdown(p);
-+		appletPanels.removeElement(p);
-+		dispose();
-+
-+		if (countApplets() == 0) {
-+		    appletSystemExit();
-+		}
-+	    }
-+	}).start();
-+    }
-+
-+    /**
-+     * Exit the program.
-+     * Exit from the program (if not stand alone) - do no clean-up
-+     */
-+    private void appletSystemExit() {
-+	if (factory.isStandalone())
-+	    System.exit(0);
-+    }
-+
-+    /**
-+     * How many applets are running?
-+     */
-+
-+    public static int countApplets() {
-+	return appletPanels.size();
-+    }
-+
-+
-+    /**
-+     * The current character.
-+     */
-+    static int c;
-+
-+    /**
-+     * Scan spaces.
-+     */
-+    public static void skipSpace(Reader in) throws IOException {
-+        while ((c >= 0) &&
-+	       ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'))) {
-+	    c = in.read();
-+	}
-+    }
-+
-+    /**
-+     * Scan identifier
-+     */
-+    public static String scanIdentifier(Reader in) throws IOException {
-+	StringBuffer buf = new StringBuffer();
-+	while (true) {
-+	    if (((c >= 'a') && (c <= 'z')) ||
-+		((c >= 'A') && (c <= 'Z')) ||
-+		((c >= '0') && (c <= '9')) || (c == '_')) {
-+		buf.append((char)c);
-+		c = in.read();
-+	    } else {
-+		return buf.toString();
-+	    }
-+	}
-+    }
-+
-+    /**
-+     * Scan tag
-+     */
-+    public static Hashtable scanTag(Reader in) throws IOException {
-+	Hashtable atts = new Hashtable();
-+	skipSpace(in);
-+        while (c >= 0 && c != '>') {
-+	    String att = scanIdentifier(in);
-+	    String val = "";
-+	    skipSpace(in);
-+	    if (c == '=') {
-+		int quote = -1;
-+		c = in.read();
-+		skipSpace(in);
-+		if ((c == '\'') || (c == '\"')) {
-+		    quote = c;
-+		    c = in.read();
-+		}
-+		StringBuffer buf = new StringBuffer();
-+                while ((c > 0) &&
-+		       (((quote < 0) && (c != ' ') && (c != '\t') &&
-+                         (c != '\n') && (c != '\r') && (c != '>'))
-+			|| ((quote >= 0) && (c != quote)))) {
-+		    buf.append((char)c);
-+		    c = in.read();
-+		}
-+		if (c == quote) {
-+		    c = in.read();
-+		}
-+		skipSpace(in);
-+		val = buf.toString();
-+	    }
-+	    //statusMsgStream.println("PUT " + att + " = '" + val + "'");
-+	    if (! val.equals("")) {
-+		atts.put(att.toLowerCase(java.util.Locale.ENGLISH), val);
-+	    }
-+            while (true) {
-+                if ((c == '>') || (c < 0) ||
-+                    ((c >= 'a') && (c <= 'z')) ||
-+                    ((c >= 'A') && (c <= 'Z')) ||
-+                    ((c >= '0') && (c <= '9')) || (c == '_'))
-+                    break;
-+                c = in.read();
-+            }
-+            //skipSpace(in);
-+	}
-+	return atts;
-+    }
-+
-+    /* values used for placement of AppletViewer's frames */
-+    private static int x = 0;
-+    private static int y = 0;
-+    private static final int XDELTA = 30;
-+    private static final int YDELTA = XDELTA;
-+
-+    static String encoding = null;
-+
-+    static private Reader makeReader(InputStream is) {
-+	if (encoding != null) {
-+	    try {
-+		return new BufferedReader(new InputStreamReader(is, encoding));
-+	    } catch (IOException x) { }
-+	}
-+	InputStreamReader r = new InputStreamReader(is);
-+	encoding = r.getEncoding();
-+	return new BufferedReader(r);
-+    }
-+
-+    /**
-+     * Scan an html file for <applet> tags
-+     */
-+    public static void parse(long handle, Reader in, URL url, String enc)
-+        throws IOException {
-+        encoding = enc;
-+        parse(handle, 1, 1, in, url, System.out, new PluginAppletViewerFactory());
-+    }
-+
-+    public static void parse(long handle, int width, int height, Reader in, URL url)
-+        throws IOException {
-+        parse(handle, width, height,
-+		in, url, System.out, new PluginAppletViewerFactory());
-+    }
-+
-+    public static void parse(long handle, int width, int height, Reader in, 
-+				URL url,
-+	                        PrintStream statusMsgStream,
-+        	                PluginAppletViewerFactory factory)
-+        throws IOException
-+    {
-+        // <OBJECT> <EMBED> tag flags
-+        boolean isAppletTag = false;
-+        boolean isObjectTag = false;
-+        boolean isEmbedTag = false;
-+
-+	// warning messages
-+        String requiresNameWarning = amh.getMessage("parse.warning.requiresname");
-+        String paramOutsideWarning = amh.getMessage("parse.warning.paramoutside");
-+        String appletRequiresCodeWarning = amh.getMessage("parse.warning.applet.requirescode");
-+        String appletRequiresHeightWarning = amh.getMessage("parse.warning.applet.requiresheight");
-+        String appletRequiresWidthWarning = amh.getMessage("parse.warning.applet.requireswidth");
-+        String objectRequiresCodeWarning = amh.getMessage("parse.warning.object.requirescode");
-+        String objectRequiresHeightWarning = amh.getMessage("parse.warning.object.requiresheight");
-+        String objectRequiresWidthWarning = amh.getMessage("parse.warning.object.requireswidth");
-+        String embedRequiresCodeWarning = amh.getMessage("parse.warning.embed.requirescode");
-+        String embedRequiresHeightWarning = amh.getMessage("parse.warning.embed.requiresheight");
-+        String embedRequiresWidthWarning = amh.getMessage("parse.warning.embed.requireswidth");
-+        String appNotLongerSupportedWarning = amh.getMessage("parse.warning.appnotLongersupported");
-+
-+	java.net.URLConnection conn = url.openConnection();
-+	/* The original URL may have been redirected - this
-+	 * sets it to whatever URL/codebase we ended up getting
-+	 */
-+	url = conn.getURL();
-+
-+	int ydisp = 1;
-+	Hashtable atts = null;
-+
-+        while(true) {
-+	    c = in.read();
-+	    if (c == -1)
-+		break;
-+
-+	    if (c == '<') {
-+		c = in.read();
-+		if (c == '/') {
-+		    c = in.read();
-+		    String nm = scanIdentifier(in);
-+		    if (nm.equalsIgnoreCase("applet") ||
-+                        nm.equalsIgnoreCase("object") ||
-+                        nm.equalsIgnoreCase("embed")) {
-+
-+                        // We can't test for a code tag until </OBJECT>
-+                        // because it is a parameter, not an attribute.
-+                        if(isObjectTag) {
-+                            if (atts.get("code") == null && atts.get("object") == null) {
-+                                statusMsgStream.println(objectRequiresCodeWarning);
-+                                atts = null;
-+                            }
-+                        }
-+
-+			if (atts != null) {
-+			    atts.remove("width");
-+			    atts.remove("height");
-+			    atts.put("width", new Integer(width).toString());
-+			    atts.put("height", new Integer(height).toString());
-+
-+			    // XXX 5/18 In general this code just simply
-+			    // shouldn't be part of parsing.  It's presence
-+			    // causes things to be a little too much of a
-+			    // hack.
-+                            factory.createAppletViewer(handle, x, y, url, atts);
-+			    x += XDELTA;
-+			    y += YDELTA;
-+			    // make sure we don't go too far!
-+			    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
-+			    if ((x > d.width - 300) || (y > d.height - 300)) {
-+				x = 0;
-+				y = 2 * ydisp * YDELTA;
-+				ydisp++;
-+			    }
-+			}
-+			atts = null;
-+                        isAppletTag = false;
-+                        isObjectTag = false;
-+                        isEmbedTag = false;
-+		    }
-+		}
-+		else {
-+		    String nm = scanIdentifier(in);
-+		    if (nm.equalsIgnoreCase("param")) {
-+			Hashtable t = scanTag(in);
-+			String att = (String)t.get("name");
-+			if (att == null) {
-+			    statusMsgStream.println(requiresNameWarning);
-+			} else {
-+			    String val = (String)t.get("value");
-+			    if (val == null) {
-+				statusMsgStream.println(requiresNameWarning);
-+			    } else if (atts != null) {
-+				String name = att.toLowerCase();
-+				atts.put(name, val);
-+			    } else {
-+				statusMsgStream.println(paramOutsideWarning);
-+			    }
-+			}
-+		    }
-+		    else if (nm.equalsIgnoreCase("applet")) {
-+                        isAppletTag = true;
-+			atts = scanTag(in);
-+			if (atts.get("code") == null && atts.get("object") == null) {
-+			    statusMsgStream.println(appletRequiresCodeWarning);
-+			    atts = null;
-+			} else if (atts.get("width") == null) {
-+			    statusMsgStream.println(appletRequiresWidthWarning);
-+			    atts = null;
-+			} else if (atts.get("height") == null) {
-+			    statusMsgStream.println(appletRequiresHeightWarning);
-+			    atts = null;
-+			}
-+		    }
-+		    else if (nm.equalsIgnoreCase("object")) {
-+                        isObjectTag = true;
-+			atts = scanTag(in);
-+                        // The <OBJECT> attribute codebase isn't what
-+                        // we want. If its defined, remove it.
-+                        if(atts.get("codebase") != null) {
-+                            atts.remove("codebase");
-+                        }
-+
-+                        if (atts.get("width") == null) {
-+			    statusMsgStream.println(objectRequiresWidthWarning);
-+			    atts = null;
-+			} else if (atts.get("height") == null) {
-+			    statusMsgStream.println(objectRequiresHeightWarning);
-+			    atts = null;
-+			}
-+		    }
-+		    else if (nm.equalsIgnoreCase("embed")) {
-+                        isEmbedTag = true;
-+			atts = scanTag(in);
-+
-+			if (atts.get("code") == null && atts.get("object") == null) {
-+			    statusMsgStream.println(embedRequiresCodeWarning);
-+			    atts = null;
-+			} else if (atts.get("width") == null) {
-+			    statusMsgStream.println(embedRequiresWidthWarning);
-+			    atts = null;
-+			} else if (atts.get("height") == null) {
-+			    statusMsgStream.println(embedRequiresHeightWarning);
-+			    atts = null;
-+			}
-+		    }
-+		    else if (nm.equalsIgnoreCase("app")) {
-+			statusMsgStream.println(appNotLongerSupportedWarning);
-+			Hashtable atts2 = scanTag(in);
-+			nm = (String)atts2.get("class");
-+			if (nm != null) {
-+			    atts2.remove("class");
-+			    atts2.put("code", nm + ".class");
-+			}
-+			nm = (String)atts2.get("src");
-+			if (nm != null) {
-+			    atts2.remove("src");
-+			    atts2.put("codebase", nm);
-+			}
-+			if (atts2.get("width") == null) {
-+			    atts2.put("width", "100");
-+			}
-+			if (atts2.get("height") == null) {
-+			    atts2.put("height", "100");
-+			}
-+			printTag(statusMsgStream, atts2);
-+			statusMsgStream.println();
-+		    }
-+		}
-+	    }
-+	}
-+	in.close();
-+    }
-+
-+    /**
-+     * Old main entry point.
-+     *
-+     * @deprecated
-+     */
-+    @Deprecated
-+    public static void main(String args[]) throws IOException {
-+        PluginMain.main(args);
-+    }
-+
-+    private static AppletMessageHandler amh = new AppletMessageHandler("appletviewer");
-+
-+    private static void checkConnect(URL url)
-+    {
-+	SecurityManager security = System.getSecurityManager();
-+	if (security != null) {
-+	    try {
-+		java.security.Permission perm =
-+		    url.openConnection().getPermission();
-+		if (perm != null)
-+		    security.checkPermission(perm);
-+		else
-+		    security.checkConnect(url.getHost(), url.getPort());
-+	    } catch (java.io.IOException ioe) {
-+		    security.checkConnect(url.getHost(), url.getPort());
-+	    }
-+	}
-+    }
-+}
--- a/patches/icedtea-sh4-support.patch	Mon Mar 29 00:25:26 2010 +0100
+++ b/patches/icedtea-sh4-support.patch	Mon Mar 29 02:54:20 2010 +0100
@@ -61,3 +61,106 @@
      endif
    endif
  
+--- openjdk/corba/make/common/shared/Platform.gmk	2010-01-18 22:27:21.000000000 +0900
++++ openjdk/corba/make/common/shared/Platform.gmk	2010-01-18 22:28:50.000000000 +0900
+@@ -205,6 +205,9 @@
+                 arm*) \
+                     echo arm \
+                     ;; \
++                sh*) \
++                    echo sh \
++                    ;; \
+                 *) \
+                     echo $(mach) \
+                     ;; \
+--- openjdk/jdk/make/common/shared/Platform.gmk	2010-01-18 22:39:35.000000000 +0900
++++ openjdk/jdk/make/common/shared/Platform.gmk	2010-01-19 09:39:26.000000000 +0900
+@@ -214,6 +214,9 @@
+                 arm*) \
+                     echo arm \
+                     ;; \
++                sh*) \
++                    echo sh \
++                    ;; \
+                 *) \
+                     echo $(mach) \
+                     ;; \
+@@ -272,6 +275,9 @@
+       ifeq ($(ARCH), s390x)
+         ARCH_DATA_MODEL=64
+       endif
++      ifeq ($(ARCH), sh)
++        ARCH_DATA_MODEL=32
++      endif
+     endif
+   endif
+ 
+--- openjdk/jdk/make/jdk_generic_profile.sh	2010-01-19 09:49:57.000000000 +0900
++++ openjdk/jdk/make/jdk_generic_profile.sh	2010-01-19 21:44:30.000000000 +0900
+@@ -350,13 +350,14 @@
+     i?86)    ZERO_LIBARCH=i386      ;;
+     sparc64) ZERO_LIBARCH=sparcv9   ;;
+     arm*)    ZERO_LIBARCH=arm       ;;
++    sh*)     ZERO_LIBARCH=sh        ;;
+     *)       ZERO_LIBARCH="$(arch)"
+   esac
+   export ZERO_LIBARCH
+ 
+   # ARCH_DATA_MODEL is the number of bits in a pointer
+   case "${ZERO_LIBARCH}" in
+-    i386|ppc|s390|sparc|arm)
++    i386|ppc|s390|sparc|arm|sh)
+       ARCH_DATA_MODEL=32
+       ;;
+     amd64|ppc64|s390x|sparcv9|ia64|alpha)
+--- openjdk/jdk/make/javax/sound/SoundDefs.gmk	2010-01-19 22:35:25.000000000 +0900
++++ openjdk/jdk/make/javax/sound/SoundDefs.gmk	2010-01-20 11:42:28.000000000 +0900
+@@ -113,6 +113,10 @@
+   ifeq ($(ARCH), sparcv9)
+     CPPFLAGS += -DX_ARCH=X_SPARCV9
+   endif # ARCH sparcv9
++
++  ifeq ($(ARCH), sh)
++    CPPFLAGS += -DX_ARCH=X_SH
++  endif # ARCH Renesas SuperH(sh)
+ endif
+ 
+ 
+--- openjdk/jdk/make/common/Defs-linux.gmk	2010-01-21 13:27:43.000000000 +0900
++++ openjdk/jdk/make/common/Defs-linux.gmk	2010-01-21 13:28:50.000000000 +0900
+@@ -119,6 +119,7 @@
+ LDFLAGS_COMMON_sparcv9  += -m64 -mcpu=v9
+ CFLAGS_REQUIRED_sparc   += -m32 -mcpu=v9
+ LDFLAGS_COMMON_sparc    += -m32 -mcpu=v9
++CFLAGS_REQUIRED_sh   += -mieee
+ ifeq ($(ZERO_BUILD), true)
+   CFLAGS_REQUIRED       =  $(ZERO_ARCHFLAG)
+   ifeq ($(ZERO_ENDIANNESS), little)
+@@ -202,7 +203,7 @@
+   CXXFLAGS_DBG	+= $(CC_LOWER_OPT)
+ endif
+ 
+-CPPFLAGS_COMMON = -D_$(ARCH)_ $(if $(filter $(ARCH),alpha),,-D$(ARCH)) \
++CPPFLAGS_COMMON = -D_$(ARCH)_ $(if $(filter $(ARCH),alpha sh),,-D$(ARCH)) \
+ 		  -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \
+ 		  -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
+ 
+--- openjdk/corba/make/common/Defs-linux.gmk	2010-01-21 13:29:49.000000000 +0900
++++ openjdk/corba/make/common/Defs-linux.gmk	2010-01-21 13:30:58.000000000 +0900
+@@ -109,6 +109,7 @@
+ LDFLAGS_COMMON_sparcv9  += -m64 -mcpu=v9
+ CFLAGS_REQUIRED_sparc   += -m32 -mcpu=v9
+ LDFLAGS_COMMON_sparc    += -m32 -mcpu=v9
++CFLAGS_REQUIRED_sh   += -mieee
+ ifeq ($(ZERO_BUILD), true)
+   CFLAGS_REQUIRED       =  $(ZERO_ARCHFLAG)
+   ifeq ($(ZERO_ENDIANNESS), little)
+@@ -186,7 +187,7 @@
+   CXXFLAGS_DBG	+= $(CC_LOWER_OPT)
+ endif
+ 
+-CPPFLAGS_COMMON = -D_$(ARCH)_ $(if $(filter $(ARCH),alpha),,-D$(ARCH)) \
++CPPFLAGS_COMMON = -D_$(ARCH)_ $(if $(filter $(ARCH),alpha sh),,-D$(ARCH)) \
+ 		  -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \
+ 		  -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
+ 
--- a/patches/icedtea-webstart-umask.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
---- openjdk/jdk/make/launchers/Makefile.launcher.orig	2008-07-09 12:49:00.000000000 -0400
-+++ openjdk/jdk/make/launchers/Makefile.launcher	2008-07-09 12:49:40.000000000 -0400
-@@ -148,6 +148,16 @@
-   endif
- endif
- 
-+# pluginappletviewer only
-+ifeq ($(PROGRAM), pluginappletviewer)
-+  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
-+endif
-+
-+# javaws only
-+ifeq ($(PROGRAM), javaws)
-+  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
-+endif
-+
- # GUI tools
- ifeq ($(GUI_TOOL),true)
-   ifneq ($(PLATFORM), windows)
---- openjdk/jdk/src/share/bin/java.c.orig	2008-07-09 12:48:35.000000000 -0400
-+++ openjdk/jdk/src/share/bin/java.c	2008-07-09 12:36:11.000000000 -0400
-@@ -56,6 +56,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <sys/stat.h>
- 
- #include <jni.h>
- #include <jvm.h>
-@@ -69,6 +70,8 @@
- #define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
- #endif
- 
-+#define MAXMASK 4095 /* Same as octal 07777 */
-+
- /*
-  * The following environment variable is used to influence the behavior
-  * of the jre exec'd through the SelectVersion routine.  The command line
-@@ -184,6 +187,10 @@
- 
- int JNICALL JavaMain(void * args); /* entry point                  */
- 
-+/* umask things */
-+static int FindUMask(int *, char ***, int *);
-+static int VerifyMask(char *, int*);
-+
- struct JavaMainArgs {
-   int     argc;
-   char ** argv;
-@@ -307,6 +314,26 @@
-     SetClassPath(s);
- #endif
- 
-+#ifdef USE_UMASK
-+	/* Set umask */
-+	int mask;
-+    // Check to see if we can find a umask on the command line.
-+    if (FindUMask(&argc, &argv, &mask) < 0)
-+    {
-+        // We didn't find a umask, so fall back to the default one.
-+        char * defaultMask = (char *) JLI_MemAlloc(5 * sizeof(char));
-+        strcpy(defaultMask, USE_UMASK);
-+        int converted;
-+        VerifyMask(defaultMask, &converted);
-+        JLI_MemFree(defaultMask);
-+		umask(converted); /* from sys/stat.h */
-+    }
-+    else
-+    {
-+		umask(mask);
-+    }
-+#endif
-+
-     /*
-      *  Parse command line options; if the return value of
-      *  ParseArguments is false, the program should exit.
-@@ -2011,3 +2038,87 @@
-     }
-     DoSplashSetFileJarName(file_name, jar_name);
- }
-+
-+/**
-+ * Searches argv to find any parameters that start with "-umask=".
-+ * Sets maskToSet with the mask if a -umask is found, and if the mask
-+ * supplied is valid. Returns 1 if a valid mask was found and set,
-+ * -1 otherwise.
-+ */
-+int FindUMask(int *pargc, char *** pargv, int *maskToSet)
-+{
-+    int found_mask = -1;
-+
-+    // our handles to the original list
-+    int argc = *pargc;
-+    char **argv = *pargv;
-+
-+    // the new set
-+    int nargc = argc;
-+    char ** nargv = (char **) JLI_MemAlloc((nargc + 1) * sizeof(char *));
-+
-+    // set the original set to the new set
-+    *pargv = nargv;
-+    *pargc = nargc;
-+
-+    char *maskString = (char *) JLI_MemAlloc(6 * sizeof(char *));
-+	int i;
-+    for (i = 0; i < argc; i++)
-+    {
-+        char *arg = argv[i];
-+        if (strncmp(arg, "-umask=",7) == 0)
-+        {
-+            strncpy(maskString, arg+7, 5);
-+
-+            if (VerifyMask(maskString, maskToSet) < 0)
-+            {
-+                printf("Invalid umask %s, application stopped.\n", maskString);
-+                exit(1);
-+            }
-+
-+            found_mask = 1;
-+            nargc--;
-+            (*pargc)--;
-+        }
-+        else
-+        {
-+            *nargv++ = arg;
-+        }
-+    }
-+
-+    JLI_MemFree(maskString);
-+
-+    return found_mask;
-+}
-+
-+/**
-+ * Takes an octal mask in string form, and converts it to
-+ * decimal form in convertedMask. The decimal form can then be
-+ * easily passed to umask(). Returns 1 if the mask is valid, -1 otherwise.
-+ */
-+int VerifyMask(char * maskString, int * convertedMask)
-+{
-+    // Borrowed from coreutils modechange.c
-+    if ('0' <= *maskString && *maskString < '8')
-+    {
-+        unsigned int decimal_mode = 0;
-+
-+        do {
-+            decimal_mode = 8 * decimal_mode + *maskString++ - '0';
-+        } while ('0' <= *maskString && *maskString < '8');
-+
-+        if (decimal_mode > MAXMASK)
-+            return -1;
-+        else if (*maskString)
-+            return -1;
-+        else
-+            *convertedMask = decimal_mode;
-+
-+        return 1;
-+    }
-+    else
-+    {
-+        return -1;
-+    }
-+
-+}
--- a/patches/icedtea-webstart.patch	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-diff -c openjdk.orig/jdk/make/launchers/Makefile openjdk/jdk/make/launchers/Makefile
---- openjdk.orig/jdk/make/launchers/Makefile	2008-06-29 09:45:56.000000000 -0400
-+++ openjdk/jdk/make/launchers/Makefile	2008-06-29 09:47:01.000000000 -0400
-@@ -67,6 +67,7 @@
- $(call make-launcher, javadoc, com.sun.tools.javadoc.Main, , )
- $(call make-launcher, javah, com.sun.tools.javah.Main, , )
- $(call make-launcher, javap, sun.tools.javap.Main, , )
-+$(call make-launcher, javaws, net.sourceforge.jnlp.runtime.Boot, , )
- $(call make-launcher, jconsole, sun.tools.jconsole.JConsole, \
-   -J-Djconsole.showOutputViewer, )
- $(call make-launcher, jdb, com.sun.tools.example.debug.tty.TTY, , )
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java
---- openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2008-01-12 15:53:45.000000000 -0500
-+++ openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2008-02-04 11:51:20.000000000 -0500
-@@ -42,25 +42,25 @@
-  *
-  * @author      Arthur van Hoff
-  */
--class AppletViewerPanel extends AppletPanel {
-+public class AppletViewerPanel extends AppletPanel {
- 
-     /* Are we debugging? */
--    static boolean debug = false;
-+    protected static boolean debug = false;
- 
-     /**
-      * The document url.
-      */
--    URL documentURL;
-+    protected URL documentURL;
- 
-     /**
-      * The base url.
-      */
--    URL baseURL;
-+    protected URL baseURL;
- 
-     /**
-      * The attributes of the applet.
-      */
--    Hashtable atts;
-+    protected Hashtable atts;
- 
-     /*
-      * JDK 1.1 serialVersionUID
-@@ -70,7 +70,7 @@
-     /**
-      * Construct an applet viewer and start the applet.
-      */
--    AppletViewerPanel(URL documentURL, Hashtable atts) {
-+    protected AppletViewerPanel(URL documentURL, Hashtable atts) {
-         this.documentURL = documentURL;
-         this.atts = atts;
- 
-@@ -202,12 +202,12 @@
-         return (AppletContext)getParent();
-     }
- 
--    static void debug(String s) {
-+    protected static void debug(String s) {
-         if(debug)
-             System.err.println("AppletViewerPanel:::" + s);
-     }
- 
--    static void debug(String s, Throwable t) {
-+    protected static void debug(String s, Throwable t) {
-         if(debug) {
-             t.printStackTrace();
-             debug(s);
-diff -urN openjdk.orig/jdk/src/share/classes/sun/applet/AppletPanel.java openjdk/jdk/src/share/classes/sun/applet/AppletPanel.java
---- openjdk.orig/jdk/src/share/classes/sun/applet/AppletPanel.java	2008-03-26 04:58:12.000000000 -0400
-+++ openjdk/jdk/src/share/classes/sun/applet/AppletPanel.java	2008-04-07 21:55:56.000000000 -0400
-@@ -68,7 +68,7 @@
-     /**
-      * The applet (if loaded).
-      */
--    Applet applet;
-+    protected Applet applet;
- 
-     /**
-      * Applet will allow initialization.  Should be
-@@ -117,7 +117,7 @@
-     /**
-      * The thread for the applet.
-      */
--    Thread handler;
-+    protected Thread handler;
- 
- 
-     /**
-@@ -162,7 +162,8 @@
-      * Creates a thread to run the applet. This method is called
-      * each time an applet is loaded and reloaded.
-      */
--    synchronized void createAppletThread() {
-+	//Overridden by NetxPanel.
-+    protected synchronized void createAppletThread() {
-         // Create a thread group for the applet, and start a new
-         // thread to load the applet.
-         String nm = "applet-" + getCode();
-@@ -306,7 +307,7 @@
-     /**
-      * Get an event from the queue.
-      */
--    synchronized AppletEvent getNextEvent() throws InterruptedException {
-+    protected synchronized AppletEvent getNextEvent() throws InterruptedException {
-         while (queue == null || queue.isEmpty()) {
-             wait();
-         }
-@@ -695,7 +696,8 @@
-      * applet event processing so that it can be gracefully interrupted from
-      * things like HotJava.
-      */
--    private void runLoader() {
-+	//Overridden by NetxPanel.
-+    protected void runLoader() {
-         if (status != APPLET_DISPOSE) {
-             showAppletStatus("notdisposed");
-             return;
---- openjdk/jdk/make/docs/NON_CORE_PKGS.gmk.orig	2009-06-04 11:02:18.000000000 -0400
-+++ openjdk/jdk/make/docs/NON_CORE_PKGS.gmk	2009-06-04 11:02:45.000000000 -0400
-@@ -84,6 +84,8 @@
- 
- SMARTCARDIO_PKGS = javax.smartcardio
- 
-+JNLP_PKGS        = javax.jnlp
-+
- # non-core packages in rt.jar
- NON_CORE_PKGS    = $(DOMAPI_PKGS) \
-                    $(MGMT_PKGS) \
-@@ -91,4 +93,5 @@
-                    $(JGSS_PKGS) \
-                    $(OLD_JSSE_PKGS) \
-                    $(HTTPSERVER_PKGS) \
--                   $(SMARTCARDIO_PKGS)
-+                   $(SMARTCARDIO_PKGS) \
-+                   $(JNLP_PKGS)
--- a/plugin/icedtea/netscape/javascript/JSException.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package netscape.javascript;
-
-/**
- * JSException is an exception which is thrown when JavaScript code
- * returns an error.
- */
-
-public
-class JSException extends RuntimeException {
-    public static final int EXCEPTION_TYPE_EMPTY = -1;
-    public static final int EXCEPTION_TYPE_VOID = 0;
-    public static final int EXCEPTION_TYPE_OBJECT = 1;
-    public static final int EXCEPTION_TYPE_FUNCTION = 2;
-    public static final int EXCEPTION_TYPE_STRING = 3;
-    public static final int EXCEPTION_TYPE_NUMBER = 4;
-    public static final int EXCEPTION_TYPE_BOOLEAN = 5;
-    public static final int EXCEPTION_TYPE_ERROR = 6;
-
-    public String filename;
-    public int lineno;
-    public String source;
-    public int tokenIndex;
-    public int wrappedExceptionType;
-    public Object wrappedException;
-
-    /**
-     * Constructs a JSException without a detail message.
-     * A detail message is a String that describes this particular exception.
-     *
-     * @deprecated Not for public use in future versions.
-     */
-    public JSException() {
-	super();
-        filename = "unknown";
-        lineno = 0;
-        source = "";
-        tokenIndex = 0;
-	wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
-    }
-
-    /**
-     * Constructs a JSException with a detail message.
-     * A detail message is a String that describes this particular exception.
-     * @param s the detail message
-     *
-     * @deprecated Not for public use in future versions.
-     */
-    public JSException(String s) {
-	super(s);
-        filename = "unknown";
-        lineno = 0;
-        source = "";
-        tokenIndex = 0;
-	wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
-    }
-
-    /**
-     * Constructs a JSException with a wrapped JavaScript exception object.
-     * This constructor needs to be public so that Java users can throw 
-     * exceptions to JS cleanly.
-     */
-    public JSException(int wrappedExceptionType, Object wrappedException) {
-	super();
-	this.wrappedExceptionType = wrappedExceptionType;
-	this.wrappedException = wrappedException;
-    }
-    
-    /**
-     * Constructs a JSException with a detail message and all the
-     * other info that usually comes with a JavaScript error.
-     * @param s the detail message
-     *
-     * @deprecated Not for public use in future versions.
-     */
-    public JSException(String s, String filename, int lineno,
-                       String source, int tokenIndex) {
-	super(s);
-        this.filename = filename;
-        this.lineno = lineno;
-        this.source = source;
-        this.tokenIndex = tokenIndex;
-	wrappedExceptionType = EXCEPTION_TYPE_EMPTY;
-    }
-
-    /**
-     * Instance method getWrappedExceptionType returns the int mapping of the
-     * type of the wrappedException Object.
-     */
-    public int getWrappedExceptionType() {
-	return wrappedExceptionType;
-    }
-
-    /**
-     * Instance method getWrappedException.
-     */
-    public Object getWrappedException() {
-	return wrappedException;
-    }
-
-}
-
--- a/plugin/icedtea/netscape/javascript/JSObject.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,290 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* more doc todo:
- *  threads
- *  gc
- *  
- *
- */
-
-package netscape.javascript;
-
-import java.applet.Applet;
-import java.security.AccessControlContext;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.BasicPermission;
-
-import sun.applet.PluginAppletViewer;
-import sun.applet.PluginDebug;
-
-
-
-/**
- * JSObject allows Java to manipulate objects that are
- * defined in JavaScript.
- * Values passed from Java to JavaScript are converted as
- * follows:<ul>
- * <li>JSObject is converted to the original JavaScript object
- * <li>Any other Java object is converted to a JavaScript wrapper,
- *   which can be used to access methods and fields of the java object.
- *   Converting this wrapper to a string will call the toString method
- *   on the original object, converting to a number will call the
- *   doubleValue method if possible and fail otherwise.  Converting
- *   to a boolean will try to call the booleanValue method in the
- *   same way.
- * <li>Java arrays are wrapped with a JavaScript object that understands
- *   array.length and array[index]
- * <li>A Java boolean is converted to a JavaScript boolean
- * <li>Java byte, char, short, int, long, float, and double are converted
- *   to JavaScript numbers
- * </ul>
- * Values passed from JavaScript to Java are converted as follows:<ul>
- * <li>objects which are wrappers around java objects are unwrapped
- * <li>other objects are wrapped with a JSObject
- * <li>strings, numbers and booleans are converted to String, Double,
- *   and Boolean objects respectively
- * </ul>
- * This means that all JavaScript values show up as some kind
- * of java.lang.Object in Java.  In order to make much use of them,
- * you will have to cast them to the appropriate subclass of Object,
- * e.g. <code>(String) window.getMember("name");</code> or
- * <code>(JSObject) window.getMember("document");</code>.
- */
-public final class JSObject {
-    /* the internal object data */
-    private long                              internal;
-
-    /**
-     * initialize
-     */
-    private static void initClass() {
-        PluginDebug.debug ("JSObject.initClass");
-    }
-
-    static {
-        PluginDebug.debug ("JSObject INITIALIZER");
-    }
-
-    /**
-     * it is illegal to construct a JSObject manually
-     */
-    public JSObject(int jsobj_addr) {
-        this((long) jsobj_addr);
-    }
-
-    public JSObject(long jsobj_addr) {
-        
-        // See if the caller has permission
-        
-        try {
-            AccessController.getContext().checkPermission(new JSObjectCreatePermission());
-        } catch (AccessControlException ace) {
-            
-            // If not, only caller with JSObject.getWindow on the stack may 
-            // make this call unprivileged.
-            
-            // Although this check is inefficient, it should happen only once
-            // during applet init, so we look the other way
-
-            StackTraceElement[] stack =  Thread.currentThread().getStackTrace();
-            boolean mayProceed = false;
-            
-            for (int i=0; i < stack.length; i++) {
-                if (stack[i].getClassName().equals("netscape.javascript.JSObject") &&
-                    stack[i].getMethodName().equals("getWindow")) {
-                    mayProceed = true;
-                }
-            }
-
-            if (!mayProceed) throw ace;
-        }
-
-        PluginDebug.debug ("JSObject long CONSTRUCTOR");
-        internal = jsobj_addr;
-    }
-
-    /**
-     * Retrieves a named member of a JavaScript object. 
-     * Equivalent to "this.<i>name</i>" in JavaScript.
-     */
-    public Object	getMember(String name)
-    {
-        PluginDebug.debug ("JSObject.getMember " + name);
-
-        Object o = PluginAppletViewer.getMember(internal, name);
-        PluginDebug.debug ("JSObject.getMember GOT " + o);
-        return o;
-    }
-
-
-    /**
-     * Retrieves an indexed member of a JavaScript object.
-     * Equivalent to "this[<i>index</i>]" in JavaScript.
-     */
-    //    public Object		getMember(int index) { return getSlot(index); }
-    public Object	getSlot(int index)
-    {
-        PluginDebug.debug ("JSObject.getSlot " + index);
-
-        return PluginAppletViewer.getSlot(internal, index);
-    }
-
-
-    /**
-     * Sets a named member of a JavaScript object. 
-     * Equivalent to "this.<i>name</i> = <i>value</i>" in JavaScript.
-     */
-    public void 		setMember(String name, Object value)
-    {
-        PluginDebug.debug ("JSObject.setMember " + name + " " + value);
-
-        PluginAppletViewer.setMember(internal, name, value);
-    }
-
-    /**
-     * Sets an indexed member of a JavaScript object. 
-     * Equivalent to "this[<i>index</i>] = <i>value</i>" in JavaScript.
-     */
-    //    public void 		setMember(int index, Object value) {
-    //        setSlot(index, value);
-    //    }
-    public void 		setSlot(int index, Object value)
-    {
-        PluginDebug.debug ("JSObject.setSlot " + index + " " + value);
-
-        PluginAppletViewer.setSlot(internal, index, value);
-    }
-
-
-    // TODO: toString, finalize.
-
-    /**
-     * Removes a named member of a JavaScript object.
-     */
-    public void 		removeMember(String name)
-    {
-        PluginDebug.debug ("JSObject.removeMember " + name);
-
-        PluginAppletViewer.removeMember(internal, name);
-    }
-
-
-    /**
-     * Calls a JavaScript method.
-     * Equivalent to "this.<i>methodName</i>(<i>args</i>[0], <i>args</i>[1], ...)" in JavaScript.
-     */
-    public Object	call(String methodName, Object args[])
-    {
-    	if (args == null)
-    		args = new Object[0];
-
-    	PluginDebug.debug ("JSObject.call " + methodName);
-        for (int i = 0; i < args.length; i++)
-            PluginDebug.debug (" " + args[i]);
-        PluginDebug.debug("");
-        return PluginAppletViewer.call(internal, methodName, args);
-    }
-
-
-    /**
-     * Evaluates a JavaScript expression. The expression is a string 
-     * of JavaScript source code which will be evaluated in the context
-     * given by "this".
-     */
-    public Object	eval(String s)
-    {
-        PluginDebug.debug("JSObject.eval " + s);
-        return PluginAppletViewer.eval(internal, s);
-    }
-
-
-    /**
-     * Converts a JSObject to a String.
-     */
-    public String        toString()
-    {
-        PluginDebug.debug("JSObject.toString");
-        return PluginAppletViewer.javascriptToString(internal);
-    }
-
-
-    // should use some sort of identifier rather than String
-    // is "property" the right word?
-    //    native String[]                         listProperties();
-
-
-    /**
-     * get a JSObject for the window containing the given applet
-     */
-    public static JSObject	getWindow(Applet applet)
-    {
-        PluginDebug.debug("JSObject.getWindow");
-        // FIXME: handle long case as well.
-        long internal = 0;
-        internal = ((PluginAppletViewer)
-                    applet.getAppletContext()).getWindow();
-        PluginDebug.debug ("GOT IT: " + internal);
-        return new JSObject((long) internal);
-    }
-
-
-    /**
-     * Finalization decrements the reference count on the corresponding
-     * JavaScript object.
-     */
-    protected void	finalize()
-    {
-        PluginDebug.debug("JSObject.finalize ");
-        PluginAppletViewer.JavaScriptFinalize(internal);
-    }
-
-
-    /**
-     * Override java.lang.Object.equals() because identity is not preserved
-     * with instances of JSObject.
-     */
-    public boolean equals(Object obj)
-    {
-        PluginDebug.debug("JSObject.equals " + obj);
-
-        return false;
-    }
-}
--- a/plugin/icedtea/netscape/javascript/JSObjectCreatePermission.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* JSObjectCreatePermission.java
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 netscape.javascript;
-
-import java.security.BasicPermission;
-
-
-public class JSObjectCreatePermission extends BasicPermission {
-    public JSObjectCreatePermission() {
-        super("JSObjectCreate");
-    }
-}
--- a/plugin/icedtea/netscape/javascript/JSProxy.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/**
- * The JSProxy interface allows applets and plugins to
- * share javascript contexts.
- */
-
-package netscape.javascript;
-import java.applet.Applet;
-
-public interface JSProxy {
-    Object  getMember(JSObject jso, String name);
-    Object  getSlot(JSObject jso, int index);
-    void    setMember(JSObject jso, String name, Object value);
-    void    setSlot(JSObject jso, int index, Object value);
-    void    removeMember(JSObject jso, String name);
-    Object  call(JSObject jso, String methodName, Object args[]);
-    Object  eval(JSObject jso, String s);
-    String      toString(JSObject jso);
-    JSObject    getWindow(Applet applet);
-}
--- a/plugin/icedtea/netscape/javascript/JSRunnable.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-package netscape.javascript;
-
-import sun.applet.PluginDebug;
-
-/**
- * Runs a JavaScript object with a run() method in a separate thread.
- */
-public class JSRunnable implements Runnable {
-	private JSObject runnable;
-
-	public JSRunnable(JSObject runnable) {
-		this.runnable = runnable;
-		synchronized(this) {
-			new Thread(this).start();
-			try {
-				this.wait();
-			} catch (InterruptedException ie) {
-			}
-		}
-	}
-	
-	public void run() {
-		try {
-			runnable.call("run", null);
-			synchronized(this) {
-				notifyAll();
-			}
-		} catch (Throwable t) {
-			PluginDebug.debug(t.toString());
-			t.printStackTrace(System.err);
-		}
-	}
-}
--- a/plugin/icedtea/netscape/javascript/JSUtil.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-/* ** */
-
-package netscape.javascript;
-import java.io.*;
-
-public class JSUtil {
-
-    /* Return the stack trace of an exception or error as a String */
-    public static String getStackTrace(Throwable t) {
-	ByteArrayOutputStream captureStream;
-	PrintWriter p;
-	
-	captureStream = new ByteArrayOutputStream();
-	p = new PrintWriter(captureStream);
-
-	t.printStackTrace(p);
-	p.flush();
-
-	return captureStream.toString();
-    }
-}
--- a/plugin/icedtea/sun/applet/AppletSecurityContextManager.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.security.AccessControlContext;
-import java.util.HashMap;
-
-public class AppletSecurityContextManager {
-
-	// Context identifier -> PluginAppletSecurityContext object.
-	// FIXME: make private
-	private static HashMap<Integer, PluginAppletSecurityContext> contexts = new HashMap();
-	
-	public static void addContext(int identifier, PluginAppletSecurityContext context) {
-		contexts.put(identifier, context);
-	}
-	
-	public static PluginAppletSecurityContext getSecurityContext(int identifier) {
-		return contexts.get(identifier);
-	}
-
-	public static void dumpStore(int identifier) {
-		contexts.get(identifier).dumpStore();
-	}
-	
-	public static void handleMessage(int identifier, int reference,	String src, String[] privileges, String message) {
-		PluginDebug.debug(identifier + " -- " + src + " -- " + reference + " -- " + message + " CONTEXT= " + contexts.get(identifier));
-		AccessControlContext callContext = null;
-
-		privileges = privileges != null ? privileges : new String[0];
-		callContext = contexts.get(identifier).getAccessControlContext(privileges, src); 
-
-		contexts.get(identifier).handleMessage(reference, src, callContext, message);
-	}
-}
--- a/plugin/icedtea/sun/applet/GetMemberPluginCallRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/* GetMemberPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-public class GetMemberPluginCallRequest extends PluginCallRequest {
-    Object object = null;
-
-    public GetMemberPluginCallRequest(String message, String returnString) {
-        super(message, returnString);
-        PluginDebug.debug ("GetMEMBerPLUGINCAlL " + message + " " + returnString);
-    }
-
-    public void parseReturn(String message) {
-    	PluginDebug.debug ("GetMEMBerparseReturn GOT: " + message);
-        String[] args = message.split(" ");
-        // FIXME: add thread ID to messages to support multiple
-        // threads using the netscape.javascript package.
-        object = AppletSecurityContextManager.getSecurityContext(0).getObject(Integer.parseInt(args[1]));
-        setDone(true);
-    }
-
-    /**
-     * Returns whether the given message is serviceable by this object
-     * 
-     * @param message The message to service
-     * @return boolean indicating if message is serviceable
-     */
-    public boolean serviceable(String message) {
-    	return message.contains("JavaScriptCall") ||
-    			message.contains("JavaScriptEval") ||
-    			message.contains("JavaScriptGetMember") ||
-    			message.contains("JavaScriptGetSlot") ||
-    			message.contains("JavaScriptToString");
-    }
-    
-    public Object getObject() {
-    	return this.object;
-    }
-}
-
--- a/plugin/icedtea/sun/applet/GetWindowPluginCallRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* GetWindowPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.security.AccessControlContext;
-import java.security.ProtectionDomain;
-
-
-
-public class GetWindowPluginCallRequest extends PluginCallRequest {
-    // FIXME: look into int vs long JavaScript internal values.
-    long internal;
-
-    public GetWindowPluginCallRequest(String message, String returnString) {
-        super(message, returnString);
-    }
-
-    public void parseReturn(String message) {
-    	PluginDebug.debug ("GetWINDOWparseReturn GOT: " + message);
-        String[] args = message.split(" ");
-        // FIXME: add thread ID to messages to support multiple
-        // threads using the netscape.javascript package.
-        internal = Long.parseLong(args[1]);
-        setDone(true);
-    }
-    
-    /**
-     * Returns whether the given message is serviceable by this object
-     * 
-     * @param message The message to service
-     * @return boolean indicating if message is serviceable
-     */
-    public boolean serviceable(String message) {
-    	return message.contains("JavaScriptGetWindow");
-    }
-
-    public Long getObject() {
-    	return this.internal;
-    }
-}
--- a/plugin/icedtea/sun/applet/JavaConsole.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,365 +0,0 @@
-/* JavaConsole -- A java console for the plugin
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.JTextArea;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.TitledBorder;
-
-/**
- * A simple Java console for IcedTeaPlugin
- * 
- */
-public class JavaConsole {
-
-    private boolean initialized = false;
-
-    JFrame consoleWindow;
-    JTextArea stdErrText;
-    JTextArea stdOutText;
-
-    /**
-     * Initialize the console
-     */
-    public void initialize() {
-
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        consoleWindow = new JFrame("Java Console");
-
-        JPanel contentPanel = new JPanel();
-        contentPanel.setLayout(new GridBagLayout());
-
-        GridBagConstraints c;
-
-        Font monoSpace = new Font("Monospaced", Font.PLAIN, 12);
-
-        /* std out */
-
-        stdOutText = new JTextArea();
-        JScrollPane stdOutScrollPane = new JScrollPane(stdOutText);
-        stdOutScrollPane.setBorder(new TitledBorder(
-                new EmptyBorder(5, 5, 5, 5), "System.out"));
-        stdOutText.setEditable(false);
-        stdOutText.setFont(monoSpace);
-
-        TextAreaUpdater stdOutUpdater = new TextAreaUpdater(new File(
-                PluginMain.PLUGIN_STDOUT_FILE), stdOutText);
-        stdOutUpdater.setName("IcedteaPlugin Console Thread(System.out)");
-
-        /* std err */
-
-        stdErrText = new JTextArea();
-        JScrollPane stdErrScrollPane = new JScrollPane(stdErrText);
-        stdErrScrollPane.setBorder(new TitledBorder(
-                new EmptyBorder(5, 5, 5, 5), "System.err"));
-        stdErrText.setEditable(false);
-        stdErrText.setFont(monoSpace);
-
-        TextAreaUpdater stdErrUpdater = new TextAreaUpdater(new File(
-                PluginMain.PLUGIN_STDERR_FILE), stdErrText);
-        stdErrUpdater.setName("IcedteaPlugin Console Thread(System.err)");
-
-        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
-                stdOutScrollPane, stdErrScrollPane);
-
-        c = new GridBagConstraints();
-        c.fill = GridBagConstraints.BOTH;
-        c.gridheight = 10;
-        c.weighty = 1;
-
-        contentPanel.add(splitPane, c);
-
-        /* buttons */
-
-        c = new GridBagConstraints();
-        c.gridy = 10;
-        c.gridheight = 1;
-        c.weightx = 0.5;
-        c.weighty = 0;
-
-        JPanel buttonPanel = new JPanel();
-        contentPanel.add(buttonPanel, c);
-
-        JButton gcButton = new JButton("Run GC");
-        buttonPanel.add(gcButton);
-        gcButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                printMemoryInfo();
-                System.out.print("Performing Garbage Collection....");
-                System.gc();
-                System.out.println("Done");
-                printMemoryInfo();
-            }
-
-        });
-
-        JButton finalizersButton = new JButton("Run Finalizers");
-        buttonPanel.add(finalizersButton);
-        finalizersButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                printMemoryInfo();
-                System.out.print("Running finalization....");
-                Runtime.getRuntime().runFinalization();
-                System.out.println("Done");
-                printMemoryInfo();
-            }
-        });
-
-        JButton memoryButton = new JButton("Memory Info");
-        buttonPanel.add(memoryButton);
-        memoryButton.addActionListener(new ActionListener() {
-
-            public void actionPerformed(ActionEvent e) {
-                printMemoryInfo();
-            }
-
-        });
-
-        JButton systemPropertiesButton = new JButton("System Properties");
-        buttonPanel.add(systemPropertiesButton);
-        systemPropertiesButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                printSystemProperties();
-            }
-
-        });
-
-        JButton classloadersButton = new JButton("Classloaders");
-        buttonPanel.add(classloadersButton);
-        classloadersButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                printClassLoaders();
-            }
-
-        });
-
-        JButton threadListButton = new JButton("Thread List");
-        buttonPanel.add(threadListButton);
-        threadListButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                printThreadInfo();
-            }
-
-        });
-
-        JButton closeButton = new JButton("Close");
-        buttonPanel.add(closeButton);
-        closeButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                SwingUtilities.invokeLater(new Runnable() {
-                    public void run() {
-                        hideConsole();
-                    }
-                });
-            }
-        });
-
-        stdOutUpdater.start();
-        stdErrUpdater.start();
-
-        consoleWindow.add(contentPanel);
-        consoleWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
-        consoleWindow.pack();
-        consoleWindow.setSize(new Dimension(900, 600));
-        consoleWindow.setMinimumSize(new Dimension(900, 300));
-
-        initialized = true;
-
-        splitPane.setDividerLocation(0.5);
-        splitPane.setResizeWeight(0.5);
-    }
-
-    public void showConsole() {
-
-        if (!initialized) {
-            initialize();
-        }
-
-        consoleWindow.setVisible(true);
-    }
-
-    public void hideConsole() {
-        consoleWindow.setVisible(false);
-    }
-
-    protected void printSystemProperties() {
-
-        System.out.println(" ----");
-        System.out.println("System Properties:");
-        System.out.println();
-        Properties p = System.getProperties();
-        Set<Object> keys = p.keySet();
-        for (Object key : keys) {
-            System.out.println(key.toString() + ": " + p.get(key));
-        }
-
-        System.out.println(" ----");
-    }
-
-    private void printClassLoaders() {
-        System.out.println(" ----");
-        System.out.println("Available Classloaders: ");
-        Set<ClassLoader> loaders = PluginAppletSecurityContext.classLoaders.keySet();
-        for (ClassLoader loader: loaders) {
-            System.out.println(loader.getClass().getName() + "\n"
-                    + "  codebase = " 
-                    + PluginAppletSecurityContext.classLoaders.get(loader));
-        }
-        System.out.println(" ----");
-    }
-
-    private void printMemoryInfo() {
-        System.out.println(" ----- ");
-        System.out.println("  Memory Info:");
-        System.out.println("    Max Memory:   " 
-                + String.format("%1$10d", Runtime.getRuntime().maxMemory()));
-        System.out.println("    Total Memory: "
-                + String.format("%1$10d", Runtime.getRuntime().totalMemory()));
-        System.out.println("    Free Memory:  "
-                + String.format("%1$10d", Runtime.getRuntime().freeMemory()));
-        System.out.println(" ----");
-
-    }
-
-    private void printThreadInfo() {
-        Map<Thread, StackTraceElement[]> map = Thread.getAllStackTraces();
-        Set<Thread> keys = map.keySet();
-        for (Thread key : keys) {
-            System.out.println("Thread " + key.getId() + ": " + key.getName());
-            for (StackTraceElement element : map.get(key)) {
-                System.out.println("  " + element);
-            }
-
-        }
-    }
-
-    public static void main(String[] args) {
-
-        final JavaConsole console = new JavaConsole();
-
-        boolean toShowConsole = false; 
-
-        for (int i = 0; i < args.length; i++) {
-            if (args[i] == "--show-console") {
-                toShowConsole = true;
-            }
-        }
-
-        if (toShowConsole) {
-            SwingUtilities.invokeLater(new Runnable() {
-                public void run() {
-                    console.showConsole();
-                }
-            });
-        }
-
-    }
-
-    /**
-     * This thread updates the text on a JTextArea based on the text in a file
-     */
-    class TextAreaUpdater extends Thread {
-
-        File fileToRead;
-        JTextArea outputTextArea;
-
-        public TextAreaUpdater(File file, JTextArea textArea) {
-            fileToRead = file;
-            outputTextArea = textArea;
-            setDaemon(true);
-        }
-
-        public void run() {
-
-            try {
-                BufferedReader reader = new BufferedReader(new FileReader(
-                        fileToRead));
-                String line;
-                while (true) {
-                    while ((line = reader.readLine()) != null) {
-                        outputTextArea.insert(line + "\n", outputTextArea
-                                .getDocument().getLength());
-                        outputTextArea.setCaretPosition(outputTextArea
-                                .getText().length());
-                    }
-                    Thread.sleep(1000);
-                }
-
-            } catch (FileNotFoundException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            } catch (IOException e) {
-                // TODO Auto-generated catch block
-                e.printStackTrace();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-                Thread.currentThread().interrupt();
-            }
-
-        }
-
-    }
-
-}
--- a/plugin/icedtea/sun/applet/PasswordAuthenticationDialog.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/* PasswordAuthenticationDialog -- requests authentication information from users
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.PasswordAuthentication;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-
-/**
- * Modal non-minimizable dialog to request http authentication credentials
- */
-
-public class PasswordAuthenticationDialog extends JDialog {
-    
-    private JLabel jlInfo = new JLabel("");
-    private JTextField jtfUserName = new JTextField();
-    private JPasswordField jpfPassword = new JPasswordField();
-    private boolean userCancelled;
-
-    public PasswordAuthenticationDialog() {
-        initialize();
-    }
-
-    /**
-     * Initialized the dialog components
-     */
-    
-    public void initialize() {
-
-        setTitle("IcedTea Java Plugin - Authorization needed to proceed");
-
-        setLayout(new GridBagLayout());
-
-        JLabel jlUserName = new JLabel("Username: ");
-        JLabel jlPassword = new JLabel("Password: ");
-        JButton jbOK = new JButton("OK");
-        JButton jbCancel = new JButton("Cancel");
-
-        jtfUserName.setSize(20, 10);
-        jpfPassword.setSize(20, 10);
-
-        GridBagConstraints c;
-        
-        c = new GridBagConstraints();
-        c.fill = c.HORIZONTAL;
-        c.gridx = 0;
-        c.gridy = 0;
-        c.gridwidth = 2;
-        c.insets = new Insets(10, 5, 3, 3);
-        add(jlInfo, c);
-        
-        c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 1;
-        c.insets = new Insets(10, 5, 3, 3);
-        add(jlUserName, c);
-        
-        c = new GridBagConstraints();
-        c.fill = c.HORIZONTAL;
-        c.gridx = 1;
-        c.gridy = 1;
-        c.insets = new Insets(10, 5, 3, 3);
-        c.weightx = 1.0;
-        add(jtfUserName, c);
-
-
-        c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 2;
-        c.insets = new Insets(5, 5, 3, 3);
-        add(jlPassword, c);
-        
-        c = new GridBagConstraints();
-        c.fill = c.HORIZONTAL;
-        c.gridx = 1;
-        c.gridy = 2;
-        c.insets = new Insets(5, 5, 3, 3);
-        c.weightx = 1.0;
-        add(jpfPassword, c);
-
-        c = new GridBagConstraints();
-        c.anchor = c.SOUTHEAST;
-        c.gridx = 1;
-        c.gridy = 3;
-        c.insets = new Insets(5, 5, 3, 70);
-        c.weightx = 0.0;
-        add(jbCancel, c);
-        
-        c = new GridBagConstraints();
-        c.anchor = c.SOUTHEAST;
-        c.gridx = 1;
-        c.gridy = 3;
-        c.insets = new Insets(5, 5, 3, 3);
-        c.weightx = 0.0;
-        add(jbOK, c);
-        
-        setMinimumSize(new Dimension(400,150));
-        setMaximumSize(new Dimension(1024,150));
-        setAlwaysOnTop(true);
-        
-        setSize(400,150);
-        setLocationRelativeTo(null);
-
-        // OK => read supplied info and pass it on
-        jbOK.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                userCancelled = false;
-                dispose();
-            }
-        });
-        
-        // Cancel => discard supplied info and pass on an empty auth
-        jbCancel.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                userCancelled = true;
-                dispose();
-            }
-        });
-        
-        // "return" key in either user or password field => OK
-
-        jtfUserName.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                userCancelled = false;
-                dispose();
-            }
-        });
-        
-        jpfPassword.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                userCancelled = false;
-                dispose();
-            }
-        });
-    }
-
-    /**
-     * Present a dialog to the user asking them for authentication information
-     * 
-     * @param hostThe host for with authentication is needed
-     * @param port The port being accessed
-     * @param prompt The prompt (realm) as presented by the server
-     * @param type The type of server (proxy/web)
-     * @return PasswordAuthentication containing the credentials (empty credentials if user cancelled)
-     */
-    protected PasswordAuthentication askUser(String host, int port, String prompt, String type) {
-        PasswordAuthentication auth = null;
-
-        host += port != -1 ? ":" + port : "";
-
-        // This frame is reusable. So reset everything first.
-        userCancelled = true;
-        jlInfo.setText("<html>The " + type + " server at " + host + " is requesting authentication. It says \"" + prompt + "\"</html>");
-
-        try {
-            SwingUtilities.invokeAndWait( new Runnable() {
-                public void run() {
-                    // show dialog to user
-                    setVisible(true);
-                }
-            });
-        
-            PluginDebug.debug("password dialog shown");
-            
-            // wait until dialog is gone
-            while (this.isShowing()) {
-                try {
-                    Thread.sleep(200);
-                } catch (InterruptedException ie) {
-                }
-            }
-            
-            PluginDebug.debug("password dialog closed");
-
-            if (!userCancelled) {
-                auth = new PasswordAuthentication(jtfUserName.getText(), jpfPassword.getText().toCharArray());
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            
-            // Nothing else we can do. Empty auth will be returned
-        }
-
-        return auth;
-    }
-
-    public static void main(String[] args) {
-        PasswordAuthenticationDialog frame = new PasswordAuthenticationDialog();
-
-        PasswordAuthentication auth = frame.askUser("127.0.0.1", 3128, "Password for local proxy", "proxy");
-
-        System.err.println("Auth info: " + auth.getUserName() + ":" + new String(auth.getPassword()));
-        System.exit(0);
-    }
-}
--- a/plugin/icedtea/sun/applet/PluginAppletSecurityContext.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1311 +0,0 @@
-/* PluginAppletSecurityContext -- execute plugin JNI messages
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.io.File;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessControlContext;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.security.AllPermission;
-import java.security.BasicPermission;
-import java.security.CodeSource;
-import java.security.Permissions;
-import java.security.PrivilegedAction;
-import java.security.ProtectionDomain;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import netscape.javascript.JSObjectCreatePermission;
-
-
-
-class Signature {
-	private String signature;
-	private int currentIndex;
-	private List<Class> typeList;
-	private static final char ARRAY = '[';
-	private static final char OBJECT = 'L';
-	private static final char SIGNATURE_ENDCLASS = ';';
-	private static final char SIGNATURE_FUNC = '(';
-	private static final char SIGNATURE_ENDFUNC = ')';
-	private static final char VOID = 'V';
-	private static final char BOOLEAN = 'Z';
-	private static final char BYTE = 'B';
-	private static final char CHARACTER = 'C';
-	private static final char SHORT = 'S';
-	private static final char INTEGER = 'I';
-	private static final char LONG = 'J';
-	private static final char FLOAT = 'F';
-	private static final char DOUBLE = 'D';
-
-	private String nextTypeName() {
-		char key = signature.charAt(currentIndex++);
-
-		switch (key) {
-		case ARRAY:
-			return nextTypeName() + "[]";
-
-		case OBJECT:
-			int endClass = signature.indexOf(SIGNATURE_ENDCLASS, currentIndex);
-			String retVal = signature.substring(currentIndex, endClass);
-			retVal = retVal.replace('/', '.');
-			currentIndex = endClass + 1;
-			return retVal;
-
-			// FIXME: generated bytecode with classes named after
-			// primitives will not work in this scheme -- those
-			// classes will be incorrectly treated as primitive
-			// types.
-		case VOID:
-			return "void";
-		case BOOLEAN:
-			return "boolean";
-		case BYTE:
-			return "byte";
-		case CHARACTER:
-			return "char";
-		case SHORT:
-			return "short";
-		case INTEGER:
-			return "int";
-		case LONG:
-			return "long";
-		case FLOAT:
-			return "float";
-		case DOUBLE:
-			return "double";
-
-		case SIGNATURE_ENDFUNC:
-		case SIGNATURE_FUNC:
-			return nextTypeName();
-
-		default:
-			throw new IllegalArgumentException(
-					"Invalid JNI signature character '" + key + "'");
-		}
-	}
-
-	public Signature(String signature, ClassLoader cl) {
-		this.signature = signature;
-		currentIndex = 0;
-		typeList = new ArrayList<Class>(10);
-
-		String elem;
-		while (currentIndex < signature.length()) {
-			elem = nextTypeName();
-			// System.out.println ("NEXT TYPE: " + elem);
-			Class primitive = primitiveNameToType(elem);
-			if (primitive != null)
-				typeList.add(primitive);
-			else {
-				// System.out.println ("HERE1");
-				int dimsize = 0;
-				int n = elem.indexOf('[');
-				if (n != -1) {
-					// System.out.println ("HERE2");
-					String arrayType = elem.substring(0, n);
-					dimsize++;
-					n = elem.indexOf('[', n + 1);
-					// System.out.println ("HERE2.5");
-					while (n != -1) {
-						dimsize++;
-						n = elem.indexOf('[', n + 1);
-						// System.out.println ("HERE2.8");
-					}
-					int[] dims = new int[dimsize];
-					primitive = primitiveNameToType(arrayType);
-					// System.out.println ("HERE3");
-					if (primitive != null) {
-						typeList.add(Array.newInstance(primitive, dims)
-								.getClass());
-						// System.out.println ("HERE4");
-					} else
-						typeList.add(Array.newInstance(
-								getClass(arrayType, cl), dims).getClass());
-				} else {
-					typeList.add(getClass(elem, cl));
-				}
-			}
-		}
-		if (typeList.size() == 0) {
-			throw new IllegalArgumentException("Invalid JNI signature '"
-					+ signature + "'");
-		}
-	}
-
-	public static Class getClass(String name, ClassLoader cl) {
-
-		Class c = null;
-		
-		try {
-			c = Class.forName(name);
-		} catch (ClassNotFoundException cnfe) {
-			
-			PluginDebug.debug("Class " + name + " not found in primordial loader. Looking in " + cl);
-			try {
-				c = cl.loadClass(name);
-			} catch (ClassNotFoundException e) {
-				throw (new RuntimeException(new ClassNotFoundException("Unable to find class " + name)));
-			}
-		}
-
-		return c;
-	}
-	
-	public static Class primitiveNameToType(String name) {
-		if (name.equals("void"))
-			return Void.TYPE;
-		else if (name.equals("boolean"))
-			return Boolean.TYPE;
-		else if (name.equals("byte"))
-			return Byte.TYPE;
-		else if (name.equals("char"))
-			return Character.TYPE;
-		else if (name.equals("short"))
-			return Short.TYPE;
-		else if (name.equals("int"))
-			return Integer.TYPE;
-		else if (name.equals("long"))
-			return Long.TYPE;
-		else if (name.equals("float"))
-			return Float.TYPE;
-		else if (name.equals("double"))
-			return Double.TYPE;
-		else
-			return null;
-	}
-
-	public Class[] getClassArray() {
-		return typeList.subList(0, typeList.size() - 1).toArray(new Class[] {});
-	}
-}
-
-public class PluginAppletSecurityContext {
-	
-	public static Hashtable<ClassLoader, String> classLoaders = new Hashtable<ClassLoader, String>();
-
-	// FIXME: make private
-	public PluginObjectStore store = new PluginObjectStore();
-	private Throwable throwable = null;
-	private ClassLoader liveconnectLoader = ClassLoader.getSystemClassLoader();
-	int identifier = 0;
-	
-	public static PluginStreamHandler streamhandler;
-	
-	long startTime = 0;
-
-	public PluginAppletSecurityContext(int identifier) {
-		this.identifier = identifier;
-		
-		// also, override the basedir, use a different one for the plugin
-		File f = new File(System.getProperty("user.home") + "/.icedteaplugin/");
-		f.mkdir();
-		JNLPRuntime.setBaseDir(f);
-
-		// We need a security manager.. and since there is a good chance that 
-		// an applet will be loaded at some point, we should make it the SM 
-		// that JNLPRuntime will try to install
-		if (System.getSecurityManager() == null) {
-			JNLPRuntime.initialize(/* isApplication */ false);
-		}
-
-		JNLPRuntime.disableExit();
-
-		this.classLoaders.put(liveconnectLoader, "file://");
-	}
-
-	private static <V> V parseCall(String s, ClassLoader cl, Class<V> c) {
-		if (c == Integer.class)
-			return (V) new Integer(s);
-		else if (c == String.class)
-			return (V) new String(s);
-		else if (c == Signature.class)
-			return (V) new Signature(s, cl);
-		else
-			throw new RuntimeException("Unexpected call value.");
-	}
-
-	private Object parseArgs(String s, Class c) {
-		if (c == Boolean.TYPE || c == Boolean.class)
-			return new Boolean(s);
-		else if (c == Byte.TYPE || c == Byte.class)
-			return new Byte(s);
-		else if (c == Character.TYPE || c == Character.class) {
-			String[] bytes = s.split("_");
-			int low = Integer.parseInt(bytes[0]);
-			int high = Integer.parseInt(bytes[1]);
-			int full = ((high << 8) & 0x0ff00) | (low & 0x0ff);
-			return new Character((char) full);
-		} else if (c == Short.TYPE || c == Short.class)
-			return new Short(s);
-		else if (c == Integer.TYPE || c == Integer.class)
-			return new Integer(s);
-		else if (c == Long.TYPE || c == Long.class)
-			return new Long(s);
-		else if (c == Float.TYPE || c == Float.class)
-			return new Float(s);
-		else if (c == Double.TYPE || c == Double.class)
-			return new Double(s);
-		else
-			return store.getObject(new Integer(s));
-	}
-
-	public void associateSrc(ClassLoader cl, String src) {
-		PluginDebug.debug("Associating " + cl + " with " + src);
-		this.classLoaders.put(cl, src);
-	}
-
-	public static void setStreamhandler(PluginStreamHandler sh) {
-		streamhandler = sh;
-	}
-
-	public void handleMessage(int reference, String src, AccessControlContext callContext, String message) {
-
-		startTime = new java.util.Date().getTime();
-
-		try {
-			if (message.startsWith("FindClass")) {
-				ClassLoader cl = null;
-				Class c = null;
-				cl = liveconnectLoader;
-				String className = message.substring("FindClass".length() + 1)
-						.replace('/', '.');
-
-				try {
-					c = cl.loadClass(className);
-					store.reference(c);
-					write(reference, "FindClass " + store.getIdentifier(c));
-				} catch (ClassNotFoundException cnfe) {
-					write(reference, "FindClass 0");
-				}
-
-			} else if (message.startsWith("GetStaticMethodID")
-					|| message.startsWith("GetMethodID")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				String methodName = parseCall(args[2], null, String.class);
-				Signature signature = parseCall(args[3], ((Class) store.getObject(classID)).getClassLoader(), Signature.class);
-				Object[] a = signature.getClassArray();
-
-				Class c = (Class) store.getObject(classID);
-				Method m = null;
-				Constructor cs = null;
-				Object o = null;
-				if (methodName.equals("<init>")
-						|| methodName.equals("<clinit>")) {
-					o = cs = c.getConstructor(signature.getClassArray());
-					store.reference(cs);
-				} else {
-					o = m = c.getMethod(methodName, signature.getClassArray());
-					store.reference(m);
-				}
-				PluginDebug.debug(o + " has id " + store.getIdentifier(o));
-				write(reference, args[0] + " " + store.getIdentifier(o));
-			} else if (message.startsWith("GetStaticFieldID")
-					|| message.startsWith("GetFieldID")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				String fieldName = parseCall(args[2], null, String.class);
-				Signature signature = parseCall(args[3], ((Class) store.getObject(classID)).getClassLoader(), Signature.class);
-
-				Class c = (Class) store.getObject(classID);
-				Field f = null;
-				f = c.getField(fieldName);
-
-				store.reference(f);
-
-				write(reference, "GetStaticFieldID " + store.getIdentifier(f));
-			} else if (message.startsWith("GetStaticField")) {
-				String[] args = message.split(" ");
-				String type = parseCall(args[1], null, String.class);
-				Integer classID = parseCall(args[1], null, Integer.class);
-				Integer fieldID = parseCall(args[2], null, Integer.class);
-
-				final Class c = (Class) store.getObject(classID);
-				final Field f = (Field) store.getObject(fieldID);
-
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				checkPermission(src, c, acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							return f.get(c);
-						} catch (Throwable t) {
-							return t;
-						}
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				// System.out.println ("FIELD VALUE: " + ret);
-				if (ret == null) {
-					write(reference, "GetStaticField 0");
-				} else if (f.getType() == Boolean.TYPE
-						|| f.getType() == Byte.TYPE
-						|| f.getType() == Character.TYPE
-						|| f.getType() == Short.TYPE
-						|| f.getType() == Integer.TYPE
-						|| f.getType() == Long.TYPE
-						|| f.getType() == Float.TYPE
-						|| f.getType() == Double.TYPE) {
-					write(reference, "GetStaticField " + ret);
-				} else {
-					// Track returned object.
-					store.reference(ret);
-					write(reference, "GetStaticField "
-							+ store.getIdentifier(ret));
-				}
-			} else if (message.startsWith("SetStaticField")) {
-				String[] args = message.split(" ");
-				String type = parseCall(args[1], null, String.class);
-				Integer classID = parseCall(args[2], null, Integer.class);
-				Integer fieldID = parseCall(args[3], null, Integer.class);
-
-				Object value = null;
-				if (Signature.primitiveNameToType(type) != null) {
-					value = parseArgs(args[4], Signature
-							.primitiveNameToType(type));
-					// System.out.println ("HERE1: " + value);
-				} else {
-					value = parseArgs(args[3], Object.class);
-					// System.out.println ("HERE2: " + value);
-				}
-
-				final Class c = (Class) store.getObject(classID);
-				final Field f = (Field) store.getObject(fieldID);
-
-				final Object fValue = value;
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				checkPermission(src, c, acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							f.set(c, fValue);
-						} catch (Throwable t) {
-							return t;
-						}
-						
-						return null;
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				write(reference, "SetStaticField");
-			} else if (message.startsWith("SetField")) {
-				String[] args = message.split(" ");
-				String type = parseCall(args[1], null, String.class);
-				Integer objectID = parseCall(args[2], null, Integer.class);
-				Integer fieldID = parseCall(args[3], null, Integer.class);
-
-				Object value = null;
-				if (Signature.primitiveNameToType(type) != null) {
-					value = parseArgs(args[4], Signature
-							.primitiveNameToType(type));
-					// System.out.println ("HERE1: " + value);
-				} else {
-					value = parseArgs(args[3], Object.class);
-					// System.out.println ("HERE2: " + value);
-				}
-
-				final Object o = (Object) store.getObject(objectID);
-				final Field f = (Field) store.getObject(fieldID);
-
-				final Object fValue = value;
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				checkPermission(src, o.getClass(), acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							f.set(o, fValue);
-						} catch (Throwable t) {
-							return t;
-						}
-						
-						return null;
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				write(reference, "SetField");
-			} else if (message.startsWith("GetObjectArrayElement")) {
-				String[] args = message.split(" ");
-				Integer arrayID = parseCall(args[1], null, Integer.class);
-				Integer index = parseCall(args[2], null, Integer.class);
-
-				Object[] o = (Object[]) store.getObject(arrayID);
-				Object ret = null;
-
-				ret = o[index];
-
-				// Track returned object.
-				store.reference(ret);
-				// System.out.println ("array element: " + index + " " + ret);
-				write(reference, "GetObjectArrayElement "
-						+ store.getIdentifier(ret));
-			} else if (message.startsWith("SetObjectArrayElement")) {
-				String[] args = message.split(" ");
-				Integer arrayID = parseCall(args[1], null, Integer.class);
-				Integer index = parseCall(args[2], null, Integer.class);
-				Integer objectID = parseCall(args[3], null, Integer.class);
-
-				Object[] o = (Object[]) store.getObject(arrayID);
-				Object toSet = (Object) store.getObject(objectID);
-
-				o[index] = toSet;
-
-				write(reference, "SetObjectArrayElement");
-			} else if (message.startsWith("GetArrayLength")) {
-				String[] args = message.split(" ");
-				Integer arrayID = parseCall(args[1], null, Integer.class);
-
-				//System.out.println("ARRAYID: " + arrayID);
-				Object o = (Object) store.getObject(arrayID);
-				int len = 0;
-				len = Array.getLength(o);
-				// System.out.println ("Returning array length: " + len);
-
-				// System.out.println ("array length: " + o + " " + len);
-				write(reference, "GetArrayLength " + Array.getLength(o));
-			} else if (message.startsWith("GetField")) {
-				String[] args = message.split(" ");
-				String type = parseCall(args[1], null, String.class);
-				Integer objectID = parseCall(args[1], null, Integer.class);
-				Integer fieldID = parseCall(args[2], null, Integer.class);
-
-				final Object o = (Object) store.getObject(objectID);
-				final Field f = (Field) store.getObject(fieldID);
-
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				checkPermission(src, o.getClass(), acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							return f.get(o);
-						} catch (Throwable t) {
-							return t;
-						}
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				// System.out.println ("FIELD VALUE: " + ret);
-				if (ret == null) {
-					write(reference, "GetField 0");
-				} else if (f.getType() == Boolean.TYPE
-						|| f.getType() == Byte.TYPE
-						|| f.getType() == Character.TYPE
-						|| f.getType() == Short.TYPE
-						|| f.getType() == Integer.TYPE
-						|| f.getType() == Long.TYPE
-						|| f.getType() == Float.TYPE
-						|| f.getType() == Double.TYPE) {
-					write(reference, "GetField " + ret);
-				} else {
-					// Track returned object.
-					store.reference(ret);
-					write(reference, "GetField " + store.getIdentifier(ret));
-				}
-			} else if (message.startsWith("GetObjectClass")) {
-				int oid = Integer.parseInt(message.substring("GetObjectClass"
-						.length() + 1));
-				// System.out.println ("GETTING CLASS FOR: " + oid);
-				Class c = store.getObject(oid).getClass();
-				// System.out.println (" OBJ: " + store.getObject(oid));
-				// System.out.println (" CLS: " + c);
-				store.reference(c);
-
-				write(reference, "GetObjectClass " + store.getIdentifier(c));
-			} else if (message.startsWith("CallStaticMethod")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				Integer methodID = parseCall(args[2], null, Integer.class);
-
-				PluginDebug.debug("GETTING: " + methodID);
-				final Method m = (Method) store.getObject(methodID);
-				PluginDebug.debug("GOT: " + m);
-				Class[] argTypes = m.getParameterTypes();
-
-				Object[] arguments = new Object[argTypes.length];
-				for (int i = 0; i < argTypes.length; i++) {
-					arguments[i] = parseArgs(args[3 + i], argTypes[i]);
-					// System.out.println ("GOT ARG: " + argTypes[i] + " " +
-					// arguments[i]);
-				}
-
-				// System.out.println ("Calling " + m);
-
-				final Object[] fArguments = arguments;
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				Class c = (Class) store.getObject(classID);
-				checkPermission(src, c, acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							return m.invoke(null, fArguments);
-						} catch (Throwable t) {
-							return t;
-						}
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				// if (ret != null)
-				// System.out.println ("RETURN VALUE: " + ret + " " +
-				// ret.getClass());
-				// else
-				// System.out.println ("RETURN VALUE: " + ret);
-				if (ret == null) {
-					write(reference, "CallStaticMethod void");
-				} else if (m.getReturnType() == Boolean.TYPE
-						|| m.getReturnType() == Byte.TYPE
-						|| m.getReturnType() == Short.TYPE
-						|| m.getReturnType() == Integer.TYPE
-						|| m.getReturnType() == Long.TYPE
-						|| m.getReturnType() == Float.TYPE
-						|| m.getReturnType() == Double.TYPE) {
-					write(reference, "CallStaticMethod " + ret);
-				} else if (m.getReturnType() == Character.TYPE) {
-					char ch = (Character) ret;
-					int high = (((int) ch) >> 8) & 0x0ff;
-					int low = ((int) ch) & 0x0ff;
-					write(reference, "CallStaticMethod " + low + "_" + high);
-				} else {
-					// Track returned object.
-					store.reference(ret);
-					write(reference, "CallStaticMethod "
-							+ store.getIdentifier(ret));
-				}
-			} else if (message.startsWith("CallMethod")) {
-				String[] args = message.split(" ");
-				Integer objectID = parseCall(args[1], null, Integer.class);
-				Integer methodID = parseCall(args[2], null, Integer.class);
-
-				final Object o = (Object) store.getObject(objectID);
-				final Method m = (Method) store.getObject(methodID);
-				Class[] argTypes = m.getParameterTypes();
-
-				Object[] arguments = new Object[argTypes.length];
-				for (int i = 0; i < argTypes.length; i++) {
-					arguments[i] = parseArgs(args[3 + i], argTypes[i]);
-					PluginDebug.debug("GOT ARG: " + argTypes[i] + " "
-							+ arguments[i]);
-				}
-
-				String collapsedArgs = "";
-				for (String s : args) {
-					collapsedArgs += " " + s;
-				}
-
-				PluginDebug.debug("Calling method " + m + " on object " + o
-						+ " with " + arguments);
-
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-				checkPermission(src, o.getClass(), acc);
-
-				final Object[] fArguments = arguments;
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							return m.invoke(o, fArguments);
-						} catch (Throwable t) {
-							return t;
-						}
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				String retO;
-				if (ret == null) {
-					retO = "null";
-				} else {
-					retO = ret.getClass().toString();
-				}
-
-				PluginDebug.debug("Calling " + m + " on " + o + " with "
-						+ collapsedArgs + " and that returned: " + ret
-						+ " of type " + retO);
-
-				if (ret == null) {
-					write(reference, "CallMethod void");
-				} else if (m.getReturnType() == Boolean.TYPE
-						|| m.getReturnType() == Byte.TYPE
-						|| m.getReturnType() == Short.TYPE
-						|| m.getReturnType() == Integer.TYPE
-						|| m.getReturnType() == Long.TYPE
-						|| m.getReturnType() == Float.TYPE
-						|| m.getReturnType() == Double.TYPE) {
-					write(reference, "CallMethod " + ret);
-				} else if (m.getReturnType() == Character.TYPE) {
-					char ch = (Character) ret;
-					int high = (((int) ch) >> 8) & 0x0ff;
-					int low = ((int) ch) & 0x0ff;
-					write(reference, "CallMethod " + low + "_" + high);
-				} else {
-					// Track returned object.
-					store.reference(ret);
-					write(reference, "CallMethod " + store.getIdentifier(ret));
-				}
-			} else if (message.startsWith("GetSuperclass")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				Class c = null;
-				Class ret = null;
-
-				c = (Class) store.getObject(classID);
-				ret = c.getSuperclass();
-				store.reference(ret);
-
-				write(reference, "GetSuperclass " + store.getIdentifier(ret));
-			} else if (message.startsWith("IsAssignableFrom")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				Integer superclassID = parseCall(args[2], null, Integer.class);
-
-				boolean result = false;
-				Class clz = (Class) store.getObject(classID);
-				Class sup = (Class) store.getObject(superclassID);
-
-				result = sup.isAssignableFrom(clz);
-
-				write(reference, "IsAssignableFrom " + (result ? "1" : "0"));
-			} else if (message.startsWith("IsInstanceOf")) {
-				String[] args = message.split(" ");
-				Integer objectID = parseCall(args[1], null, Integer.class);
-				Integer classID = parseCall(args[2], null, Integer.class);
-
-				boolean result = false;
-				Object o = (Object) store.getObject(objectID);
-				Class c = (Class) store.getObject(classID);
-
-				result = c.isInstance(o);
-
-				write(reference, "IsInstanceOf " + (result ? "1" : "0"));
-			} else if (message.startsWith("GetStringUTFLength")) {
-				String[] args = message.split(" ");
-				Integer stringID = parseCall(args[1], null, Integer.class);
-
-				String o = null;
-				byte[] b = null;
-				o = (String) store.getObject(stringID);
-				b = o.getBytes("UTF-8");
-				// System.out.println ("STRING UTF-8 LENGTH: " + o + " " +
-				// b.length);
-
-				write(reference, "GetStringUTFLength " + o.length());
-			} else if (message.startsWith("GetStringLength")) {
-				String[] args = message.split(" ");
-				Integer stringID = parseCall(args[1], null, Integer.class);
-
-				String o = null;
-				byte[] b = null;
-				o = (String) store.getObject(stringID);
-				b = o.getBytes("UTF-16LE");
-				// System.out.println ("STRING UTF-16 LENGTH: " + o + " " +
-				// b.length);
-
-				// System.out.println ("Java: GetStringLength " + b.length);
-				write(reference, "GetStringLength " + o.length());
-			} else if (message.startsWith("GetStringUTFChars")) {
-				String[] args = message.split(" ");
-				Integer stringID = parseCall(args[1], null, Integer.class);
-
-				String o = null;
-				byte[] b = null;
-				StringBuffer buf = null;
-				o = (String) store.getObject(stringID);
-				b = o.getBytes("UTF-8");
-				buf = new StringBuffer(b.length * 2);
-				buf.append(b.length);
-				for (int i = 0; i < b.length; i++)
-					buf
-							.append(" "
-									+ Integer
-											.toString(((int) b[i]) & 0x0ff, 16));
-
-				// System.out.println ("Java: GetStringUTFChars: " + o);
-				// //System.out.println ("String UTF BYTES: " + buf);
-				write(reference, "GetStringUTFChars " + buf);
-			} else if (message.startsWith("GetStringChars")) {
-				String[] args = message.split(" ");
-				Integer stringID = parseCall(args[1], null, Integer.class);
-
-				String o = null;
-				byte[] b = null;
-				StringBuffer buf = null;
-				o = (String) store.getObject(stringID);
-				// FIXME: LiveConnect uses UCS-2.
-				b = o.getBytes("UTF-16LE");
-				buf = new StringBuffer(b.length * 2);
-				buf.append(b.length);
-				for (int i = 0; i < b.length; i++)
-					buf
-							.append(" "
-									+ Integer
-											.toString(((int) b[i]) & 0x0ff, 16));
-
-				PluginDebug.debug("Java: GetStringChars: " + o);
-				PluginDebug.debug("  String BYTES: " + buf);
-				write(reference, "GetStringChars " + buf);
-			} else if (message.startsWith("NewArray")) {
-				String[] args = message.split(" ");
-				String type = parseCall(args[1], null, String.class);
-				Integer length = parseCall(args[2], null, Integer.class);
-
-				// System.out.println ("CALLING: NewArray: " + type + " " +
-				// length + " "
-				// + Signature.primitiveNameToType(type));
-
-				Object newArray = null;
-				newArray = Array.newInstance(Signature
-						.primitiveNameToType(type), length);
-
-				store.reference(newArray);
-				write(reference, "NewArray " + store.getIdentifier(newArray));
-			} else if (message.startsWith("NewObjectArray")) {
-				String[] args = message.split(" ");
-				Integer length = parseCall(args[1], null, Integer.class);
-				Integer classID = parseCall(args[2], null, Integer.class);
-				Integer objectID = parseCall(args[3], null, Integer.class);
-
-				// System.out.println ("CALLING: NewObjectArray: " +
-				// classID + " " + length + " "
-				// + objectID);
-
-				Object newArray = null;
-				newArray = Array.newInstance((Class) store.getObject(classID),
-						length);
-
-				Object[] array = (Object[]) newArray;
-				for (int i = 0; i < array.length; i++)
-					array[i] = store.getObject(objectID);
-				store.reference(newArray);
-				write(reference, "NewObjectArray "
-						+ store.getIdentifier(newArray));
-			} else if (message.startsWith("NewObject")) {
-				String[] args = message.split(" ");
-				Integer classID = parseCall(args[1], null, Integer.class);
-				Integer methodID = parseCall(args[2], null, Integer.class);
-
-				final Constructor m = (Constructor) store.getObject(methodID);
-				Class[] argTypes = m.getParameterTypes();
-
-				// System.out.println ("NEWOBJ: HERE1");
-				Object[] arguments = new Object[argTypes.length];
-				// System.out.println ("NEWOBJ: HERE2");
-				for (int i = 0; i < argTypes.length; i++) {
-					arguments[i] = parseArgs(args[3 + i], argTypes[i]);
-					// System.out.println ("NEWOBJ: GOT ARG: " + arguments[i]);
-				}
-
-				final Object[] fArguments = arguments;
-				AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext();
-
-				Class c = (Class) store.getObject(classID);
-				checkPermission(src, c, acc);
-
-				Object ret = AccessController.doPrivileged(new PrivilegedAction<Object> () {
-					public Object run() {
-						try {
-							return m.newInstance(fArguments);
-						} catch (Throwable t) {
-							return t;
-						}
-					}
-				}, acc);
-
-				if (ret instanceof Throwable)
-					throw (Throwable) ret;
-
-				store.reference(ret);
-
-				write(reference, "NewObject " + store.getIdentifier(ret));
-
-			} else if (message.startsWith("NewString")) {
-				PluginDebug.debug("MESSAGE: " + message);
-				String[] args = message.split(" ");
-				Integer strlength = parseCall(args[1], null, Integer.class);
-				int bytelength = 2 * strlength;
-				byte[] byteArray = new byte[bytelength];
-				String ret = null;
-				for (int i = 0; i < strlength; i++) {
-					int c = parseCall(args[2 + i], null, Integer.class);
-					PluginDebug.debug("char " + i + " " + c);
-					// Low.
-					byteArray[2 * i] = (byte) (c & 0x0ff);
-					// High.
-					byteArray[2 * i + 1] = (byte) ((c >> 8) & 0x0ff);
-				}
-				ret = new String(byteArray, 0, bytelength, "UTF-16LE");
-				PluginDebug.debug("NEWSTRING: " + ret);
-
-				// System.out.println ("NEWOBJ: CALLED: " + ret);
-				// System.out.println ("NEWOBJ: CALLED: " +
-				// store.getObject(ret));
-				store.reference(ret);
-				write(reference, "NewString " + store.getIdentifier(ret));
-			} else if (message.startsWith("NewStringUTF")) {
-				PluginDebug.debug("MESSAGE: " + message);
-				String[] args = message.split(" ");
-				byte[] byteArray = new byte[60];
-				String ret = null;
-				int i = 0;
-				int c = 0;
-				while (((byte) c) != 0) {
-					c = parseCall(args[1 + i], null, Integer.class);
-					byteArray[i] = (byte) c;
-					i++;
-					if (i == byteArray.length) {
-						byte[] newByteArray = new byte[2 * byteArray.length];
-						System.arraycopy(byteArray, 0, newByteArray, 0,
-								byteArray.length);
-						byteArray = newByteArray;
-					}
-				}
-				byteArray[i] = (byte) 0;
-				ret = new String(byteArray, "UTF-8");
-				PluginDebug.debug("NEWSTRINGUTF: " + ret);
-
-				store.reference(ret);
-				write(reference, "NewStringUTF " + store.getIdentifier(ret));
-			} else if (message.startsWith("ExceptionOccurred")) {
-				PluginDebug.debug("EXCEPTION: " + throwable);
-				if (throwable != null)
-					store.reference(throwable);
-				write(reference, "ExceptionOccurred "
-						+ store.getIdentifier(throwable));
-			} else if (message.startsWith("ExceptionClear")) {
-				if (throwable != null && store.contains(throwable))
-					store.unreference(store.getIdentifier(throwable));
-				throwable = null;
-				write(reference, "ExceptionClear");
-			} else if (message.startsWith("DeleteGlobalRef")) {
-				String[] args = message.split(" ");
-				Integer id = parseCall(args[1], null, Integer.class);
-				store.unreference(id);
-				write(reference, "DeleteGlobalRef");
-			} else if (message.startsWith("DeleteLocalRef")) {
-				String[] args = message.split(" ");
-				Integer id = parseCall(args[1], null, Integer.class);
-				store.unreference(id);
-				write(reference, "DeleteLocalRef");
-			} else if (message.startsWith("NewGlobalRef")) {
-				String[] args = message.split(" ");
-				Integer id = parseCall(args[1], null, Integer.class);
-				store.reference(store.getObject(id));
-				write(reference, "NewGlobalRef " + id);
-			}
-		} catch (Throwable t) {
-			t.printStackTrace();
-			String msg = t.getCause() != null ? t.getCause().getMessage() : t.getMessage();
-
-			// add an identifier string to let javaside know of the type of error
-			// check for cause as well, since the top level exception will be InvocationTargetException in most cases
-			if (t instanceof AccessControlException || t.getCause() instanceof AccessControlException) {
-				msg = "LiveConnectPermissionNeeded " + msg;
-			}
-
-			this.streamhandler.write("instance " + identifier + " reference " + reference + " Error " + msg);
-
-			// ExceptionOccured is only called after Callmethod() by mozilla. So
-			// for exceptions that are not related to CallMethod, we need a way
-			// to log them. This is how we do it.. send an error message to the
-			// c++ side to let it know that something went wrong, and it will do
-			// the right thing to let mozilla know
-
-			// Store the cause as the actual exception. This is needed because 
-			// the exception we get here will always be an 
-			// "InvocationTargetException" due to the use of reflection above
-			if (message.startsWith("CallMethod") || message.startsWith("CallStaticMethod"))
-				throwable = t.getCause();
-		}
-
-	}
-
-	/**
-	 * Checks if the calling script is allowed to access the specified class
-	 *  
-	 * See http://java.sun.com/j2se/1.3/docs/guide/plugin/security.html#liveconnect for details
-	 *  
-	 * @param jsSrc The source of the script
-	 * @param target The target class that the script is trying to access
-	 * @param acc AccessControlContext for this execution
-	 * @throws AccessControlException If the script has insufficient permissions
-	 */
-	public void checkPermission(String jsSrc, Class target, AccessControlContext acc) throws AccessControlException {
-
-		// target classloader == null => primordial loader. Allow this.
-		if (target.getClassLoader() == null)
-			return;
-
-		String classSrc = this.classLoaders.get(target.getClassLoader());
-
-		PluginDebug.debug("target = " + target + " jsSrc=" + jsSrc + " classSrc=" + classSrc);
-		
-		// if src is not a file and class loader does not map to the same base, UniversalBrowserRead (BrowserReadPermission) must be set
-		if (!jsSrc.equals("file://") && !jsSrc.equals("[System]") && !classSrc.equals(jsSrc)) {
-			acc.checkPermission(new BrowserReadPermission());
-		}
-	}
-
-	private void write(int reference, String message) {
-		PluginDebug.debug("appletviewer writing " + message);
-		streamhandler.write("context " + identifier + " reference " + reference
-				+ " " + message);
-	}
-	
-	public void prePopulateLCClasses() {
-		
-		int classID;
-		
-		prepopulateClass("netscape/javascript/JSObject");
-		classID = prepopulateClass("netscape/javascript/JSException");
-		prepopulateMethod(classID, "<init>", "(Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;I)V");
-		prepopulateMethod(classID, "<init>", "(ILjava/lang/Object;)V");
-		prepopulateField(classID, "lineno");
-		prepopulateField(classID, "tokenIndex");
-		prepopulateField(classID, "source");
-		prepopulateField(classID, "filename");
-		prepopulateField(classID, "wrappedExceptionType");
-		prepopulateField(classID, "wrappedException");
-		
-		classID = prepopulateClass("netscape/javascript/JSUtil");
-		prepopulateMethod(classID, "getStackTrace", "(Ljava/lang/Throwable;)Ljava/lang/String;");
-
-		prepopulateClass("java/lang/Object");
-		classID = prepopulateClass("java/lang/Class");
-		prepopulateMethod(classID, "getMethods", "()[Ljava/lang/reflect/Method;");
-		prepopulateMethod(classID, "getConstructors", "()[Ljava/lang/reflect/Constructor;");
-		prepopulateMethod(classID, "getFields", "()[Ljava/lang/reflect/Field;");
-		prepopulateMethod(classID, "getName", "()Ljava/lang/String;");
-		prepopulateMethod(classID, "isArray", "()Z");
-		prepopulateMethod(classID, "getComponentType", "()Ljava/lang/Class;");
-		prepopulateMethod(classID, "getModifiers", "()I");
-		
-
-		classID = prepopulateClass("java/lang/reflect/Method");
-		prepopulateMethod(classID, "getName", "()Ljava/lang/String;");
-		prepopulateMethod(classID, "getParameterTypes", "()[Ljava/lang/Class;");
-		prepopulateMethod(classID, "getReturnType", "()Ljava/lang/Class;");
-		prepopulateMethod(classID, "getModifiers", "()I");
-
-		classID = prepopulateClass("java/lang/reflect/Constructor");
-		prepopulateMethod(classID, "getParameterTypes", "()[Ljava/lang/Class;");
-		prepopulateMethod(classID, "getModifiers", "()I");
-		
-		classID = prepopulateClass("java/lang/reflect/Field");
-		prepopulateMethod(classID, "getName", "()Ljava/lang/String;");
-		prepopulateMethod(classID, "getType", "()Ljava/lang/Class;");
-		prepopulateMethod(classID, "getModifiers", "()I");
-		
-		classID = prepopulateClass("java/lang/reflect/Array");
-		prepopulateMethod(classID, "newInstance", "(Ljava/lang/Class;I)Ljava/lang/Object;");
-		
-		classID = prepopulateClass("java/lang/Throwable");
-		prepopulateMethod(classID, "toString", "()Ljava/lang/String;");
-		prepopulateMethod(classID, "getMessage", "()Ljava/lang/String;");
-		
-		classID = prepopulateClass("java/lang/System");
-		prepopulateMethod(classID, "identityHashCode", "(Ljava/lang/Object;)I");
-		
-		classID = prepopulateClass("java/lang/Boolean");
-		prepopulateMethod(classID, "booleanValue", "()D");
-		prepopulateMethod(classID, "<init>", "(Z)V");
-
-		classID = prepopulateClass("java/lang/Double");
-		prepopulateMethod(classID, "doubleValue", "()D");
-		prepopulateMethod(classID, "<init>", "(D)V");
-
-		classID = prepopulateClass("java/lang/Void");
-		prepopulateField(classID, "TYPE");
-
-		prepopulateClass("java/lang/String");		
-		prepopulateClass("java/applet/Applet");
-	}
-
-	private int prepopulateClass(String name) {
-		name = name.replace('/', '.');
-		ClassLoader cl = liveconnectLoader;
-		Class c = null;
-
-		try {
-			c = cl.loadClass(name);
-			store.reference(c);
-		} catch (ClassNotFoundException cnfe) {
-			// do nothing ... this should never happen
-			cnfe.printStackTrace();
-		}
-
-		return store.getIdentifier(c);
-	}
-	
-	private int prepopulateMethod(int classID, String methodName, String signatureStr) {
-		Signature signature = parseCall(signatureStr, ((Class) store.getObject(classID)).getClassLoader(), Signature.class);
-		Object[] a = signature.getClassArray();
-
-		Class c = (Class) store.getObject(classID);
-		Method m = null;
-		Constructor cs = null;
-		Object o = null;
-		
-		try {
-			if (methodName.equals("<init>")
-					|| methodName.equals("<clinit>")) {
-				o = cs = c.getConstructor(signature.getClassArray());
-				store.reference(cs);
-			} else {
-				o = m = c.getMethod(methodName, signature.getClassArray());
-				store.reference(m);
-			}
-		} catch (NoSuchMethodException e) {
-			// should never happen
-			e.printStackTrace();
-		}
-		
-		return store.getIdentifier(m);
-	}
-	
-	private int prepopulateField(int classID, String fieldName) {
-
-		Class c = (Class) store.getObject(classID);
-		Field f = null;
-		try {
-			f = c.getField(fieldName);
-		} catch (SecurityException e) {
-			// should never happen
-			e.printStackTrace();
-		} catch (NoSuchFieldException e) {
-			// should never happen			
-			e.printStackTrace();
-		}
-
-		store.reference(f);
-		return store.getIdentifier(f);
-	}
-
-	public void dumpStore() {
-		store.dump();
-	}
-
-	public Object getObject(int identifier) {
-		return store.getObject(identifier);		
-	}
-
-	public int getIdentifier(Object o) {
-		return store.getIdentifier(o);
-	}
-
-	public void store(Object o) {
-		store.reference(o);
-	}
-
-	/**
-	 * Returns a "closed" AccessControlContext i.e. no permissions to get out of sandbox.
-	 */
-	public AccessControlContext getClosedAccessControlContext() {
-		// Deny everything
-		Permissions p = new Permissions();
-		ProtectionDomain pd = new ProtectionDomain(null, p);
-		return new AccessControlContext(new ProtectionDomain[] {pd});
-	}
-
-	public AccessControlContext getAccessControlContext(String[] nsPrivilegeList, String src) {
-
-/*
-		for (int i=0; i < nsPrivilegeList.length; i++) {
-			String privilege = nsPrivilegeList[i];
-
-			if (privilege.equals("UniversalAccept")) {
-				SocketPermission sp = new SocketPermission("*", "accept,resolve");
-				grantedPermissions.add(sp);
-			} else if (privilege.equals("UniversalAwtEventQueueAccess")) {
-				AWTPermission awtp = new AWTPermission("accessEventQueue");
-				grantedPermissions.add(awtp);
-			} else if (privilege.equals("UniversalConnect")) {
-				SocketPermission sp = new SocketPermission("*", "connect,resolve");
-				grantedPermissions.add(sp);
-			} else if (privilege.equals("UniversalListen")) {
-				SocketPermission sp = new SocketPermission("*", "listen,resolve");
-				grantedPermissions.add(sp);
-			} else if (privilege.equals("UniversalExecAccess")) {
-				FilePermission fp = new FilePermission("<<ALL FILES>>", "execute");
-				RuntimePermission rtp = new RuntimePermission("setIO");
-				grantedPermissions.add(fp);
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalExitAccess")) {
-				// Doesn't matter what the permissions are. Do not allow VM to exit.. we 
-				// use a single VM for the entire browser lifecycle once invoked, we 
-				// cannot let it exit
-
-				//RuntimePermission rtp = new RuntimePermission("exitVM.*");
-				//grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalFileDelete")) {
-				FilePermission fp = new FilePermission("<<ALL FILES>>", "delete");
-				grantedPermissions.add(fp);
-			} else if (privilege.equals("UniversalFileRead")) {
-				FilePermission fp = new FilePermission("<<ALL FILES>>", "read");
-				grantedPermissions.add(fp);
-			} else if (privilege.equals("UniversalFileWrite")) {
-				FilePermission fp = new FilePermission("<<ALL FILES>>", "write");
-				grantedPermissions.add(fp);
-			}  else if (privilege.equals("UniversalFdRead")) {
-				RuntimePermission rtp = new RuntimePermission("readFileDescriptor");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalFdWrite")) {
-				RuntimePermission rtp = new RuntimePermission("writeFileDescriptor");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalLinkAccess")) {
-				RuntimePermission rtp = new RuntimePermission("loadLibrary.*");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalListen")) {
-				SocketPermission sp = new SocketPermission("*", "listen");
-				grantedPermissions.add(sp);
-			} else if (privilege.equals("UniversalMulticast")) {
-				SocketPermission sp = new SocketPermission("*", "accept,connect,resolve");
-				grantedPermissions.add(sp);
-			} else if (privilege.equals("UniversalPackageAccess")) {
-				RuntimePermission rtp = new RuntimePermission("defineClassInPackage.*");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalPackageDefinition")) {
-				RuntimePermission rtp = new RuntimePermission("accessClassInPackage.*");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalPrintJobAccess")) {
-				RuntimePermission rtp = new RuntimePermission("queuePrintJob");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalPropertyRead")) {
-				PropertyPermission pp = new PropertyPermission("*", "read");
-				grantedPermissions.add(pp);
-			} else if (privilege.equals("UniversalPropertyWrite")) {
-				PropertyPermission pp = new PropertyPermission("*", "write");
-				grantedPermissions.add(pp);
-			} else if (privilege.equals("UniversalSetFactory")) {
-				RuntimePermission rtp = new RuntimePermission("setFactory");
-				grantedPermissions.add(rtp);
-			} else if (privilege.equals("UniversalSystemClipboardAccess")) {
-				AWTPermission awtp = new AWTPermission("accessClipboard");
-				grantedPermissions.add(awtp);
-			} else if (privilege.equals("UniversalThreadAccess")) {
-				RuntimePermission rtp1 = new RuntimePermission("modifyThread");
-				RuntimePermission rtp2 = new RuntimePermission("stopThread");
-				grantedPermissions.add(rtp1);
-				grantedPermissions.add(rtp2);
-			} else if (privilege.equals("UniversalThreadGroupAccess")) {
-				RuntimePermission rtp1 = new RuntimePermission("modifyThreadGroup");
-				RuntimePermission rtp2 = new RuntimePermission("modifyThread");
-				RuntimePermission rtp3 = new RuntimePermission("stopThread");
-				grantedPermissions.add(rtp1);
-				grantedPermissions.add(rtp2);
-				grantedPermissions.add(rtp3);
-			} else if (privilege.equals("UniversalTopLevelWindow")) {
-				AWTPermission awtp = new AWTPermission("topLevelWindow");
-				grantedPermissions.add(awtp);
-			} else if (privilege.equals("UniversalBrowserRead")) {
-				BrowserReadPermission bp = new BrowserReadPermission();
-				grantedPermissions.add(bp);
-			} else if (privilege.equals("UniversalJavaPermissions")) {
-				AllPermission ap = new AllPermission();
-				grantedPermissions.add(ap);
-			}
-		}
-		
-		// what to do with these is unknown: UniversalConnectWithRedirect, UniversalDialogModality, UniversalSendMail, LimitedInstall, FullInstall, SilentInstall
-*/
-
-		Permissions grantedPermissions = new Permissions();
-
-		for (int i=0; i < nsPrivilegeList.length; i++) {
-			String privilege = nsPrivilegeList[i];
-
-			if (privilege.equals("UniversalBrowserRead")) {
-				BrowserReadPermission bp = new BrowserReadPermission();
-				grantedPermissions.add(bp);
-			} else if (privilege.equals("UniversalJavaPermission")) {
-				AllPermission ap = new AllPermission();
-				grantedPermissions.add(ap);
-			}
-		}
-
-		CodeSource cs = new CodeSource((URL) null, (java.security.cert.Certificate  [])null);
-		
-		if (src != null && src.length() > 0) {
-			try {
-				cs = new CodeSource(new URL(src + "/"), (java.security.cert.Certificate[]) null);
-			} catch (MalformedURLException mfue) {
-				// do nothing
-			}
-		} else {
-		    JSObjectCreatePermission perm = new JSObjectCreatePermission();
-		    grantedPermissions.add(perm);
-		}
-
-		ProtectionDomain pd = new ProtectionDomain(cs, grantedPermissions, null, null);
-
-		// Add to hashmap
-		return new AccessControlContext(new ProtectionDomain[] {pd});
-	}
-
-	class BrowserReadPermission extends BasicPermission {
-		public BrowserReadPermission() {
-			super("browserRead");
-		}
-	}
-}
--- a/plugin/icedtea/sun/applet/PluginAppletViewer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2004 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat 
-
-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; either version 2, or (at your option)
-any later version.
-
-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. */
-
-/*
-  * Copyright 1995-2004 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 sun.applet;
- 
- import java.applet.Applet;
-import java.applet.AppletContext;
-import java.applet.AudioClip;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.Graphics;
-import java.awt.Image;
-import java.awt.Insets;
-import java.awt.Label;
-import java.awt.Toolkit;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.awt.print.PageFormat;
-import java.awt.print.Printable;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.SocketPermission;
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.swing.SwingUtilities;
-
-import net.sourceforge.jnlp.NetxPanel;
-import net.sourceforge.jnlp.runtime.JNLPClassLoader;
-import sun.awt.AppContext;
-import sun.awt.SunToolkit;
-import sun.awt.X11.XEmbeddedFrame;
-import sun.misc.Ref;
-
-import com.sun.jndi.toolkit.url.UrlUtil;
- 
- /**
-  * Lets us construct one using unix-style one shot behaviors
-  */
- 
- class PluginAppletViewerFactory
- {
-     public PluginAppletViewer createAppletViewer(int identifier,
-                                                  long handle, int x, int y,
- 						 URL doc, Hashtable atts) {
-         PluginAppletViewer pluginappletviewer = new PluginAppletViewer(identifier, handle, x, y, doc, atts, System.out, this);
-         return pluginappletviewer;
-     }
- 
-     public boolean isStandalone()
-     {
-         return false;
-     }
- }
- 
- class PluginParseRequest
- {
-     long handle;
-     String tag;
-     String documentbase;
- }
- 
- /*
-  */
- // FIXME: declare JSProxy implementation
- public class PluginAppletViewer extends XEmbeddedFrame
-     implements AppletContext, Printable {
-     /**
-      * Some constants...
-      */
-     private static String defaultSaveFile = "Applet.ser";
-     
-     private static enum PAV_INIT_STATUS {PRE_INIT, ACTIVE, INACTIVE};
-
-     /**
-      * The panel in which the applet is being displayed.
-      */
-     AppletViewerPanel panel;
- 
-     /**
-      * The status line.
-      */
-     Label label;
- 
-     /**
-      * output status messages to this stream
-      */
- 
-     PrintStream statusMsgStream;
- 
-     /**
-      * For cloning
-      */
-     PluginAppletViewerFactory factory;
- 
-     int identifier;
- 
-     private static HashMap<Integer, PluginParseRequest> requests = 
-         new HashMap();
- 
-     // Instance identifier -> PluginAppletViewer object.
-     private static HashMap<Integer, PluginAppletViewer> applets = 
-         new HashMap();
-     
-     private static PluginStreamHandler streamhandler;
-     
-     private static PluginCallRequestFactory requestFactory;
-
-     private static HashMap<Integer, PAV_INIT_STATUS> status = 
-         new HashMap<Integer,PAV_INIT_STATUS>();
-
-     private double proposedHeightFactor;
-     private double proposedWidthFactor;
-
-     /**
-      * Null constructor to allow instantiation via newInstance()
-      */
-     public PluginAppletViewer() {
-     }
-     
-     /**
-      * Create the applet viewer
-      */
-     public PluginAppletViewer(final int identifier, long handle, int x, int y, final URL doc,
-                               final Hashtable atts, PrintStream statusMsgStream,
-                               PluginAppletViewerFactory factory) {
-         super(handle, true);
-    	this.factory = factory;
- 	this.statusMsgStream = statusMsgStream;
-         this.identifier = identifier;
-         // FIXME: when/where do we remove this?
-         PluginDebug.debug ("PARSING: PUTTING " + identifier + " " + this);
-         applets.put(identifier, this);
-         
-         
-         // we intercept height and width specifications here because 
-         proposedHeightFactor = 1.0;
-         proposedWidthFactor = 1.0;
-
-         if (atts.get("heightPercentage") != null) {
-        	 proposedHeightFactor = (Integer) atts.get("heightPercentage")/100.0;
-         }
-         
-         if (atts.get("widthPercentage") != null) {
-        	 proposedWidthFactor = (Integer) atts.get("widthPercentage")/100.0;
-         }
- 
-         AccessController.doPrivileged(new PrivilegedAction() {
-             public Object run() {
-            	 	try {
-            	 		panel = new NetxPanel(doc, atts, false);
-            	 		AppletViewerPanel.debug("Using NetX panel");
-            	 		PluginDebug.debug(atts.toString());
-            	 	} catch (Exception ex) {
-            	 		AppletViewerPanel.debug("Unable to start NetX applet - defaulting to Sun applet", ex);
-            	 		panel = new AppletViewerPanel(doc, atts);
-            	 	}
-                 return null;
-             }
-         });  
-
- 	add("Center", panel);
- 	panel.init();
- 	appletPanels.addElement(panel);
- 
- 	pack();
- 	setVisible(true);
- 
- 	WindowListener windowEventListener = new WindowAdapter() {
- 
- 	    public void windowClosing(WindowEvent evt) {
- 		appletClose();
- 	    }
- 
- 	    public void windowIconified(WindowEvent evt) {
- 		appletStop();
- 	    }
- 
- 	    public void windowDeiconified(WindowEvent evt) {
- 		appletStart();
- 	    }
- 	};
- 
- 	class AppletEventListener implements AppletListener  
- 	{
- 	    final Frame frame;
- 
- 	    public AppletEventListener(Frame frame)
- 	    {
- 		this.frame = frame;
- 	    }
- 
- 	    public void appletStateChanged(AppletEvent evt) 
- 	    {
- 		AppletPanel src = (AppletPanel)evt.getSource();
- 
- 		switch (evt.getID()) {
-                     case AppletPanel.APPLET_RESIZE: {
- 			if(src != null) {
- 			    resize(preferredSize());
- 			    validate();
-                         }
- 			break;
- 		    }
- 		    case AppletPanel.APPLET_LOADING_COMPLETED: {
- 			Applet a = src.getApplet(); // sun.applet.AppletPanel
- 			
- 			// Fixed #4754451: Applet can have methods running on main
- 			// thread event queue. 
- 			// 
- 			// The cause of this bug is that the frame of the applet 
- 			// is created in main thread group. Thus, when certain 
- 			// AWT/Swing events are generated, the events will be
- 			// dispatched through the wrong event dispatch thread.
- 			//
- 			// To fix this, we rearrange the AppContext with the frame,
- 			// so the proper event queue will be looked up.
- 			//
- 			// Swing also maintains a Frame list for the AppContext,
- 			// so we will have to rearrange it as well.
- 			//
- 			if (a != null)
- 			    AppletPanel.changeFrameAppContext(frame, SunToolkit.targetToAppContext(a));
- 			else
- 			    AppletPanel.changeFrameAppContext(frame, AppContext.getAppContext());
- 
- 			break;
- 		    }
- 		}
- 	    }
- 	};
- 
- 	addWindowListener(windowEventListener);
- 	panel.addAppletListener(new AppletEventListener(this));
- 
- 	// Start the applet
-    showStatus(amh.getMessage("status.start"));
- 	initEventQueue();
- 	
- 	// Wait for the panel to initialize
-    // (happens in a separate thread)
- 	Applet a;
-    while ((a = panel.getApplet()) == null && ((NetxPanel) panel).isAlive()) {
-   	 try {
-   		 Thread.sleep(1000);
-   		 PluginDebug.debug("Waiting for applet to initialize... ");
-   	 } catch (InterruptedException ie) {
-   		 ie.printStackTrace();
-   	 }
-    }
-
-    // Still null?
-    if (panel.getApplet() == null) {
-    	this.streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError " + "Initialization failed");
-    	return;
-    }
-
-    PluginDebug.debug("Applet initialized");
-
-    // Applet initialized. Find out it's classloader and add it to the list
-    String portComponent = doc.getPort() != -1 ? ":" + doc.getPort() : "";
-    String codeBase = doc.getProtocol() + "://" + doc.getHost() + portComponent;
-
-    if (atts.get("codebase") != null) {
-    	try {
-    		URL appletSrcURL = new URL(codeBase + (String) atts.get("codebase"));
-    		codeBase = appletSrcURL.getProtocol() + "://" + appletSrcURL.getHost();
-    	} catch (MalformedURLException mfue) {
-    		// do nothing
-    	}
-    }
-
-    AppletSecurityContextManager.getSecurityContext(0).associateSrc(a.getClass().getClassLoader(), codeBase);
-    
- 	try {
- 	    write("initialized");
- 	} catch (IOException ioe) {
- 		ioe.printStackTrace();
- 	}
- 	
-     }
-
- 	public static void setStreamhandler(PluginStreamHandler sh) {
-		streamhandler = sh;
-	}
-
- 	public static void setPluginCallRequestFactory(PluginCallRequestFactory rf) {
-		requestFactory = rf;
-	}
-
-     /**
-      * Handle an incoming message from the plugin.
-      */
-     public static void handleMessage(int identifier, int reference, String message)
-     {
-
-		 PluginDebug.debug("PAV handling: " + message);
-		 
-         try {
-        	 if (message.startsWith("tag")) {
-        		 
-        		 // tag and handle must both be set before parsing, so we need
-        		 // synchronization here, as the setting of these variables
-        		 // may happen in independent threads
-        		 
-        		 synchronized(requests) {
-
-                     // Check if we should proceed with init 
-                     // (=> no if destroy was called after tag, but before 
-                     // handle)
-                     if (status.containsKey(identifier) &&
-                         status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
-
-                         PluginDebug.debug("Inactive flag set. Refusing to initialize instance " + identifier);
-                         requests.remove(identifier);
-                         return;
-
-                     }
-
-        		     status.put(identifier, PAV_INIT_STATUS.PRE_INIT);
-        		     
-        			 PluginParseRequest request = requests.get(identifier);
-        			 if (request == null) {
-        				 request = new PluginParseRequest();
-        				 requests.put(identifier, request);
-        			 }
-        			 int index = message.indexOf(' ', "tag".length() + 1);
-        			 request.documentbase =
-        				 UrlUtil.decode(message.substring("tag".length() + 1, index));
-        			 request.tag = message.substring(index + 1);
-        			 PluginDebug.debug ("REQUEST TAG: " + request.tag + " " +
-        					 Thread.currentThread());
-
-        			 if (request.handle != 0) {
-        				 PluginDebug.debug ("REQUEST TAG, PARSING " +
-        						 Thread.currentThread());
-        				 PluginAppletViewer.parse
-        				 (identifier, request.handle,
-        						 new StringReader(request.tag),
-        						 new URL(request.documentbase));
-        				 requests.remove(identifier);
-        				 
-        				 // Panel initialization cannot be aborted mid-way. 
-        				 // Once it is initialized, double check to see if this 
-        				 // panel needs to stay around..
-        				 if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
-        				     PluginDebug.debug("Inactive flag set. Destroying applet instance " + identifier);
-        				     applets.get(identifier).handleMessage(-1, "destroy");
-        				 } else {
-        				     status.put(identifier, PAV_INIT_STATUS.ACTIVE);
-        				 }
-
-        			 } else {
-        				 PluginDebug.debug ("REQUEST HANDLE NOT SET: " + request.handle + ". BYPASSING");
-        			 }
-        		 }
-        		 
-             } else if (message.startsWith("handle")) {
-            	 synchronized(requests) {
-            	     
-            	     // Check if we should proceed with init 
-            	     // (=> no if destroy was called after handle, but before 
-            	     // tag)
-            	     if (status.containsKey(identifier) &&
-                         status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
-
-            	         PluginDebug.debug("Inactive flag set. Refusing to initialize instance " + identifier);
-            	         requests.remove(identifier);
-            	         return;
-
-            	     }
-
-            	     status.put(identifier, PAV_INIT_STATUS.PRE_INIT);
-
-            		 PluginParseRequest request = requests.get(identifier);
-            		 if (request == null) {
-            			 request = new PluginParseRequest();
-            			 requests.put(identifier, request);
-            		 }
-            		 request.handle = Long.parseLong
-            		 (message.substring("handle".length() + 1));
-            		 PluginDebug.debug ("REQUEST HANDLE: " + request.handle);
-            		 if (request.tag != null) {
-            			 PluginDebug.debug ("REQUEST HANDLE, PARSING " +
-            					 Thread.currentThread());
-            			 PluginAppletViewer.parse
-            			 (identifier, request.handle,
-            					 new StringReader(request.tag),
-            					 new URL(request.documentbase));
-            			 requests.remove(identifier);
-            			 PluginDebug.debug ("REQUEST HANDLE, DONE PARSING " +
-            					 Thread.currentThread());
-
-                         // Panel initialization cannot be aborted mid-way. 
-                         // Once it is initialized, double check to see if this 
-                         // panel needs to stay around..
-                         if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE)) {
-                             PluginDebug.debug("Inactive flag set. Destroying applet instance " + identifier);
-                             applets.get(identifier).handleMessage(-1, "destroy");
-                         } else {
-                             status.put(identifier, PAV_INIT_STATUS.ACTIVE);
-                         }
-
-            		 } else {
-            			 PluginDebug.debug ("REQUEST TAG NOT SET: " + request.tag + ". BYPASSING");
-            		 }
-            	 }
-             } else {
-                 PluginDebug.debug ("Handling message: " + message + " instance " + identifier + " " + Thread.currentThread());
-
-                 // Destroy may be called while initialization is still going 
-                 // on. We therefore special case it.
-                 if (!applets.containsKey(identifier) && message.equals("destroy")) {
-
-                     // Set the status to inactive right away. Doesn't matter if it 
-                     // gets clobbered during init. due to a race. That is what the 
-                     // double check below is for.  
-                     PluginDebug.debug("Destroy called during initialization. Delaying destruction.");
-                     status.put(identifier, PAV_INIT_STATUS.INACTIVE);
-
-                     // We have set the flags. We now lock what stage 1 and 2 
-                     // lock on, and force a synchronous status check+action. 
-                     synchronized (requests) {
-                         // re-check (inside lock) if the applet is 
-                         // initialized at this point. 
-                         if (applets.containsKey(identifier)) {
-                             PluginDebug.debug("Init done. destroying normally.");
-                             applets.get(identifier).handleMessage(reference, message);
-                         } else {
-                         }
-                     } // unlock
-
-                     // we're done here
-                     return;
-                 }
-
-                 // For messages other than destroy, wait till initialization finishes
-                 while (!applets.containsKey(identifier) && 
-                         (
-                           !status.containsKey(identifier) || 
-                            status.get(identifier).equals(PAV_INIT_STATUS.PRE_INIT)
-                         )
-                        );
-                 
-                 // don't bother processing further for inactive applets
-                 if (status.get(identifier).equals(PAV_INIT_STATUS.INACTIVE))
-                     return;
-
-                 applets.get(identifier).handleMessage(reference, message);
-             }
-         } catch (Exception e) {
-
-             // If an exception happened during pre-init, we need to update status
-             if (status.get(identifier).equals(PAV_INIT_STATUS.PRE_INIT))
-                 status.put(identifier, PAV_INIT_STATUS.INACTIVE);
-
-             throw new RuntimeException("Failed to handle message: " + 
-                     message + " for instance " + identifier + " " +  
-                     Thread.currentThread(), e);
-         }
-     }
- 
-     public void handleMessage(int reference, String message)
-     {
-         if (message.startsWith("width")) {
-
-        	 // 0 => width, 1=> width_value, 2 => height, 3=> height_value
-        	 String[] dimMsg = message.split(" ");
-        	 
-        	 final int height = (int) (proposedHeightFactor*Integer.parseInt(dimMsg[3]));
-        	 final int width = (int) (proposedWidthFactor*Integer.parseInt(dimMsg[1]));
-
-        	 if (panel instanceof NetxPanel)
-        		 ((NetxPanel) panel).updateSizeInAtts(height, width);
-
-        	 try {
-				SwingUtilities.invokeAndWait(new Runnable() {
-					 public void run() {
-
-			        	 setSize(width, height);
-						 
-						 // There is a rather odd drawing bug whereby resizing 
-						 // the panel makes no difference on initial call 
-						 // because the panel thinks that it is already the 
-						 // right size. Validation has no effect there either. 
-						 // So we work around by setting size to 1, validating, 
-						 // and then setting to the right size and validating 
-						 // again. This is not very efficient, and there is 
-						 // probably a better way -- but resizing happens 
-						 // quite infrequently, so for now this is how we do it
-
-			        	 panel.setSize(1,1);
-			        	 panel.validate();
-
-			        	 panel.setSize(width, height);
-			        	 panel.validate();
-					 }
-				 });
-			} catch (InterruptedException e) {
-				// do nothing
-				e.printStackTrace();
-			} catch (InvocationTargetException e) {
-				// do nothing
-				e.printStackTrace();
-			}
-         } else if (message.startsWith("destroy")) {
-             dispose();
-             status.put(identifier, PAV_INIT_STATUS.INACTIVE);
-         } else if (message.startsWith("GetJavaObject")) {
-             // FIXME: how do we determine what security context this
-             // object should belong to?
-             Object o;
-
-             // Wait for the panel to initialize
-             // (happens in a separate thread)
-             while (panel == null || ((o = panel.getApplet()) == null && ((NetxPanel) panel).isAlive())) {
-            	 try {
-            		 Thread.sleep(2000);
-            		 PluginDebug.debug("Waiting for applet to initialize...");
-            	 } catch (InterruptedException ie) {
-            		 ie.printStackTrace();
-            	 }
-             }
-
-             // Still null?
-             if (panel.getApplet() == null) {
-                 this.streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError " + "Initialization failed");
-                 return;
-             }
-
-             PluginDebug.debug ("Looking for object " + o + " panel is " + panel);
-             AppletSecurityContextManager.getSecurityContext(0).store(o);
-             PluginDebug.debug ("WRITING 1: " + "context 0 reference " + reference + " GetJavaObject "
-                                 + AppletSecurityContextManager.getSecurityContext(0).getIdentifier(o));
-             streamhandler.write("context 0 reference " + reference + " GetJavaObject "
-                              + AppletSecurityContextManager.getSecurityContext(0).getIdentifier(o));
-             PluginDebug.debug ("WRITING 1 DONE");
-         }
-     }
-
-     // FIXME: Kind of hackish way to ensure synchronized re-drawing 
-     private synchronized void forceredraw() {
-    	 doLayout();
-     }
-     
-     /**
-      * Send the initial set of events to the appletviewer event queue.
-      * On start-up the current behaviour is to load the applet and call
-      * Applet.init() and Applet.start().
-      */
-     private void initEventQueue() {
- 	// appletviewer.send.event is an undocumented and unsupported system
- 	// property which is used exclusively for testing purposes.
-    	 PrivilegedAction pa = new PrivilegedAction() {
-    		 public Object run() {
-    			 return System.getProperty("appletviewer.send.event");
-    		 }
-    	 };
- 	String eventList = (String) AccessController.doPrivileged(pa); 
- 
- 	if (eventList == null) {
- 	    // Add the standard events onto the event queue.
- 	    panel.sendEvent(AppletPanel.APPLET_LOAD);
- 	    panel.sendEvent(AppletPanel.APPLET_INIT);
- 	    panel.sendEvent(AppletPanel.APPLET_START);
- 	} else {
- 	    // We're testing AppletViewer.  Force the specified set of events
- 	    // onto the event queue, wait for the events to be processed, and
- 	    // exit.
- 
- 	    // The list of events that will be executed is provided as a
- 	    // ","-separated list.  No error-checking will be done on the list.
-   	    String [] events = splitSeparator(",", eventList);
- 
-  	    for (int i = 0; i < events.length; i++) {
-  	    PluginDebug.debug("Adding event to queue: " + events[i]);
-  		if (events[i].equals("dispose"))
-  		    panel.sendEvent(AppletPanel.APPLET_DISPOSE);
-  		else if (events[i].equals("load"))
-  		    panel.sendEvent(AppletPanel.APPLET_LOAD);
-  		else if (events[i].equals("init"))
-  		    panel.sendEvent(AppletPanel.APPLET_INIT);
-  		else if (events[i].equals("start"))
-  		    panel.sendEvent(AppletPanel.APPLET_START);
-  		else if (events[i].equals("stop"))
-  		    panel.sendEvent(AppletPanel.APPLET_STOP);
-  		else if (events[i].equals("destroy"))
-  		    panel.sendEvent(AppletPanel.APPLET_DESTROY);
-  		else if (events[i].equals("quit"))
-  		    panel.sendEvent(AppletPanel.APPLET_QUIT);
-  		else if (events[i].equals("error"))
-  		    panel.sendEvent(AppletPanel.APPLET_ERROR);
-  		else
- 		    // non-fatal error if we get an unrecognized event
-  		    PluginDebug.debug("Unrecognized event name: " + events[i]);
-  	    }
- 
-   	    while (!panel.emptyEventQueue()) ;
-  	    appletSystemExit();
- 	}
-     }
- 
-     /**
-      * Split a string based on the presence of a specified separator.  Returns
-      * an array of arbitrary length.  The end of each element in the array is
-      * indicated by the separator of the end of the string.  If there is a
-      * separator immediately before the end of the string, the final element
-      * will be empty.  None of the strings will contain the separator.  Useful
-      * when separating strings such as "foo/bar/bas" using separator "/".
-      *
-      * @param sep  The separator.
-      * @param s    The string to split.
-      * @return     An array of strings.  Each string in the array is determined
-      *             by the location of the provided sep in the original string,
-      *             s.  Whitespace not stripped.
-      */
-     private String [] splitSeparator(String sep, String s) {
-  	Vector v = new Vector();
- 	int tokenStart = 0;
- 	int tokenEnd   = 0;
- 
- 	while ((tokenEnd = s.indexOf(sep, tokenStart)) != -1) {
- 	    v.addElement(s.substring(tokenStart, tokenEnd));
- 	    tokenStart = tokenEnd+1;
- 	}
- 	// Add the final element.
- 	v.addElement(s.substring(tokenStart));
- 
- 	String [] retVal = new String[v.size()];
- 	v.copyInto(retVal);
-  	return retVal;
-     }
- 
-     /*
-      * Methods for java.applet.AppletContext
-      */
- 
-     private static Map audioClips = new HashMap();
- 
-     /**
-      * Get an audio clip.
-      */
-     public AudioClip getAudioClip(URL url) {
- 	checkConnect(url);
- 	synchronized (audioClips) {
- 	    AudioClip clip = (AudioClip)audioClips.get(url);
- 	    if (clip == null) {
- 		audioClips.put(url, clip = new AppletAudioClip(url));
- 	    }
- 	    return clip;
- 	}
-     }
- 
-     private static Map imageRefs = new HashMap();
- 
-     /**
-      * Get an image.
-      */
-     public Image getImage(URL url) {
- 	return getCachedImage(url);
-     }
- 
-     private Image getCachedImage(URL url) {
- 	// System.getSecurityManager().checkConnection(url.getHost(), url.getPort());
- 	return (Image)getCachedImageRef(url).get();
-     }
- 
-     /**
-      * Get an image ref.
-      */
-     private synchronized Ref getCachedImageRef(URL url) {
-         PluginDebug.debug("getCachedImageRef() searching for " + url);
-         
-         try {
-
-             String originalURL = url.toString();
-             String codeBase = panel.getCodeBase().toString();
-
-             if (originalURL.startsWith(codeBase)) {
-
-                 PluginDebug.debug("getCachedImageRef() got URL = " + url);
-                 PluginDebug.debug("getCachedImageRef() plugin codebase = " + codeBase);
-
-                 // try to fetch it locally
-                 if (panel instanceof NetxPanel) {
-
-                     URL localURL = null;
-                     
-                     String resourceName = originalURL.substring(codeBase.length()); 
-                     JNLPClassLoader loader = (JNLPClassLoader) ((NetxPanel) panel).getAppletClassLoader(); 
-
-                     if (loader.resourceAvailableLocally(resourceName))
-                         localURL = loader.getResource(resourceName);
-
-                     url = localURL != null ? localURL : url;
-                 }
-             }
-
-             PluginDebug.debug("getCachedImageRef() getting img from URL = " + url);
-
-             synchronized (imageRefs) {
-                 AppletImageRef ref = (AppletImageRef)imageRefs.get(url);
-                 if (ref == null) {
-                     ref = new AppletImageRef(url);
-                     imageRefs.put(url, ref);
-                 }
-                 return ref;
-             }
-         } catch (Exception e) {
-             System.err.println("Error occurred when trying to fetch image:");
-             e.printStackTrace();
-             return null;
-         }
-     }
- 
-     /**
-      * Flush the image cache.
-      */
-     static void flushImageCache() {
- 	imageRefs.clear();
-     }
- 
-     static Vector appletPanels = new Vector();
- 
-     /**
-      * Get an applet by name.
-      */
-     public Applet getApplet(String name) {
- 	name = name.toLowerCase();
- 	SocketPermission panelSp =
- 	    new SocketPermission(panel.getCodeBase().getHost(), "connect");
- 	for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
- 	    AppletPanel p = (AppletPanel)e.nextElement();
- 	    String param = p.getParameter("name");
- 	    if (param != null) {
- 		param = param.toLowerCase();
- 	    }
- 	    if (name.equals(param) &&
- 		p.getDocumentBase().equals(panel.getDocumentBase())) {
- 
- 		SocketPermission sp =
- 		    new SocketPermission(p.getCodeBase().getHost(), "connect");
- 
- 		if (panelSp.implies(sp)) {
- 		    return p.applet;
- 		}
- 	    }
- 	}
- 	return null;
-     }
- 
-     /**
-      * Return an enumeration of all the accessible
-      * applets on this page.
-      */
-     public Enumeration getApplets() {
- 	Vector v = new Vector();
- 	SocketPermission panelSp =
- 	    new SocketPermission(panel.getCodeBase().getHost(), "connect");
- 
- 	for (Enumeration e = appletPanels.elements() ; e.hasMoreElements() ;) {
- 	    AppletPanel p = (AppletPanel)e.nextElement();
- 	    if (p.getDocumentBase().equals(panel.getDocumentBase())) {
- 
- 		SocketPermission sp =
- 		    new SocketPermission(p.getCodeBase().getHost(), "connect");
- 		if (panelSp.implies(sp)) {
- 		    v.addElement(p.applet);
- 		}
- 	    }
- 	}
- 	return v.elements();
-     }
- 
-     /**
-      * Ignore.
-      */
-     public void showDocument(URL url) {
-    	 PluginDebug.debug("Showing document...");
- 	showDocument(url, "_self");
-     }
- 
-     /**
-      * Ignore.
-      */
-     public void showDocument(URL url, String target) {
- 	try {
-             // FIXME: change to postCallRequest
- 	    write("url " + UrlUtil.encode(url.toString(), "UTF-8") + " " + target);
- 	} catch (IOException exception) {
- 	    // Deliberately ignore IOException.  showDocument may be
- 	    // called from threads other than the main thread after
- 	    // streamhandler.pluginOutputStream has been closed.
- 	}
-     }
- 
-     /**
-      * Show status.
-      */
-     public void showStatus(String status) {
- 	try {
-             // FIXME: change to postCallRequest
- 		// For statuses, we cannot have a newline
-  	    status = status.replace("\n", " ");
- 	    write("status " + status);
- 	} catch (IOException exception) {
- 	    // Deliberately ignore IOException.  showStatus may be
- 	    // called from threads other than the main thread after
- 	    // streamhandler.pluginOutputStream has been closed.
- 	}
-     }
-     
-     public long getWindow() {
-    	 PluginDebug.debug ("STARTING getWindow");
-    	 PluginCallRequest request = requestFactory.getPluginCallRequest("window",
-    			 							"instance " + identifier + " " + "GetWindow", 
-    			 							"JavaScriptGetWindow");
-    	 PluginDebug.debug ("STARTING postCallRequest");
-		 streamhandler.postCallRequest(request);
-    	 PluginDebug.debug ("STARTING postCallRequest done");
-    	 streamhandler.write(request.getMessage());
-    	 try {
-    		 PluginDebug.debug ("wait request 1");
-    		 synchronized(request) {
-    			 PluginDebug.debug ("wait request 2 " + status.get(identifier) );
-    			 while ((Long) request.getObject() == 0 && (status.get(identifier).equals(PAV_INIT_STATUS.ACTIVE) || status.get(identifier).equals(PAV_INIT_STATUS.PRE_INIT)))
-    				 request.wait();
-    			 PluginDebug.debug ("wait request 3");
-    		 }
-    	 } catch (InterruptedException e) {
-    		 throw new RuntimeException("Interrupted waiting for call request.",
-    				 e);
-    	 }
-
-    	 PluginDebug.debug ("STARTING getWindow DONE");
-    	 return (Long) request.getObject();
-     }
- 
-     // FIXME: make private, access via reflection.
-     public static Object getMember(long internal, String name)
-     {
-    	 AppletSecurityContextManager.getSecurityContext(0).store(name);
-         int nameID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(name);
- 
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("member", 
-        		 							"instance " + 0 + " GetMember " + internal + " " + nameID, 
-        		 							"JavaScriptGetMember");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait getMEM request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait getMEM request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait getMEM request 3 GOT: " + request.getObject().getClass());
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" getMember DONE");
-         return request.getObject();
-     }
- 
-     public static void setMember(long internal, String name, Object value) {
-    	 AppletSecurityContextManager.getSecurityContext(0).store(name);
-         int nameID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(name);
-         AppletSecurityContextManager.getSecurityContext(0).store(value);
-         int valueID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(value);
- 
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("void",
-        		 							"instance " + 0 + " SetMember " + internal + " " + nameID + " " + valueID, 
-        		 							"JavaScriptSetMember");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait setMem request: " + request.getMessage());
-             PluginDebug.debug ("wait setMem request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait setMem request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait setMem request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" setMember DONE");
-     }
- 
-     // FIXME: handle long index as well.
-     public static void setSlot(long internal, int index, Object value) {
-    	 AppletSecurityContextManager.getSecurityContext(0).store(value);
-         int valueID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(value);
- 
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("void",
-        		 						"instance " + 0 + " SetSlot " + internal + " " + index + " " + valueID, 
-        		 						"JavaScriptSetSlot");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait setSlot request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait setSlot request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait setSlot request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" setSlot DONE");
-     }
- 
-     public static Object getSlot(long internal, int index)
-     {
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("member", 
-        		 								"instance " + 0 + " GetSlot " + internal + " " + index, 
-        		 								"JavaScriptGetSlot");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait getSlot request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait getSlot request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait getSlot request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" getSlot DONE");
-         return request.getObject();
-     }
- 
-     public static Object eval(long internal, String s)
-     {
-    	 AppletSecurityContextManager.getSecurityContext(0).store(s);
-         int stringID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(s);
-         // Prefix with dummy instance for convenience.
-         // FIXME: rename GetMemberPluginCallRequest ObjectPluginCallRequest.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("member",	
-        		 								"instance " + 0 + " Eval " + internal + " " + stringID, 
-        		 								"JavaScriptEval");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait eval request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait eval request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait eval request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" getSlot DONE");
-         return request.getObject();
-     }
- 
-     public static void removeMember (long internal, String name) {
-    	 AppletSecurityContextManager.getSecurityContext(0).store(name);
-         int nameID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(name);
- 
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("void",
-        		 						"instance " + 0 + " RemoveMember " + internal + " " + nameID, 
-        		 						"JavaScriptRemoveMember");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait removeMember request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait removeMember request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait removeMember request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" RemoveMember DONE");
-     }
- 
-     public static Object call(long internal, String name, Object args[])
-     {
-         // FIXME: when is this removed from the object store?
-         // FIXME: reference should return the ID.
-         // FIXME: convenience method for this long line.
-    	 AppletSecurityContextManager.getSecurityContext(0).store(name);
-         int nameID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(name);
-         AppletSecurityContextManager.getSecurityContext(0).store(args);
-         int argsID = AppletSecurityContextManager.getSecurityContext(0).getIdentifier(args);
- 
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("member",
-        		 							"instance " + 0 + " Call " + internal + " " + nameID + " " + argsID, 
-        		 							"JavaScriptCall");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait call request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait call request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait call request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" Call DONE");
-         return request.getObject();
-     }
- 
-     public static Object requestPluginCookieInfo(URI uri) {
-
-         PluginCallRequest request;
-         try
-         {
-             String encodedURI = UrlUtil.encode(uri.toString(), "UTF-8"); 
-             request = requestFactory.getPluginCallRequest("cookieinfo",
-                               "plugin PluginCookieInfo " + encodedURI, 
-                               "plugin PluginCookieInfo " + encodedURI);
-
-         } catch (UnsupportedEncodingException e)
-         {
-             e.printStackTrace();
-             return null;
-         }
-
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait cookieinfo request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait cookieinfo request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait cookieinfo request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for cookieinfo request.",
-                                        e);
-         }
-         PluginDebug.debug (" Cookieinfo DONE");
-         return request.getObject();
-     }
-
-     public static Object requestPluginProxyInfo(URI uri) {
-
-         String requestURI = null;
-
-         try {
-
-             // there is no easy way to get SOCKS proxy info. So, we tell mozilla that we want proxy for 
-             // an HTTP uri in case of non http/ftp protocols. If we get back a SOCKS proxy, we can 
-             // use that, if we get back an http proxy, we fallback to DIRECT connect
-
-             String scheme = uri.getScheme();
-             String port = uri.getPort() != -1 ? ":" + uri.getPort() : ""; 
-             if (!uri.getScheme().startsWith("http") && !uri.getScheme().equals("ftp"))
-                 scheme = "http";
-
-             requestURI = UrlUtil.encode(scheme + "://" + uri.getHost() + port + "/" + uri.getPath(), "UTF-8");
-         } catch (Exception e) {
-             PluginDebug.debug("Cannot construct URL from " + uri.toString() + " ... falling back to DIRECT proxy");
-             e.printStackTrace();
-             return null;
-         }
-
-         PluginCallRequest request = requestFactory.getPluginCallRequest("proxyinfo",
-                                            "plugin PluginProxyInfo " + requestURI, 
-                                            "plugin");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait call request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait call request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait call request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" Call DONE");
-         return request.getObject();
-     }
-     
-     public static void JavaScriptFinalize(long internal)
-     {
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("void",
-        		 						"instance " + 0 + " Finalize " + internal, 
-        		 						"JavaScriptFinalize");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait finalize request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait finalize request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait finalize request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" finalize DONE");
-     }
- 
-     public static String javascriptToString(long internal)
-     {
-         // Prefix with dummy instance for convenience.
-         PluginCallRequest request = requestFactory.getPluginCallRequest("member",
-        		 								"instance " + 0 + " ToString " + internal, 
-        		 								"JavaScriptToString");
-         streamhandler.postCallRequest(request);
-         streamhandler.write(request.getMessage());
-         try {
-             PluginDebug.debug ("wait ToString request 1");
-             synchronized(request) {
-                 PluginDebug.debug ("wait ToString request 2");
-                 while (request.isDone() == false)
-                     request.wait();
-                 PluginDebug.debug ("wait ToString request 3");
-             }
-         } catch (InterruptedException e) {
-             throw new RuntimeException("Interrupted waiting for call request.",
-                                        e);
-         }
-         PluginDebug.debug (" ToString DONE");
-         return (String) request.getObject();
-     }
- 
-     // FIXME: make this private and access it from JSObject using
-     // reflection.
-     private void write(String message) throws IOException {
-         PluginDebug.debug ("WRITING 2: " + "instance " + identifier + " " + message);
-         streamhandler.write("instance " + identifier + " " + message);
-         PluginDebug.debug ("WRITING 2 DONE");
-     }
-
-     public void setStream(String key, InputStream stream)throws IOException{
- 	// We do nothing.
-     }
- 
-     public InputStream getStream(String key){
- 	// We do nothing.
- 	return null;
-     }
- 
-     public Iterator getStreamKeys(){
- 	// We do nothing.
- 	return null;
-     }
- 
-     /**
-      * System parameters.
-      */
-     static Hashtable systemParam = new Hashtable();
- 
-     static {
- 	systemParam.put("codebase", "codebase");
- 	systemParam.put("code", "code");
- 	systemParam.put("alt", "alt");
- 	systemParam.put("width", "width");
- 	systemParam.put("height", "height");
- 	systemParam.put("align", "align");
- 	systemParam.put("vspace", "vspace");
- 	systemParam.put("hspace", "hspace");
-     }
- 
-     /**
-      * Print the HTML tag.
-      */
-     public static void printTag(PrintStream out, Hashtable atts) {
- 	out.print("<applet");
- 
- 	String v = (String)atts.get("codebase");
- 	if (v != null) {
- 	    out.print(" codebase=\"" + v + "\"");
- 	}
- 
- 	v = (String)atts.get("code");
- 	if (v == null) {
- 	    v = "applet.class";
- 	}
- 	out.print(" code=\"" + v + "\"");
- 	v = (String)atts.get("width");
- 	if (v == null) {
- 	    v = "150";
- 	}
- 	out.print(" width=" + v);
- 
- 	v = (String)atts.get("height");
- 	if (v == null) {
- 	    v = "100";
- 	}
- 	out.print(" height=" + v);
- 
- 	v = (String)atts.get("name");
- 	if (v != null) {
- 	    out.print(" name=\"" + v + "\"");
- 	}
- 	out.println(">");
- 
- 	// A very slow sorting algorithm
- 	int len = atts.size();
- 	String params[] = new String[len];
- 	len = 0;
- 	for (Enumeration e = atts.keys() ; e.hasMoreElements() ;) {
- 	    String param = (String)e.nextElement();
- 	    int i = 0;
- 	    for (; i < len ; i++) {
- 		if (params[i].compareTo(param) >= 0) {
- 		    break;
- 		}
- 	    }
- 	    System.arraycopy(params, i, params, i + 1, len - i);
- 	    params[i] = param;
- 	    len++;
- 	}
- 
- 	for (int i = 0 ; i < len ; i++) {
- 	    String param = params[i];
- 	    if (systemParam.get(param) == null) {
- 		out.println("<param name=" + param +
- 			    " value=\"" + atts.get(param) + "\">");
- 	    }
- 	}
- 	out.println("</applet>");
-     }
- 
-     /**
-      * Make sure the atrributes are uptodate.
-      */
-     public void updateAtts() {
- 	Dimension d = panel.size();
- 	Insets in = panel.insets();
- 	panel.atts.put("width",
- 		       new Integer(d.width - (in.left + in.right)).toString());
- 	panel.atts.put("height",
- 		       new Integer(d.height - (in.top + in.bottom)).toString());
-     }
- 
-     /**
-      * Restart the applet.
-      */
-     void appletRestart() {
- 	panel.sendEvent(AppletPanel.APPLET_STOP);
- 	panel.sendEvent(AppletPanel.APPLET_DESTROY);
- 	panel.sendEvent(AppletPanel.APPLET_INIT);
- 	panel.sendEvent(AppletPanel.APPLET_START);
-     }
- 
-     /**
-      * Reload the applet.
-      */
-     void appletReload() {
- 	panel.sendEvent(AppletPanel.APPLET_STOP);
- 	panel.sendEvent(AppletPanel.APPLET_DESTROY);
- 	panel.sendEvent(AppletPanel.APPLET_DISPOSE);
- 
- 	/**
- 	 * Fixed #4501142: Classlaoder sharing policy doesn't 
- 	 * take "archive" into account. This will be overridden
- 	 * by Java Plug-in.			[stanleyh]
- 	 */
- 	AppletPanel.flushClassLoader(panel.getClassLoaderCacheKey());
- 
-         /*
-          * Make sure we don't have two threads running through the event queue
-          * at the same time.
-          */
-         try {
-             panel.joinAppletThread();
- 	    panel.release();
-         } catch (InterruptedException e) {
-             return;   // abort the reload
-         }
- 
-         AccessController.doPrivileged(new PrivilegedAction() {
-             public Object run() {
-            	 panel.createAppletThread();
-                 return null;
-             }
-         });     
-    
- 	panel.sendEvent(AppletPanel.APPLET_LOAD);
- 	panel.sendEvent(AppletPanel.APPLET_INIT);
- 	panel.sendEvent(AppletPanel.APPLET_START);
-     }
- 
-     public int print(Graphics graphics, PageFormat pf, int pageIndex) {
-         return Printable.NO_SUCH_PAGE;
-     }
- 
-     /**
-      * Start the applet.
-      */
-     void appletStart() {
- 	panel.sendEvent(AppletPanel.APPLET_START);
-     }
- 
-     /**
-      * Stop the applet.
-      */
-     void appletStop() {
- 	panel.sendEvent(AppletPanel.APPLET_STOP);
-     }
- 
-     /**
-      * Shutdown a viewer.
-      * Stop, Destroy, Dispose and Quit a viewer
-      */
-     private void appletShutdown(AppletPanel p) {
- 	p.sendEvent(AppletPanel.APPLET_STOP);
- 	p.sendEvent(AppletPanel.APPLET_DESTROY);
- 	p.sendEvent(AppletPanel.APPLET_DISPOSE);
- 	p.sendEvent(AppletPanel.APPLET_QUIT);
-     }
- 
-     /**
-      * Close this viewer.
-      * Stop, Destroy, Dispose and Quit an AppletView, then
-      * reclaim resources and exit the program if this is
-      * the last applet.
-      */
-     void appletClose() {
-
-         // The caller thread is event dispatch thread, so
-         // spawn a new thread to avoid blocking the event queue
-         // when calling appletShutdown.
-         //
-         final AppletPanel p = panel;
-
-         new Thread(new Runnable()
-         {
-             public void run()
-             {
-                 appletShutdown(p);
-                 appletPanels.removeElement(p);
-                 dispose();
-
-                 if (countApplets() == 0) {
-                     appletSystemExit();
-                 }
-             }
-         }).start();
-
-         status.put(identifier, PAV_INIT_STATUS.INACTIVE);
-     }
- 
-     /**
-      * Exit the program.
-      * Exit from the program (if not stand alone) - do no clean-up
-      */
-     private void appletSystemExit() {
- 	if (factory.isStandalone())
- 	    System.exit(0);
-     }
- 
-     /**
-      * How many applets are running?
-      */
- 
-     public static int countApplets() {
- 	return appletPanels.size();
-     }
- 
- 
-     /**
-      * The current character.
-      */
-     static int c;
- 
-     /**
-      * Scan spaces.
-      */
-     public static void skipSpace(Reader in) throws IOException {
-         while ((c >= 0) &&
- 	       ((c == ' ') || (c == '\t') || (c == '\n') || (c == '\r'))) {
- 	    c = in.read();
- 	}
-     }
- 
-     /**
-      * Scan identifier
-      */
-     public static String scanIdentifier(Reader in) throws IOException {
- 	StringBuffer buf = new StringBuffer();
- 	
- 	if (c == '!') {
-        // Technically, we should be scanning for '!--' but we are reading 
-        // from a stream, and there is no way to peek ahead. That said, 
-        // a ! at this point can only mean comment here afaik, so we 
-        // should be okay
-        skipComment(in);
-        return "";
-    }
- 	
- 	while (true) {
- 	    if (((c >= 'a') && (c <= 'z')) ||
- 		((c >= 'A') && (c <= 'Z')) ||
- 		((c >= '0') && (c <= '9')) || (c == '_')) {
- 		buf.append((char)c);
- 		c = in.read();
- 	    } else {
- 		return buf.toString();
- 	    }
- 	}
-     }
-
-     public static void skipComment(Reader in) throws IOException {
-         StringBuffer buf = new StringBuffer();
-         boolean commentHeaderPassed = false;
-         c = in.read();
-         buf.append((char)c);
-
-         while (true) {
-             if (c == '-' && (c = in.read()) == '-') {
-                 buf.append((char)c);
-                 if (commentHeaderPassed) {
-                     // -- encountered ... is > next?
-                     if ((c = in.read()) == '>') {
-                         buf.append((char)c);
-
-                         PluginDebug.debug("Comment skipped: " + buf.toString());
-
-                         // comment skipped.
-                         return;
-                     }
-                 } else {
-                     // first -- is part of <!-- ... , just mark that we have passed it
-                     commentHeaderPassed = true;
-                 }
-
-             } else if (commentHeaderPassed == false) {
-                 buf.append((char)c);
-                 PluginDebug.debug("Warning: Attempted to skip comment, but this tag does not appear to be a comment: " + buf.toString());
-                 return;
-             }
-
-             c = in.read();
-             buf.append((char)c);
-         }
-     }
- 
-     /**
-      * Scan tag
-      */
-     public static Hashtable scanTag(Reader in) throws IOException {
- 	Hashtable atts = new Hashtable();
- 	skipSpace(in);
-         while (c >= 0 && c != '>') {
- 	    String att = scanIdentifier(in);
- 	    String val = "";
- 	    skipSpace(in);
- 	    if (c == '=') {
- 		int quote = -1;
- 		c = in.read();
- 		skipSpace(in);
- 		if ((c == '\'') || (c == '\"')) {
- 		    quote = c;
- 		    c = in.read();
- 		}
- 		StringBuffer buf = new StringBuffer();
-                 while ((c > 0) &&
- 		       (((quote < 0) && (c != ' ') && (c != '\t') &&
-                          (c != '\n') && (c != '\r') && (c != '>'))
- 			|| ((quote >= 0) && (c != quote)))) {
- 		    buf.append((char)c);
- 		    c = in.read();
- 		}
- 		if (c == quote) {
- 		    c = in.read();
- 		}
- 		skipSpace(in);
- 		val = buf.toString();
- 	    }
-
-        att = att.replace("&gt;", ">");
-        att = att.replace("&lt;", "<");
-        att = att.replace("&amp;", "&");
-        att = att.replace("&#10;", "\n");
-        att = att.replace("&#13;", "\r");
- 	    
-        val = val.replace("&gt;", ">");
-        val = val.replace("&lt;", "<");
-        val = val.replace("&amp;", "&");
-        val = val.replace("&#10;", "\n");
-        val = val.replace("&#13;", "\r");
-
-        PluginDebug.debug("PUT " + att + " = '" + val + "'");
-        atts.put(att.toLowerCase(java.util.Locale.ENGLISH), val);
-
-             while (true) {
-                 if ((c == '>') || (c < 0) ||
-                     ((c >= 'a') && (c <= 'z')) ||
-                     ((c >= 'A') && (c <= 'Z')) ||
-                     ((c >= '0') && (c <= '9')) || (c == '_'))
-                     break;
-                 c = in.read();
-             }
-             //skipSpace(in);
- 	}
- 	return atts;
-     }
-     
-     // private static final == inline
-     private static final boolean isInt(Object o) {
-         boolean isInt = false;
-
-         try {
-             Integer.parseInt((String) o);
-             isInt = true;
-         } catch (Exception e) {
-             // don't care
-         }
-
-         return isInt;
-     }
- 
-     /* values used for placement of AppletViewer's frames */
-     private static int x = 0;
-     private static int y = 0;
-     private static final int XDELTA = 30;
-     private static final int YDELTA = XDELTA;
- 
-     static String encoding = null;
- 
-     static private Reader makeReader(InputStream is) {
- 	if (encoding != null) {
- 	    try {
- 		return new BufferedReader(new InputStreamReader(is, encoding));
- 	    } catch (IOException x) { }
- 	}
- 	InputStreamReader r = new InputStreamReader(is);
- 	encoding = r.getEncoding();
- 	return new BufferedReader(r);
-     }
- 
-     /**
-      * Scan an html file for <applet> tags
-      */
-     public static void parse(int identifier, long handle, Reader in, URL url, String enc)
-         throws IOException {
-         encoding = enc;
-         parse(identifier, handle, in, url, System.out, new PluginAppletViewerFactory());
-     }
- 
-     public static void parse(int identifier, long handle, Reader in, URL url)
-         throws IOException {
-         
-    	 final int fIdentifier = identifier;
-    	 final long fHandle = handle;
-    	 final Reader fIn = in;
-    	 final URL fUrl = url;
-    	 PrivilegedAction pa = new PrivilegedAction() {
-    		 public Object run() {
-    			 try {
-    				 parse(fIdentifier, fHandle, fIn, fUrl, System.out, new PluginAppletViewerFactory());
-    			 } catch (IOException ioe) {
-    				 return ioe;
-    			 }
-    	         
-    			 return null;
-    		 }
-    	 };
-
-    	 Object ret = AccessController.doPrivileged(pa);
-    	 if (ret instanceof IOException) {
-    		 throw (IOException) ret;
-    	 }
-     }
- 
-     public static void parse(int identifier, long handle, Reader in, URL url,
-                              PrintStream statusMsgStream,
-                              PluginAppletViewerFactory factory)
-         throws IOException
-     {
-    	 // <OBJECT> <EMBED> tag flags
-    	 boolean isAppletTag = false;
-    	 boolean isObjectTag = false;
-    	 boolean isEmbedTag = false;
-    	 boolean objectTagAlreadyParsed = false;
-
-    	 // warning messages
-    	 String requiresNameWarning = amh.getMessage("parse.warning.requiresname");
-    	 String paramOutsideWarning = amh.getMessage("parse.warning.paramoutside");
-    	 String appletRequiresCodeWarning = amh.getMessage("parse.warning.applet.requirescode");
-    	 String appletRequiresHeightWarning = amh.getMessage("parse.warning.applet.requiresheight");
-    	 String appletRequiresWidthWarning = amh.getMessage("parse.warning.applet.requireswidth");
-    	 String objectRequiresCodeWarning = amh.getMessage("parse.warning.object.requirescode");
-    	 String objectRequiresHeightWarning = amh.getMessage("parse.warning.object.requiresheight");
-    	 String objectRequiresWidthWarning = amh.getMessage("parse.warning.object.requireswidth");
-    	 String embedRequiresCodeWarning = amh.getMessage("parse.warning.embed.requirescode");
-    	 String embedRequiresHeightWarning = amh.getMessage("parse.warning.embed.requiresheight");
-    	 String embedRequiresWidthWarning = amh.getMessage("parse.warning.embed.requireswidth");
-    	 String appNotLongerSupportedWarning = amh.getMessage("parse.warning.appnotLongersupported");
-
-    	 java.net.URLConnection conn = url.openConnection();
-    	 /* The original URL may have been redirected - this
-    	  * sets it to whatever URL/codebase we ended up getting
-    	  */
-    	 url = conn.getURL();
-
-    	 int ydisp = 1;
-    	 Hashtable atts = null;
-
-    	 while(true) {
-    		 c = in.read();
-    		 if (c == -1)
-    			 break;
-
-    		 if (c == '<') {
-    			 c = in.read();
-    			 if (c == '/') {
-    				 c = in.read();
-    				 String nm = scanIdentifier(in);
-    				 if (nm.equalsIgnoreCase("applet") ||
-    						 nm.equalsIgnoreCase("object") ||
-    						 nm.equalsIgnoreCase("embed")) {
-
-    					 // We can't test for a code tag until </OBJECT>
-    					 // because it is a parameter, not an attribute.
-    					 if(isObjectTag) {
-    						 if (atts.get("code") == null && atts.get("object") == null) {
-    							 statusMsgStream.println(objectRequiresCodeWarning);
-    							 atts = null;
-    						 }
-    					 }
-
-    					 if (atts != null) {
-    						 // XXX 5/18 In general this code just simply
-    						 // shouldn't be part of parsing.  It's presence
-    						 // causes things to be a little too much of a
-    						 // hack.
-    						 factory.createAppletViewer(identifier, handle, x, y, url, atts);
-    						 x += XDELTA;
-    						 y += YDELTA;
-    						 // make sure we don't go too far!
-    						 Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
-    						 if ((x > d.width - 300) || (y > d.height - 300)) {
-    							 x = 0;
-    							 y = 2 * ydisp * YDELTA;
-    							 ydisp++;
-    						 }
-    					 }
-    					 atts = null;
-    					 isAppletTag = false;
-    					 isObjectTag = false;
-    					 isEmbedTag = false;
-    				 }
-    			 }
-    			 else {
-    				 String nm = scanIdentifier(in);
-    				 if (nm.equalsIgnoreCase("param")) {
-    					 Hashtable t = scanTag(in);
-    					 String att = (String)t.get("name");
-    					 
-    					 if (atts.containsKey(att))
-    					     continue;
-
-    					 if (att == null) {
-    						 statusMsgStream.println(requiresNameWarning);
-    					 } else {
-    						 String val = (String)t.get("value");
-    						 if (val == null) {
-    							 statusMsgStream.println(requiresNameWarning);
-    						 } else if (atts != null) {
-    							 att = att.replace("&gt;", ">");
-    							 att = att.replace("&lt;", "<");
-    							 att = att.replace("&amp;", "&");
-    							 att = att.replace("&#10;", "\n");
-    							 att = att.replace("&#13;", "\r");
-    							 att = att.replace("&quot;", "\"");
-
-    							 val = val.replace("&gt;", ">");
-    							 val = val.replace("&lt;", "<");
-    							 val = val.replace("&amp;", "&");
-    							 val = val.replace("&#10;", "\n");
-    							 val = val.replace("&#13;", "\r");
-    							 val = val.replace("&quot;", "\"");
-    							 PluginDebug.debug("PUT " + att + " = " + val);
-   							     atts.put(att.toLowerCase(), val);
-    						 } else {
-    							 statusMsgStream.println(paramOutsideWarning);
-    						 }
-    					 }
-    				 }
-    				 else if (nm.equalsIgnoreCase("applet")) {
-    					 isAppletTag = true;
-    					 atts = scanTag(in);
-
-                         // If there is a classid and no code tag present, transform it to code tag
-                         if (atts.get("code") == null && atts.get("classid") != null && !((String) atts.get("classid")).startsWith("clsid:")) {
-                             atts.put("code", atts.get("classid"));
-                         }
-                         
-                         // remove java: from code tag
-                         if (atts.get("code") != null && ((String) atts.get("code")).startsWith("java:")) {
-                             atts.put("code", ((String) atts.get("code")).substring(5));
-                         }
-
-    					 if (atts.get("code") == null && atts.get("object") == null) {
-    						 statusMsgStream.println(appletRequiresCodeWarning);
-    						 atts = null;
-    					 }
-
-    					 if (atts.get("width") == null || !isInt(atts.get("width"))) {
-    						 atts.put("width", "1000");
-    						 atts.put("widthPercentage", 100);
-    					 } else if (((String) atts.get("width")).endsWith("%")) {
-    						 String w = (String) atts.get("width");
-    						 atts.put("width", "1000");
-    						 atts.put("widthPercentage", Integer.parseInt((w.substring(0,  w.length() -1))));
-    					  }
-
-    					 if (atts.get("height") == null || !isInt(atts.get("height"))) {
-    						 atts.put("height", "1000");
-    						 atts.put("heightPercentage", 100);
-    					 } else if (((String) atts.get("height")).endsWith("%")) {
-    						 String h = (String) atts.get("height");
-    						 atts.put("height", "1000");
-    						 atts.put("heightPercentage", Integer.parseInt(h.substring(0,  h.length() -1)));
-    					 }
-    				 }
-    				 else if (nm.equalsIgnoreCase("object")) {
-    					 isObjectTag = true;
-
-    				     // Once code is set, additional nested objects are ignored
-    				     if (!objectTagAlreadyParsed) {
-    				         objectTagAlreadyParsed = true;
-    				         atts = scanTag(in);
-    				     }
-
-    				     // If there is a classid and no code tag present, transform it to code tag
-    				     if (atts.get("code") == null && atts.get("classid") != null && !((String) atts.get("classid")).startsWith("clsid:")) {
-    				         atts.put("code", atts.get("classid"));
-    				     }
-                        
-                         // remove java: from code tag
-                         if (atts.get("code") != null && ((String) atts.get("code")).startsWith("java:")) {
-                             atts.put("code", ((String) atts.get("code")).substring(5));
-                         }
-
-                         // java_* aliases override older names:
-                         // http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html#in-ie
-                         if (atts.get("java_code") != null) {
-                             atts.put("code", ((String) atts.get("java_code")));
-                         }
-
-                         if (atts.containsKey("code")) {
-                             objectTagAlreadyParsed = true;
-                         }
-
-                         if (atts.get("java_codebase") != null) {
-                             atts.put("codebase", ((String) atts.get("java_codebase")));
-                         }
-
-                         if (atts.get("java_archive") != null) {
-                             atts.put("archive", ((String) atts.get("java_archive")));
-                         }
-
-                         if (atts.get("java_object") != null) {
-                             atts.put("object", ((String) atts.get("java_object")));
-                         }
-
-                         if (atts.get("java_type") != null) {
-                             atts.put("type", ((String) atts.get("java_type")));
-                         }
-
-    					 if (atts.get("width") == null || !isInt(atts.get("width"))) {
-    						 atts.put("width", "1000");
-    						 atts.put("widthPercentage", 100);
-    					 } else if (((String) atts.get("width")).endsWith("%")) {
-    						 String w = (String) atts.get("width");
-    						 atts.put("width", "1000");
-    						 atts.put("widthPercentage", Integer.parseInt(w.substring(0,  w.length() -1)));
-    					 }
-
-    					 if (atts.get("height") == null || !isInt(atts.get("height"))) {
-    						 atts.put("height", "1000");
-    						 atts.put("heightPercentage", 100);
-    					 } else if (((String) atts.get("height")).endsWith("%")) {
-    						 String h = (String) atts.get("height");
-    						 atts.put("height", "1000");
-    						 atts.put("heightPercentage", Integer.parseInt(h.substring(0,  h.length() -1)));
-    					 }
-    				 }
-    				 else if (nm.equalsIgnoreCase("embed")) {
-    					 isEmbedTag = true;
-    					 atts = scanTag(in);
-
-                         // If there is a classid and no code tag present, transform it to code tag
-                         if (atts.get("code") == null && atts.get("classid") != null && !((String) atts.get("classid")).startsWith("clsid:")) {
-                             atts.put("code", atts.get("classid"));
-                         }
-                         
-                         // remove java: from code tag
-                         if (atts.get("code") != null && ((String) atts.get("code")).startsWith("java:")) {
-                             atts.put("code", ((String) atts.get("code")).substring(5));
-                         }
-    					 
-    					 // java_* aliases override older names:
-    					 // http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html#in-nav
-    					 if (atts.get("java_code") != null) {
-    					     atts.put("code", ((String) atts.get("java_code")));
-    					 }
-    					 
-                         if (atts.get("java_codebase") != null) {
-                             atts.put("codebase", ((String) atts.get("java_codebase")));
-                         }
-                         
-                         if (atts.get("java_archive") != null) {
-                             atts.put("archive", ((String) atts.get("java_archive")));
-                         }
-                         
-                         if (atts.get("java_object") != null) {
-                             atts.put("object", ((String) atts.get("java_object")));
-                         }
-    					 
-                         if (atts.get("java_type") != null) {
-                             atts.put("type", ((String) atts.get("java_type")));
-                         }
-
-    					 if (atts.get("code") == null && atts.get("object") == null) {
-    						 statusMsgStream.println(embedRequiresCodeWarning);
-    						 atts = null;
-    					 }
-    					 
-    					 if (atts.get("width") == null || !isInt(atts.get("width"))) {
-    						 atts.put("width", "1000");
-    						 atts.put("widthPercentage", 100);
-    					 } else if (((String) atts.get("width")).endsWith("%")) {
-    						 String w = (String) atts.get("width");
-    						 atts.put("width", "100");
-    						 atts.put("widthPercentage", Integer.parseInt(w.substring(0,  w.length() -1)));
-    					 }
-
-    					 if (atts.get("height") == null || !isInt(atts.get("height"))) {
-    						 atts.put("height", "1000");
-    						 atts.put("heightPercentage", 100);
-    					 } else if (((String) atts.get("height")).endsWith("%")) {
-    						 String h = (String) atts.get("height");
-    						 atts.put("height", "100");
-    						 atts.put("heightPercentage", Integer.parseInt(h.substring(0,  h.length() -1)));
-    					 }
-    				 }
-    				 else if (nm.equalsIgnoreCase("app")) {
-    					 statusMsgStream.println(appNotLongerSupportedWarning);
-    					 Hashtable atts2 = scanTag(in);
-    					 nm = (String)atts2.get("class");
-    					 if (nm != null) {
-    						 atts2.remove("class");
-    						 atts2.put("code", nm + ".class");
-    					 }
-    					 nm = (String)atts2.get("src");
-    					 if (nm != null) {
-    						 atts2.remove("src");
-    						 atts2.put("codebase", nm);
-    					 }
-    					 if (atts2.get("width") == null || !isInt(atts2.get("width"))) {
-    						 atts2.put("width", "1000");
-    						 atts2.put("widthPercentage", 100);
-    					 } else if (((String) atts.get("width")).endsWith("%")) {
-    						 String w = (String) atts.get("width");
-    						 atts2.put("width", "100");
-    						 atts2.put("widthPercentage", Integer.parseInt(w.substring(0,  w.length() -1)));
-    					 }
-
-    					 if (atts2.get("height") == null || !isInt(atts2.get("height"))) {
-    						 atts2.put("height", "1000");
-    						 atts2.put("heightPercentage", 100);
-    					 } else if (((String) atts.get("height")).endsWith("%")) {
-    						 String h = (String) atts.get("height");
-    						 atts2.put("height", "100");
-    						 atts2.put("heightPercentage", Integer.parseInt(h.substring(0,  h.length() -1)));
-    					 }
-
-    					 printTag(statusMsgStream, atts2);
-    					 statusMsgStream.println();
-    				 }
-    			 }
-    		 }
-    	 }
-    	 in.close();
-     }
- 
-
-     private static AppletMessageHandler amh = new AppletMessageHandler("appletviewer");
- 
-     private static void checkConnect(URL url)
-     {
- 	SecurityManager security = System.getSecurityManager();
- 	if (security != null) {
- 	    try {
- 		java.security.Permission perm =
- 		    url.openConnection().getPermission();
- 		if (perm != null)
- 		    security.checkPermission(perm);
- 		else
- 		    security.checkConnect(url.getHost(), url.getPort());
- 	    } catch (java.io.IOException ioe) {
- 		    security.checkConnect(url.getHost(), url.getPort());
- 	    }
- 	}
-     }
- }
--- a/plugin/icedtea/sun/applet/PluginCallRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* PluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.security.AccessControlContext;
-import java.security.ProtectionDomain;
-
-// FIXME: for each type of request extend a new (anonymous?)
-// PluginCallRequest.
-public abstract class PluginCallRequest {
-    String message;
-    String returnString;
-    PluginCallRequest next;
-    boolean done = false;
-
-    public PluginCallRequest(String message, String returnString) {
-        this.message = message;
-        this.returnString = returnString;
-    }
-
-    public String getMessage() {
-    	return this.message;
-    }
-    
-    public String getReturnString() {
-    	return this.returnString;
-    }
-    
-    public boolean isDone() {
-    	return this.done;
-    }
-    
-    public boolean setDone(boolean done) {
-    	return this.done = done;
-    }
-    
-    public void setNext(PluginCallRequest next) {
-    	this.next = next;
-    }
-    
-    public PluginCallRequest getNext() {
-    	return this.next;
-    }
-
-    public abstract void parseReturn(String message);
-    
-    public abstract boolean serviceable(String message);
-    
-    public abstract Object getObject();
-}
--- a/plugin/icedtea/sun/applet/PluginCallRequestFactory.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-public class PluginCallRequestFactory {
-
-	public PluginCallRequest getPluginCallRequest(String id, String message, String returnString) {
-
-		if (id == "member") {
-			return new GetMemberPluginCallRequest(message, returnString);
-		} else if (id == "void") {
-			return new VoidPluginCallRequest(message, returnString);
-		} else if (id == "window") {
-			return new GetWindowPluginCallRequest(message, returnString);
-		} else if (id == "proxyinfo") {
-            return new PluginProxyInfoRequest(message, returnString);
-        }  else if (id == "cookieinfo") {
-            return new PluginCookieInfoRequest(message, returnString);
-        } else {
-			throw new RuntimeException ("Unknown plugin call request type requested from factory");
-		}
-		
-	}
-
-}
--- a/plugin/icedtea/sun/applet/PluginClassLoader.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-public class PluginClassLoader extends ClassLoader {
-
-	public PluginClassLoader() {
-		super();
-	}
-
-	public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-		return super.loadClass(name, resolve);
-	}
-	
-}
--- a/plugin/icedtea/sun/applet/PluginCookieInfoRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/* PluginCookieInfoRequest -- Object representing a request for cookie information from the browser
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-/**
- * This class represents a request object for cookie information for a given URI
- */
-
-public class PluginCookieInfoRequest extends PluginCallRequest {
-
-    String cookieString = new String();
-
-    public PluginCookieInfoRequest(String message, String returnString) {
-        super(message, returnString);
-    }
-    
-    public void parseReturn(String cookieInfo) {
-
-        // try to parse the proxy information. If things go wrong, do nothing .. 
-        // this will keep internal = null which forces a direct connection
-
-    	PluginDebug.debug ("PluginCookieInfoRequest GOT: " + cookieInfo);
-
-    	// Skip the first 3 components. We are guaranteed 3 components, 
-    	// so no index -1 to worry about
-    	cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1);
-    	cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ')+1);
-    	cookieString = cookieInfo.substring(cookieInfo.indexOf(' ')+1);
-
-        setDone(true);
-    }
-
-    /**
-     * Returns whether the given message is serviceable by this object
-     * 
-     * @param message The message to service
-     * @return boolean indicating if message is serviceable
-     */
-    public boolean serviceable(String message) {
-    	return message.startsWith(returnString);
-    }
-
-    public String getObject() {
-    	return this.cookieString;
-    }
-}
--- a/plugin/icedtea/sun/applet/PluginCookieManager.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/* PluginCookieManager -- Cookie manager for the plugin
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.io.IOException;
-import java.net.CookieManager;
-import java.net.HttpCookie;
-import java.net.URI;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-public class PluginCookieManager extends CookieManager 
-{
-    public Map<String, List<String>> get(URI uri,
-			Map<String, List<String>> requestHeaders) throws IOException {
-		// pre-condition check
-		if (uri == null || requestHeaders == null) {
-			throw new IllegalArgumentException("Argument is null");
-		}
-
-		Map<String, List<String>> cookieMap = new java.util.HashMap<String, List<String>>();
-
-		String cookies = (String) PluginAppletViewer
-				.requestPluginCookieInfo(uri);
-		List<String> cookieHeader = new java.util.ArrayList<String>();
-
-		if (cookies != null && cookies.length() > 0)
-			cookieHeader.add(cookies);
-		
-		// Add anything else that mozilla didn't add
-        for (HttpCookie cookie : getCookieStore().get(uri)) {
-            // apply path-matches rule (RFC 2965 sec. 3.3.4)
-            if (pathMatches(uri.getPath(), cookie.getPath())) {
-            	cookieHeader.add(cookie.toString());
-            }
-        }
-
-		cookieMap.put("Cookie", cookieHeader);
-		return Collections.unmodifiableMap(cookieMap);
-	}
-
-    private boolean pathMatches(String path, String pathToMatchWith) {
-        if (path == pathToMatchWith)
-            return true;
-        if (path == null || pathToMatchWith == null)
-            return false;
-        if (path.startsWith(pathToMatchWith))
-            return true;
-
-        return false;
-    }
-}
--- a/plugin/icedtea/sun/applet/PluginDebug.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.io.*;
-
-public class PluginDebug {
-
-	static final boolean DEBUG = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG"); 
-
-    public static void debug(String message) {
-    	if (DEBUG)
-    		System.err.println(message);
-	}
-}
--- a/plugin/icedtea/sun/applet/PluginException.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-public class PluginException extends Exception {
-
-	public PluginException (PluginStreamHandler sh, int instance, int reference, Throwable t) {
-		t.printStackTrace();
-		this.setStackTrace(t.getStackTrace());
-		
-		AppletSecurityContextManager.dumpStore(0);
-
-		String message = "instance " + instance + " reference " + reference + " Error " + t.getMessage();
-		sh.write(message);
-	}
-}
--- a/plugin/icedtea/sun/applet/PluginMain.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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. */
-
-/*
- * Copyright 1999-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 sun.applet;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.Authenticator;
-import java.net.CookieHandler;
-import java.net.CookieManager;
-import java.net.PasswordAuthentication;
-import java.net.ProxySelector;
-import java.util.Enumeration;
-import java.util.Properties;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-
-import net.sourceforge.jnlp.security.VariableX509TrustManager;
-
-/**
- * The main entry point into PluginAppletViewer.
- */
-public class PluginMain
-{
-
-    // the files where stdout/stderr are sent to
-    public static final String PLUGIN_STDERR_FILE = System.getProperty("user.home") + "/.icedteaplugin/java.stderr";
-    public static final String PLUGIN_STDOUT_FILE = System.getProperty("user.home") + "/.icedteaplugin/java.stdout";
-
-	final boolean redirectStreams = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG");
-	static PluginStreamHandler streamHandler;
-	
-    // This is used in init().	Getting rid of this is desirable but depends
-    // on whether the property that uses it is necessary/standard.
-    public static final String theVersion = System.getProperty("java.version");
-    
-    private PluginAppletSecurityContext securityContext;
-
-    /**
-     * The main entry point into AppletViewer.
-     */
-    public static void main(String args[])
-	throws IOException
-    {
-
-    	try {
-    		PluginMain pm = new PluginMain(System.getProperty("user.home") + "/.icedteaplugin/icedtea-plugin-to-appletviewer", System.getProperty("user.home") + "/.icedteaplugin/icedtea-appletviewer-to-plugin");
-    	} catch (Exception e) {
-    		e.printStackTrace();
-    		System.err.println("Something very bad happened. I don't know what to do, so I am going to exit :(");
-    		System.exit(1);
-    	}
-    }
-
-    public PluginMain(String inPipe, String outPipe) {
-    	
-    	try {
-    		File errFile = new File(PLUGIN_STDERR_FILE);
-    		File outFile = new File(PLUGIN_STDOUT_FILE);
-
-    		System.setErr(new TeeOutputStream(new FileOutputStream(errFile), System.err));
-    		System.setOut(new TeeOutputStream(new FileOutputStream(outFile), System.out));
-    	} catch (Exception e) {
-    		PluginDebug.debug("Unable to redirect streams");
-    		e.printStackTrace();
-    	}
-
-    	connect(inPipe, outPipe);
-
-    	securityContext = new PluginAppletSecurityContext(0);
-    	securityContext.prePopulateLCClasses();
-    	securityContext.setStreamhandler(streamHandler);
-    	AppletSecurityContextManager.addContext(0, securityContext);
-
-		PluginAppletViewer.setStreamhandler(streamHandler);
-		PluginAppletViewer.setPluginCallRequestFactory(new PluginCallRequestFactory());
-
-    	init();
-
-		// Streams set. Start processing.
-		streamHandler.startProcessing();
-    }
-
-	public void connect(String inPipe, String outPipe) {
-		try {
-			streamHandler = new PluginStreamHandler(new FileInputStream(inPipe), new FileOutputStream(outPipe));
-	    	PluginDebug.debug("Streams initialized");
-		} catch (IOException ioe) {
-			ioe.printStackTrace();
-		}
-	}
-
-	private static void init() {
-		Properties avProps = new Properties();
-
-		// ADD OTHER RANDOM PROPERTIES
-		// XXX 5/18 need to revisit why these are here, is there some
-		// standard for what is available?
-
-		// Standard browser properties
-		avProps.put("browser", "sun.applet.AppletViewer");
-		avProps.put("browser.version", "1.06");
-		avProps.put("browser.vendor", "Sun Microsystems Inc.");
-		avProps.put("http.agent", "Java(tm) 2 SDK, Standard Edition v" + theVersion);
-
-		// Define which packages can be extended by applets
-		// XXX 5/19 probably not needed, not checked in AppletSecurity
-		avProps.put("package.restrict.definition.java", "true");
-		avProps.put("package.restrict.definition.sun", "true");
-
-		// Define which properties can be read by applets.
-		// A property named by "key" can be read only when its twin
-		// property "key.applet" is true.  The following ten properties
-		// are open by default.	 Any other property can be explicitly
-		// opened up by the browser user by calling appletviewer with
-		// -J-Dkey.applet=true
-		avProps.put("java.version.applet", "true");
-		avProps.put("java.vendor.applet", "true");
-		avProps.put("java.vendor.url.applet", "true");
-		avProps.put("java.class.version.applet", "true");
-		avProps.put("os.name.applet", "true");
-		avProps.put("os.version.applet", "true");
-		avProps.put("os.arch.applet", "true");
-		avProps.put("file.separator.applet", "true");
-		avProps.put("path.separator.applet", "true");
-		avProps.put("line.separator.applet", "true");
-
-		// Read in the System properties.  If something is going to be
-		// over-written, warn about it.
-		Properties sysProps = System.getProperties();
-		for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements(); ) {
-			String key = (String) e.nextElement();
-			String val = (String) sysProps.getProperty(key);
-			avProps.setProperty(key, val);
-		}
-
-		// INSTALL THE PROPERTY LIST
-		System.setProperties(avProps);
-
-
-		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();
-		}
-
-		// plug in a custom authenticator and proxy selector
-        Authenticator.setDefault(new CustomAuthenticator());
-        ProxySelector.setDefault(new PluginProxySelector());
-        
-        CookieManager ckManager = new PluginCookieManager();
-        CookieHandler.setDefault(ckManager);
-	}
-
-    static boolean messageAvailable() {
-    	return streamHandler.messageAvailable();
-    }
-
-    static String getMessage() {
-    	return streamHandler.getMessage();
-    }
-    
-    static class CustomAuthenticator extends Authenticator {
-        
-        public PasswordAuthentication getPasswordAuthentication() {
-
-            // No security check is required here, because the only way to 
-            // set parameters for which auth info is needed 
-            // (Authenticator:requestPasswordAuthentication()), has a security 
-            // check
-
-            String type = this.getRequestorType() == RequestorType.PROXY ? "proxy" : "web"; 
-
-            // request auth info from user
-            PasswordAuthenticationDialog pwDialog = new PasswordAuthenticationDialog();
-            PasswordAuthentication auth = pwDialog.askUser(this.getRequestingHost(), this.getRequestingPort(), this.getRequestingPrompt(), type);
-            
-            // send it along
-            return auth;
-        }
-    }
-
-    /**
-     * Behaves like the 'tee' command, sends output to both actual std stream and a
-     * file
-     */
-    class TeeOutputStream extends PrintStream {
-
-        // Everthing written to TeeOutputStream is written to this file
-        PrintStream logFile;
-
-        public TeeOutputStream(FileOutputStream fileOutputStream,
-                PrintStream stdStream) {
-            super(stdStream);
-            logFile = new PrintStream(fileOutputStream);
-        }
-
-        @Override
-        public boolean checkError() {
-            boolean thisError = super.checkError();
-            boolean fileError = logFile.checkError();
-
-            return thisError || fileError;
-        }
-
-        @Override
-        public void close() {
-            logFile.close();
-            super.close();
-        }
-
-        @Override
-        public void flush() {
-            logFile.flush();
-            super.flush();
-        }
-
-        /*
-         * The big ones: these do the actual writing
-         */
-
-        @Override
-        public void write(byte[] buf, int off, int len) {
-            logFile.write(buf, off, len);
-
-            if (!redirectStreams)
-                super.write(buf, off, len);
-        }
-
-        @Override
-        public void write(int b) {
-            logFile.write(b);
-            
-            if (!redirectStreams)
-                super.write(b);
-        }
-
-        @Override
-        public void write(byte[] b) throws IOException {
-            logFile.write(b);
-            
-            if (!redirectStreams)
-                super.write(b);
-        }
-    }
-    
-}
--- a/plugin/icedtea/sun/applet/PluginMessageConsumer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-
-import sun.applet.AppletSecurity;
-
-class PluginMessageConsumer {
-
-	int MAX_WORKERS = 20;
-	LinkedList<String> readQueue = new LinkedList<String>();
-	ArrayList<PluginMessageHandlerWorker> workers = new ArrayList<PluginMessageHandlerWorker>();
-	PluginStreamHandler streamHandler = null;
-	AppletSecurity as;
-
-	public PluginMessageConsumer(PluginStreamHandler streamHandler) {
-		
-		as = new AppletSecurity();
-		this.streamHandler = streamHandler;
-
-		// create some workers at the start...
-		for (int i=0; i < 3; i++) {
-			PluginDebug.debug("Creating worker " + i);
-			PluginMessageHandlerWorker worker = new PluginMessageHandlerWorker(streamHandler, i, as);
-			worker.start();
-			workers.add(worker);
-		}
-	}
-
-	public void consume(String message) {
-		
-		PluginDebug.debug("Consumer received message " + message);
-		
-		synchronized(readQueue) {
-			readQueue.add(message);
-		}
-
-		PluginDebug.debug("Message " + message + " added to queue. Looking for free worker...");
-		final PluginMessageHandlerWorker worker = getFreeWorker();
-
-		synchronized(readQueue) {
-			if (readQueue.size() > 0) {
-				worker.setmessage(readQueue.poll());
-			}
-		}
-
-		worker.interrupt();
-	}
-
-	private PluginMessageHandlerWorker getFreeWorker() {
-		
-		// FIXME: Can be made more efficient by having an idle worker pool
-		
-		while (true) {
-			for (PluginMessageHandlerWorker worker: workers) {
-				if (worker.isFree()) {
-					PluginDebug.debug("Found free worker with id " + worker.getWorkerId());
-					// mark it busy before returning
-					worker.busy();
-					return worker;
-				}
-			}
-			
-			// If we have less than MAX_WORKERS, create a new worker
-			if (workers.size() <= MAX_WORKERS) {
-			    PluginDebug.debug("Cannot find free worker, creating worker " + workers.size());
-			    PluginMessageHandlerWorker worker = new PluginMessageHandlerWorker(streamHandler, workers.size(), as);
-			    worker.start();
-			    workers.add(worker);
-			    worker.busy();
-			    return worker;
-			} else {
-			    // else wait
-			}
-
-			Thread.yield();
-		}
-
-		//throw new RuntimeException("Out of message handler workers");
-	}
-	
-}
--- a/plugin/icedtea/sun/applet/PluginMessageHandlerWorker.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-class PluginMessageHandlerWorker extends Thread {
-
-	private boolean free = true;
-	private int id;
-	private String message = null;
-	private SecurityManager sm;
-	PluginStreamHandler streamHandler = null;
-
-	public PluginMessageHandlerWorker(PluginStreamHandler streamHandler, int id, SecurityManager sm) {
-		this.id = id;
-		this.streamHandler = streamHandler;
-		this.sm = sm;
-	}
-
-	public void setmessage(String message) {
-		this.message = message;
-	}
-
-	public void run() {
-		while (true) {
-
-			if (message != null) {
-				
-			    PluginDebug.debug("Consumer thread " + id + " consuming " + message);
-			    
-				// ideally, whoever returns things object should mark it 
-				// busy first, but just in case..
-				busy();
-
-				try {
-					streamHandler.handleMessage(message);
-				} catch (PluginException pe) {
-					/*
-					   catch the exception and DO NOTHING. The plugin should take over after 
-					   this error and let the user know. We don't quit because otherwise the 
-					   exception will spread to the rest of the applets which is a no-no
-					 */ 
-				}
-
-				this.message = null;
-				
-				PluginDebug.debug("Consumption completed by consumer thread " + id);
-
-	            // mark ourselves free again
-				free();
-				
-			} else {
-				
-				// Sleep when there is nothing to do
-			    try {
-			        Thread.sleep(Integer.MAX_VALUE);
-			        PluginDebug.debug("Consumer thread " + id + " sleeping...");
-			    } catch (InterruptedException ie) {
-			        PluginDebug.debug("Consumer thread " + id + " woken...");
-			        // nothing.. someone woke us up, see if there 
-			        // is work to do
-			    }
-			}
-		}
-	}
-	
-	
-	
-	public int getWorkerId() {
-		return id;
-	}
-
-	public void busy() {
-		this.free = false;
-	}
-
-	
-	public void free() {
-		this.free = true;
-	}
-	
-	public boolean isFree() {
-		return free;
-	}
-}
--- a/plugin/icedtea/sun/applet/PluginObjectStore.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/* PluginObjectStore -- manage identifier-to-object mapping
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.util.*;
-import java.lang.reflect.*;
-import java.io.*;
-
-public class PluginObjectStore
-{
-    private static HashMap<Integer, Object> objects = new HashMap();
-    private static HashMap<Integer, Integer> counts = new HashMap();
-    private static HashMap<Object, Integer> identifiers = new HashMap();
-    // FIXME:
-    //
-    // IF uniqueID == MAX_LONG, uniqueID =
-    // 0 && wrapped = true
-    //
-    // if (wrapped), check if
-    // objects.get(uniqueID) returns null
-    //
-    // if yes, use uniqueID, if no,
-    // uniqueID++ and keep checking
-    // or:
-    // stack of available ids:
-    // derefed id -> derefed id -> nextUniqueIdentifier
-    private static int nextUniqueIdentifier = 1;
-
-    public Object getObject(Integer identifier) {
-        return objects.get(identifier);
-    }
-
-    public Integer getIdentifier(Object object) {
-        if (object == null)
-            return 0;
-        return identifiers.get(object);
-    }
-    
-    public boolean contains(Object object) {
-    	if (object == null)
-    		return identifiers.containsKey(object);
-
-    	return false;
-    }
-    
-    public boolean contains(int identifier) {
-   		return objects.containsKey(identifier);
-    }
-
-    public void reference(Object object) {
-        Integer identifier = identifiers.get(object);
-        if (identifier == null) {
-            objects.put(nextUniqueIdentifier, object);
-            counts.put(nextUniqueIdentifier, 1);
-            identifiers.put(object, nextUniqueIdentifier);
-            //System.out.println("JAVA ADDED: " + nextUniqueIdentifier);
-            //System.out.println("JAVA REFERENCED: " + nextUniqueIdentifier
-            //                   + " to: 1");
-            nextUniqueIdentifier++;
-        } else {
-            counts.put(identifier, counts.get(identifier) + 1);
-            //System.out.println("JAVA REFERENCED: " + identifier +
-            //                   " to: " + counts.get(identifier));
-        }
-    }
-
-    public void unreference(int identifier) {
-        Integer currentCount = counts.get(identifier);
-        if (currentCount == null) {
-            //System.out.println("ERROR UNREFERENCING: " + identifier);
-            return;
-        }
-        if (currentCount == 1) {
-            //System.out.println("JAVA DEREFERENCED: " + identifier
-            //                   + " to: 0");
-            Object object = objects.get(identifier);
-            objects.remove(identifier);
-            counts.remove(identifier);
-            identifiers.remove(object);
-            //System.out.println("JAVA REMOVED: " + identifier);
-        } else {
-            counts.put(identifier, currentCount - 1);
-            //System.out.println("JAVA DEREFERENCED: " +
-            //                   identifier + " to: " +
-            //                   counts.get(identifier));
-        }
-    }
-
-    public void dump() {
-   		Iterator i = objects.keySet().iterator();
-   		while (i.hasNext()) {
-   			Object key = i.next();
-   			PluginDebug.debug(key + "::" +  objects.get(key));
-   		}
-    }
-}
-
--- a/plugin/icedtea/sun/applet/PluginProxyInfoRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/* PluginProxyInfoRequest -- Object representing a request for proxy information from the browser
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-
-/**
- * This class represents a request object for proxy information for a given URI
- */
-
-public class PluginProxyInfoRequest extends PluginCallRequest {
-    
-    URI internal = null;
-
-    public PluginProxyInfoRequest(String message, String returnString) {
-        super(message, returnString);
-    }
-    
-    public void parseReturn(String proxyInfo) {
-
-        // try to parse the proxy information. If things go wrong, do nothing .. 
-        // this will keep internal = null which forces a direct connection
-
-    	PluginDebug.debug ("PluginProxyInfoRequest GOT: " + proxyInfo);
-    	String[] messageComponents = proxyInfo.split(" ");
-
-    	try {
-    	    internal = new URI(messageComponents[2], null, messageComponents[3], Integer.parseInt(messageComponents[4]), null, null, null);
-    	} catch (Exception e) {
-    	    // do nothing
-    	}
-
-        setDone(true);
-    }
-
-    /**
-     * Returns whether the given message is serviceable by this object
-     * 
-     * @param message The message to service
-     * @return boolean indicating if message is serviceable
-     */
-    public boolean serviceable(String message) {
-    	return message.startsWith("plugin PluginProxyInfo");
-    }
-
-    public URI getObject() {
-    	return this.internal;
-    }
-}
--- a/plugin/icedtea/sun/applet/PluginProxySelector.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/* PluginProxySelector -- proxy selector for all connections from applets and the plugin
-   Copyright (C) 2009  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Proxy;
-import java.net.ProxySelector;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.util.Date;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Proxy selector implementation for plugin network functions.
- * 
- * This class fetches proxy information from the web browser and 
- * uses that information in the context of all network connection 
- * (plugin specific and applet connections) as applicable
- * 
- */
-
-public class PluginProxySelector extends ProxySelector {
-
-    private TimedHashMap<String, Proxy> proxyCache = new TimedHashMap<String, Proxy>(); 
-
-
-    @Override
-    public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
-        // If the connection fails, there is little we can do here. Just print the exception
-        ioe.printStackTrace();
-    }
-
-    /**
-     * Selects the appropriate proxy (or DIRECT connection method) for the given URI
-     * 
-     * @param uri The URI being accessed
-     * @return A list of Proxy objects that are usable for this URI
-     */
-    @Override
-    public List<Proxy> select(URI uri) {
-
-        List<Proxy> proxyList = new ArrayList<Proxy>();
-
-        // check cache first
-        Proxy cachedProxy = checkCache(uri);
-        if (cachedProxy != null) {
-            proxyList.add(cachedProxy);
-            return proxyList;
-        }
-
-        // Nothing usable in cache. Fetch info from browser
-        Proxy proxy = Proxy.NO_PROXY;
-        Object o = PluginAppletViewer.requestPluginProxyInfo(uri);
-
-        // If the browser returned anything, try to parse it. If anything in the try block fails, the fallback is direct connection
-        try {
-            if (o != null) {
-                PluginDebug.debug("Proxy URI = " + o);
-                URI proxyURI = (URI) o;
-                
-                // If origin uri is http/ftp, we're good. If origin uri is not that, the proxy _must_ be socks, else we fallback to direct
-                if (uri.getScheme().startsWith("http") || uri.getScheme().equals("ftp") || proxyURI.getScheme().startsWith("socks")) {
-
-                    Proxy.Type type = proxyURI.getScheme().equals("http") ? Proxy.Type.HTTP : Proxy.Type.SOCKS; 
-                    InetSocketAddress socketAddr = new InetSocketAddress(proxyURI.getHost(), proxyURI.getPort());
-
-                    proxy = new Proxy(type, socketAddr);
-
-                    String uriKey = uri.getScheme() + "://" + uri.getHost();
-                    proxyCache.put(uriKey, proxy);
-                } else {
-                    PluginDebug.debug("Proxy " + proxyURI + " cannot be used for " + uri + ". Falling back to DIRECT");
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        proxyList.add(proxy);
-
-        PluginDebug.debug("Proxy for " + uri.toString() + " is " + proxy);
-
-        return proxyList;
-    }
-
-    /** 
-     * Checks to see if proxy information is already cached. 
-     * 
-     * @param uri The URI to check
-     * @return The cached Proxy. null if there is no suitable cached proxy. 
-     */
-    private Proxy checkCache(URI uri) {
-        
-        String uriKey = uri.getScheme() + "://" + uri.getHost();
-        if (proxyCache.get(uriKey) != null) {
-            return proxyCache.get(uriKey);
-        }
-
-        return null;
-    }
-    
-    /**
-     * Simple utility class that extends HashMap by adding an expiry to the entries.
-     * 
-     * This map stores entries, and returns them only if the entries were last accessed within time t=10 seconds
-     *
-     * @param <K> The key type
-     * @param <V> The Object type
-     */
-
-    private class TimedHashMap<K,V> extends HashMap<K,V> {
-
-        HashMap<K, Long> timeStamps = new HashMap<K, Long>();
-        Long expiry = 10000L;
-        
-        /**
-         * Store the item in the map and associate a timestamp with it
-         * 
-         * @param key The key
-         * @param value The value to store
-         */
-        public V put(K key, V value) {
-            timeStamps.put(key, new Date().getTime());
-            return super.put(key, value);
-        }
-
-        /**
-         * Return cached item if it has not already expired.
-         * 
-         * Before returning, this method also resets the "last accessed" 
-         * time for this entry, so it is good for another 10 seconds
-         * 
-         * @param key The key
-         */
-        public V get(Object key) {
-
-            Long now = new Date().getTime();
-
-            if (super.containsKey(key)) {
-                Long age = now - timeStamps.get(key);
-
-                // Item exists. If it has not expired, renew its access time and return it 
-                if (age <= expiry) {
-                    PluginDebug.debug("Returning proxy " + super.get(key) + " from cache for " + key);
-                    timeStamps.put((K) key, (new Date()).getTime());
-                    return super.get(key);
-                } else {
-                    PluginDebug.debug("Proxy cache for " + key + " has expired (age=" + age/1000.0 + " seconds)");
-                }
-            } 
-
-            return null;
-        }
-    }
-    
-}
--- a/plugin/icedtea/sun/applet/PluginStreamHandler.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,479 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.StreamTokenizer;
-import java.net.MalformedURLException;
-import java.nio.charset.Charset;
-import java.util.Date;
-import java.util.LinkedList;
-
-import javax.swing.SwingUtilities;
-
-
-public class PluginStreamHandler {
-
-    private BufferedReader pluginInputReader;
-    private StreamTokenizer pluginInputTokenizer;
-    private BufferedWriter pluginOutputWriter;
-    
-    private RequestQueue queue = new RequestQueue();
-    
-    private JavaConsole console = new JavaConsole();
-
-	LinkedList<String> writeQueue = new LinkedList<String>();
-
-	PluginMessageConsumer consumer;
-	Boolean shuttingDown = false;
-	
-	PluginAppletViewer pav;
-	
-	static Date d = new Date();
-	static long startTime = d.getTime();
-	static long totalWait = 0;
-	
-    public PluginStreamHandler(InputStream inputstream, OutputStream outputstream)
-    throws MalformedURLException, IOException
-    {
-
-    	PluginDebug.debug("Current context CL=" + Thread.currentThread().getContextClassLoader());
-    	try {
-			pav = (PluginAppletViewer) ClassLoader.getSystemClassLoader().loadClass("sun.applet.PluginAppletViewer").newInstance();
-			PluginDebug.debug("Loaded: " + pav + " CL=" + pav.getClass().getClassLoader());
-		} catch (InstantiationException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (IllegalAccessException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (ClassNotFoundException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-    	PluginDebug.debug("Creating consumer...");
-    	consumer = new PluginMessageConsumer(this);
-
-    	// Set up input and output pipes.  Use UTF-8 encoding.
-    	pluginInputReader =
-    		new BufferedReader(new InputStreamReader(inputstream,
-    				Charset.forName("UTF-8")));
-    	/*pluginInputTokenizer = new StreamTokenizer(pluginInputReader);
-    	pluginInputTokenizer.resetSyntax();
-    	pluginInputTokenizer.whitespaceChars('\u0000', '\u0000');
-    	pluginInputTokenizer.wordChars('\u0001', '\u00FF');*/
-    	pluginOutputWriter =
-    		new BufferedWriter(new OutputStreamWriter
-    				(outputstream, Charset.forName("UTF-8")));
-
-    	/*
-	while(true) {
-            String message = read();
-            PluginDebug.debug(message);
-            handleMessage(message);
-            // TODO:
-            // write(queue.peek());
-	}
-    	 */
-    }
-
-    public void startProcessing() {
-
-    	Thread listenerThread = new Thread() {
-
-    		public void run() {
-    			
-    			while (true) {
-
-    				PluginDebug.debug("Waiting for data...");
-    				
-    	    		long b4 = new Date().getTime();
-
-    				String s = read();
-                    
-    	    		long after = new Date().getTime();
-
-    	    		totalWait += (after - b4);
-    				//System.err.println("Total wait time: " + totalWait);
-
-    				if (s != null) {
-    					consumer.consume(s);
-    				} else {
-    					try {
-    						// Close input/output channels to plugin.
-    						pluginInputReader.close();
-    						pluginOutputWriter.close();
-    					} catch (IOException exception) {
-    						// Deliberately ignore IOException caused by broken
-    						// pipe since plugin may have already detached.
-    					}
-    					AppletSecurityContextManager.dumpStore(0);
-    					PluginDebug.debug("APPLETVIEWER: exiting appletviewer");
-    					System.exit(0);
-    				}
-    				
-/*    				
-    				int readChar = -1;
-    				// blocking read, discard first character
-    				try {
-    					readChar = pluginInputReader.read();
-    				} catch (IOException ioe) {
-    					// plugin may have detached
-    				}
-
-    				// if not disconnected
-    				if (readChar != -1) {
-    					String s = read();
-    					PluginDebug.debug("Got data, consuming " + s);
-    					consumer.consume(s);
-    				} else {
-    					try {
-    						// Close input/output channels to plugin.
-    						pluginInputReader.close();
-    						pluginOutputWriter.close();
-    					} catch (IOException exception) {
-    						// Deliberately ignore IOException caused by broken
-    						// pipe since plugin may have already detached.
-    					}
-    					AppletSecurityContextManager.dumpStore(0);
-    					PluginDebug.debug("APPLETVIEWER: exiting appletviewer");
-    					System.exit(0);
-    				}
-*/
-    			}
-    		}
-    	};
-    	
-    	listenerThread.start();
-    }
-    
-    public void postMessage(String s) {
-
-    	if (s == null || s.equals("shutdown")) {
-    	    try {
-    		// Close input/output channels to plugin.
-    		pluginInputReader.close();
-    		pluginOutputWriter.close();
-    	    } catch (IOException exception) {
-    		// Deliberately ignore IOException caused by broken
-    		// pipe since plugin may have already detached.
-    	    }
-    	    AppletSecurityContextManager.dumpStore(0);
-    	    PluginDebug.debug("APPLETVIEWER: exiting appletviewer");
-    	    System.exit(0);
-    	}
-
-   		//PluginAppletSecurityContext.contexts.get(0).store.dump();
-   		PluginDebug.debug("Plugin posted: " + s);
-
-		PluginDebug.debug("Consuming " + s);
-		consumer.consume(s);
-
-   		PluginDebug.debug("Added to queue");
-    }
-    
-    public void handleMessage(String message) throws PluginException {
-
-    	int nextIndex = 0;
-    	int reference = -1;
-    	String src = null;
-    	String[] privileges = null;
-    	String rest = "";
-
-    	String[] msgComponents = message.split(" ");
-    
-		if (msgComponents.length < 2)
-			return;
-
-        if (msgComponents[0].startsWith("plugin")) {
-            handlePluginMessage(message);
-            return;
-        }
-
-    	// type and identifier are guaranteed to be there
-    	String type = msgComponents[0];
-    	final int identifier = Integer.parseInt(msgComponents[1]);
-    	nextIndex = 2;
-    	
-    	// reference, src and privileges are optional components, 
-    	// and are guaranteed to be in that order, if they occur
-
-    	// is there a reference ?
-    	if (msgComponents[nextIndex].equals("reference")) {
-    		reference = Integer.parseInt(msgComponents[nextIndex+1]);
-    		nextIndex += 2;
-    	}
-
-    	// is there a src?
-    	if (msgComponents[nextIndex].equals("src")) {
-    		src = msgComponents[nextIndex+1];
-    		nextIndex += 2;
-    	}
-
-    	// is there a privileges?
-    	if (msgComponents[nextIndex].equals("privileges")) {
-    		String privs = msgComponents[nextIndex+1];
-    		privileges = privs.split(",");
-    		nextIndex += 2;
-    	}
-    	
-    	// rest
-    	for (int i=nextIndex; i < msgComponents.length; i++) {
-    		rest += msgComponents[i];
-    		rest += " ";
-    	}
-
-    	rest = rest.trim();
-
-    	try {
-
-    		PluginDebug.debug("Breakdown -- type: " + type + " identifier: " + identifier + " reference: " + reference + " src: " + src + " privileges: " + privileges + " rest: \"" + rest + "\"");
-
-    		if (rest.contains("JavaScriptGetWindow")
-    				|| rest.contains("JavaScriptGetMember")
-    				|| rest.contains("JavaScriptSetMember")
-    				|| rest.contains("JavaScriptGetSlot")
-    				|| rest.contains("JavaScriptSetSlot")
-    				|| rest.contains("JavaScriptEval")
-    				|| rest.contains("JavaScriptRemoveMember")
-    				|| rest.contains("JavaScriptCall")
-    				|| rest.contains("JavaScriptFinalize")
-    				|| rest.contains("JavaScriptToString")) {
-    			
-				finishCallRequest(rest);
-    			return;
-    		}
-
-    		final int freference = reference;
-    		final String frest = rest;
-
-    		if (type.equals("instance")) {
-    			PluginAppletViewer.handleMessage(identifier, freference,frest);
-    		} else if (type.equals("context")) {
-    			PluginDebug.debug("Sending to PASC: " + identifier + "/" + reference + " and " + rest);
-    			AppletSecurityContextManager.handleMessage(identifier, reference, src, privileges, rest);
-    		}
-    	} catch (Exception e) {
-    		throw new PluginException(this, identifier, reference, e);
-    	}
-    }
-
-    private void handlePluginMessage(String message) {
-        if (message.equals("plugin showconsole")) {
-            showConsole();
-        } else if (message.equals("plugin hideconsole")) {
-            hideConsole();            
-        } else {
-            // else this is something that was specifically requested
-            finishCallRequest(message);
-        }
-    }
-
-    public void postCallRequest(PluginCallRequest request) {
-        synchronized(queue) {
-   			queue.post(request);
-        }
-    }
-
-    private void finishCallRequest(String message) {
-    	PluginDebug.debug ("DISPATCHCALLREQUESTS 1");
-    	synchronized(queue) {
-    		PluginDebug.debug ("DISPATCHCALLREQUESTS 2");
-    		PluginCallRequest request = queue.pop();
-
-    		// make sure we give the message to the right request 
-    		// in the queue.. for the love of God, MAKE SURE!
-
-    		// first let's be efficient.. if there was only one 
-    		// request in queue, we're already set
-    		if (queue.size() != 0) {
-
-    			int size = queue.size();
-    			int count = 0;
-
-    			while (!request.serviceable(message)) {
-
-     				PluginDebug.debug(request + " cannot service " + message);
-    			    
-    				// something is very wrong.. we have a message to 
-    				// process, but no one to service it
-    				if (count >= size) {
-    					throw new RuntimeException("Unable to find processor for message " + message);
-    				}
-
-    				// post request at the end of the queue
-    				queue.post(request);
-
-    				// Look at the next request
-    				request = queue.pop();
-
-    				count++;
-    			}
-
-    		}
-
-    		PluginDebug.debug ("DISPATCHCALLREQUESTS 3");
-    		if (request != null) {
-    			PluginDebug.debug ("DISPATCHCALLREQUESTS 5");
-    			synchronized(request) {
-    				request.parseReturn(message);
-    				request.notifyAll();
-    			}
-    			PluginDebug.debug ("DISPATCHCALLREQUESTS 6");
-    			PluginDebug.debug ("DISPATCHCALLREQUESTS 7");
-    		}
-    	}
-    	PluginDebug.debug ("DISPATCHCALLREQUESTS 8");
-    }
-
-    /**
-     * Read string from plugin.
-     *
-     * @return the read string
-     *
-     * @exception IOException if an error occurs
-     */
-    private String read()
-    {
-    	String message = null;
-
-    	try {
-    		message = pluginInputReader.readLine();
-    		PluginDebug.debug("  PIPE: appletviewer read: " + message);
-
-            if (message == null || message.equals("shutdown")) {
-                synchronized(shuttingDown) {
-                    shuttingDown = true;
-                }
-                try {
-                    // Close input/output channels to plugin.
-                    pluginInputReader.close();
-                    pluginOutputWriter.close();
-                } catch (IOException exception) {
-                    // Deliberately ignore IOException caused by broken
-                    // pipe since plugin may have already detached.
-                }
-                AppletSecurityContextManager.dumpStore(0);
-                PluginDebug.debug("APPLETVIEWER: exiting appletviewer");
-                System.exit(0);
-            }
-    	} catch (IOException e) {
-    	       e.printStackTrace();
-    	}
-
-    	return message;
-    }
-    
-    /**
-     * Write string to plugin.
-     * 
-     * @param message the message to write
-     *
-     * @exception IOException if an error occurs
-     */
-    public void write(String message)
-    {
-
-    	PluginDebug.debug("  PIPE: appletviewer wrote: " + message);
-        synchronized(pluginOutputWriter) {
-        	try {
-        		pluginOutputWriter.write(message + "\n", 0, message.length());
-        		pluginOutputWriter.write(0);
-        		pluginOutputWriter.flush();
-        	} catch (IOException e) {
-        		// if we are shutting down, ignore write failures as 
-        		// pipe may have closed
-        		synchronized(shuttingDown) {
-        			if (!shuttingDown) {
-        				e.printStackTrace();
-        			}
-        		}
-
-        		// either ways, if the pipe is broken, there is nothing 
-        		// we can do anymore. Don't hang around.
-        		PluginDebug.debug("Unable to write to PIPE. APPLETVIEWER exiting");        		
-        		System.exit(1);
-        	}
-		}
-
-		return;
-    /*	
-    	synchronized(writeQueue) {
-            writeQueue.add(message);
-            PluginDebug.debug("  PIPE: appletviewer wrote: " + message);
-    	}
-	*/
-
-    }
-
-    public boolean messageAvailable() {
-    	return writeQueue.size() != 0;
-    }
-
-    public String getMessage() {
-    	synchronized(writeQueue) {
-			String ret = writeQueue.size() > 0 ? writeQueue.poll() : "";
-    		return ret;
-    	}
-    }
-    
-    private void showConsole() {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                console.showConsole();
-            }
-        });
-    }
-    
-    private void hideConsole() {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                console.hideConsole();
-            }
-        });
-    }
-}
--- a/plugin/icedtea/sun/applet/RequestQueue.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-public class RequestQueue {
-    PluginCallRequest head = null;
-    PluginCallRequest tail = null;
-    private int size = 0;
-
-    public void post(PluginCallRequest request) {
-    	PluginDebug.debug("Securitymanager=" + System.getSecurityManager());
-        if (head == null) {
-            head = tail = request;
-            tail.setNext(null);
-        } else {
-            tail.setNext(request);
-            tail = request;
-            tail.setNext(null);
-        }
-        
-        size++;
-    }
-
-    public PluginCallRequest pop() {
-        if (head == null)
-            return null;
-
-        PluginCallRequest ret = head;
-        head = head.getNext();
-        ret.setNext(null);
-
-        size--;
-        
-        return ret;
-    }
-    
-    public int size() {
-    	return size;
-    }
-}
--- a/plugin/icedtea/sun/applet/TestEnv.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/* TestEnv -- test JavaScript-to-Java calls
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-public class TestEnv
-{
-    public static int intField = 103;
-    public int intInstanceField = 7822;
-    public String stringField = "hello";
-    // z <musical G clef> <chinese water>
-    public String complexStringField = "z\uD834\uDD1E\u6C34";
-
-    public static void TestIt() {
-        PluginDebug.debug("TestIt");
-    }
-
-    public static void TestItBool(boolean arg) {
-        PluginDebug.debug("TestItBool: " + arg);
-    }
-
-    public static void TestItByte(byte arg) {
-        PluginDebug.debug("TestItByte: " + arg);
-    }
-
-    public static void TestItChar(char arg) {
-        PluginDebug.debug("TestItChar: " + arg);
-    }
-
-    public static void TestItShort(short arg) {
-        PluginDebug.debug("TestItShort: " + arg);
-    }
-
-    public static void TestItInt(int arg) {
-        PluginDebug.debug("TestItInt: " + arg);
-    }
-
-    public static void TestItLong(long arg) {
-        PluginDebug.debug("TestItLong: " + arg);
-    }
-
-    public static void TestItFloat(float arg) {
-        PluginDebug.debug("TestItFloat: " + arg);
-    }
-
-    public static void TestItDouble(double arg) {
-        PluginDebug.debug("TestItDouble: " + arg);
-    }
-
-    public static void TestItObject(TestEnv arg) {
-        PluginDebug.debug("TestItObject: " + arg);
-    }
-
-    public static void TestItObjectString(String arg) {
-        PluginDebug.debug("TestItObjectString: " + arg);
-    }
-
-    public static void TestItIntArray(int[] arg) {
-        PluginDebug.debug("TestItIntArray: " + arg);
-        for (int i = 0; i < arg.length; i++)
-            PluginDebug.debug ("ELEMENT: " + i + " " + arg[i]);
-    }
-
-    public static void TestItObjectArray(String[] arg) {
-        PluginDebug.debug("TestItObjectArray: " + arg);
-        for (int i = 0; i < arg.length; i++)
-            PluginDebug.debug ("ELEMENT: " + i + " " + arg[i]);
-    }
-
-    public static void TestItObjectArrayMulti(String[][] arg) {
-        PluginDebug.debug("TestItObjectArrayMulti: " + arg);
-        for (int i = 0; i < arg.length; i++)
-            for (int j = 0; j < arg[i].length; j++)
-                PluginDebug.debug ("ELEMENT: " + i + " " + j + " " + arg[i][j]);
-    }
-
-    public static boolean TestItBoolReturnTrue() {
-        return true;
-    }
-
-    public static boolean TestItBoolReturnFalse() {
-        return false;
-    }
-
-    public static byte TestItByteReturn() {
-        return (byte) 0xfe;
-    }
-
-    public static char TestItCharReturn() {
-        return 'K';
-    }
-
-    public static char TestItCharUnicodeReturn() {
-        return '\u6C34';
-    }
-
-    public static short TestItShortReturn() {
-        return 23;
-    }
-
-    public static int TestItIntReturn() {
-        return 3445;
-    }
-
-    public static long TestItLongReturn() {
-        return 3242883;
-    }
-
-    public static float TestItFloatReturn() {
-        return 9.21E4f;
-    }
-
-    public static double TestItDoubleReturn() {
-        return 8.33E88;
-    }
-
-    public static Object TestItObjectReturn() {
-        return new String("Thomas");
-    }
-
-    public static int[] TestItIntArrayReturn() {
-        return new int[] { 6, 7, 8 };
-    }
-
-    public static String[] TestItObjectArrayReturn() {
-        return new String[] { "Thomas", "Brigitte" };
-    }
-
-    public static String[][] TestItObjectArrayMultiReturn() {
-        return new String[][] { {"Thomas", "Brigitte"},
-                                {"Lindsay", "Michael"} };
-    }
-
-    public int TestItIntInstance(int arg) {
-        PluginDebug.debug("TestItIntInstance: " + this + " " + arg);
-        return 899;
-    }
-}
--- a/plugin/icedtea/sun/applet/VoidPluginCallRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* VoidPluginCallRequest -- represent Java-to-JavaScript requests
-   Copyright (C) 2008  Red Hat
-
-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; either version 2, or (at your option)
-any later version.
-
-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 sun.applet;
-
-
-public class VoidPluginCallRequest extends PluginCallRequest {
-    public VoidPluginCallRequest(String message, String returnString) {
-        super(message, returnString);
-        PluginDebug.debug ("VoidPLUGINCAlL " + message + " " + returnString);
-    }
-
-    public void parseReturn(String message) {
-    	setDone(true);
-    }
-    
-    /**
-     * Returns whether the given message is serviceable by this object
-     * 
-     * @param message The message to service
-     * @return boolean indicating if message is serviceable
-     */
-    public boolean serviceable(String message) {
-    	return message.contains("JavaScriptFinalize") ||
-    			message.contains("JavaScriptRemoveMember") ||
-    			message.contains("JavaScriptSetMember") ||
-    			message.contains("JavaScriptSetSlot");
-    }
-    
-    public Object getObject() {
-    	return null;
-    }
-}
--- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaJavaRequestProcessor.cc
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaJavaRequestProcessor.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaJavaRequestProcessor.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaJavaRequestProcessor.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
-/* IcedTeaNPPlugin.cc -- web browser plugin to execute Java applets
+/* IcedTeaPlugin.cc -- web browser plugin to execute Java applets
    Copyright (C) 2003, 2004, 2006, 2007  Free Software Foundation, Inc.
-   Copyright (C) 2009 Red Hat
+   Copyright (C) 2009, 2010 Red Hat
 
 This file is part of GNU Classpath.
 
@@ -434,8 +434,8 @@
   // pipe.
 
   // in_pipe_name
-  in_pipe_name = g_strdup_printf ("%s/icedteanp-appletviewer-to-plugin",
-                                         data_directory);
+  in_pipe_name = g_strdup_printf ("%s/%d-icedteanp-appletviewer-to-plugin",
+                                         data_directory, getpid());
   if (!in_pipe_name)
     {
       PLUGIN_ERROR ("Failed to create input pipe name.");
@@ -449,7 +449,7 @@
   unlink (in_pipe_name);
 
   PLUGIN_DEBUG_1ARG ("GCJ_New: creating input fifo: %s\n", in_pipe_name);
-  if (mkfifo (in_pipe_name, 0700) == -1 && errno != EEXIST)
+  if (mkfifo (in_pipe_name, 0600) == -1 && errno != EEXIST)
     {
       PLUGIN_ERROR_TWO ("Failed to create input pipe", strerror (errno));
       np_error = NPERR_GENERIC_ERROR;
@@ -461,8 +461,8 @@
   // output pipe.
 
   // out_pipe_name
-  out_pipe_name = g_strdup_printf ("%s/icedteanp-plugin-to-appletviewer",
-                                         data_directory);
+  out_pipe_name = g_strdup_printf ("%s/%d-icedteanp-plugin-to-appletviewer",
+                                         data_directory, getpid());
 
   if (!out_pipe_name)
     {
@@ -475,7 +475,7 @@
   unlink (out_pipe_name);
 
   PLUGIN_DEBUG_1ARG ("GCJ_New: creating output fifo: %s\n", out_pipe_name);
-  if (mkfifo (out_pipe_name, 0700) == -1 && errno != EEXIST)
+  if (mkfifo (out_pipe_name, 0600) == -1 && errno != EEXIST)
     {
       PLUGIN_ERROR_TWO ("Failed to create output pipe", strerror (errno));
       np_error = NPERR_GENERIC_ERROR;
@@ -1461,19 +1461,23 @@
 
   if (plugin_debug)
   {
-      command_line = (gchar**) malloc(sizeof(gchar*)*6);
+      command_line = (gchar**) malloc(sizeof(gchar*)*8);
       command_line[0] = g_strdup(appletviewer_executable);
       command_line[1] = g_strdup("-Xdebug");
       command_line[2] = g_strdup("-Xnoagent");
       command_line[3] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
       command_line[4] = g_strdup("sun.applet.PluginMain");
-      command_line[5] = NULL;
+      command_line[5] = g_strdup(out_pipe_name);
+      command_line[6] = g_strdup(in_pipe_name);
+      command_line[7] = NULL;
    } else
    {
-       command_line = (gchar**) malloc(sizeof(gchar)*3);
+       command_line = (gchar**) malloc(sizeof(gchar)*5);
        command_line[0] = g_strdup(appletviewer_executable);
        command_line[1] = g_strdup("sun.applet.PluginMain");
-       command_line[2] = NULL;
+       command_line[2] = g_strdup(out_pipe_name);
+       command_line[3] = g_strdup(in_pipe_name);
+       command_line[4] = NULL;
    }
 
   if (!g_spawn_async (NULL, command_line, NULL, (GSpawnFlags) G_SPAWN_DO_NOT_REAP_CHILD,
@@ -1963,7 +1967,7 @@
 
   // Make sure the plugin data directory exists, creating it if
   // necessary.
-  data_directory = g_strconcat (getenv ("HOME"), "/.icedteaplugin", NULL);
+  data_directory = g_strconcat (P_tmpdir, NULL);
   if (!data_directory)
     {
       PLUGIN_ERROR ("Failed to create data directory name.");
@@ -1971,6 +1975,32 @@
     }
   NPError np_error = NPERR_NO_ERROR;
   gchar* filename = NULL;
+
+  // If P_tmpdir does not exist, try /tmp directly
+
+  if (!g_file_test (data_directory,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+    {
+      int file_error = 0;
+
+      data_directory = g_strconcat ("/tmp", NULL);
+        if (!data_directory)
+          {
+            PLUGIN_ERROR ("Failed to create data directory name.");
+            return NPERR_OUT_OF_MEMORY_ERROR;
+          }
+
+    }
+
+  data_directory = g_strconcat (data_directory, "/icedteaplugin-", getenv("USER"), NULL);
+
+  if (!data_directory)
+  {
+      PLUGIN_ERROR ("Failed to create data directory name.");
+      return NPERR_OUT_OF_MEMORY_ERROR;
+  }
+
+  // Now create a icedteaplugin subdir
   if (!g_file_test (data_directory,
                     (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
     {
@@ -1980,13 +2010,27 @@
       if (file_error != 0)
         {
           PLUGIN_ERROR_THREE ("Failed to create data directory",
-                              data_directory,
-                              strerror (errno));
+                          data_directory,
+                          strerror (errno));
           np_error = NPERR_GENERIC_ERROR;
           goto cleanup_data_directory;
         }
     }
 
+
+  // If data directory doesn't exit by this point, bail
+  if (!g_file_test (data_directory,
+                    (GFileTest) (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+    {
+      PLUGIN_ERROR_THREE ("Temp directory does not exist: ",
+                          data_directory,
+                          strerror (errno));
+
+      np_error = NPERR_GENERIC_ERROR;
+            goto cleanup_data_directory;
+
+    }
+
   // Set appletviewer_executable.
   Dl_info info;
   int filename_size;
--- a/plugin/icedteanp/IcedTeaNPPlugin.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaNPPlugin.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaPluginRequestProcessor.cc
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
@@ -119,7 +119,8 @@
                    command == "Call"      ||
                    command == "GetSlot"   ||
                    command == "SetSlot"   ||
-                   command == "Eval")
+                   command == "Eval"      ||
+                   command == "Finalize")
         {
 
             // Update queue synchronously
@@ -665,6 +666,53 @@
     pthread_mutex_unlock(&tc_mutex);
 }
 
+/**
+ * Decrements reference count to given object
+ *
+ * @param message_parts The request message.
+ */
+
+void
+PluginRequestProcessor::finalize(std::vector<std::string>* message_parts)
+{
+    std::string type;
+    std::string command;
+    int reference;
+    std::string response = std::string();
+    std::string variant_ptr_str = std::string();
+    NPVariant* variant_ptr;
+    NPObject* window_ptr;
+    int id;
+
+    type = message_parts->at(0);
+    id = atoi(message_parts->at(1).c_str());
+    reference = atoi(message_parts->at(3).c_str());
+    variant_ptr_str = message_parts->at(5);
+
+    NPP instance;
+    get_instance_from_id(id, instance);
+
+    variant_ptr = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(variant_ptr_str);
+    window_ptr = NPVARIANT_TO_OBJECT(*variant_ptr);
+    browser_functions.releaseobject(window_ptr);
+
+    // remove reference
+    IcedTeaPluginUtilities::removeInstanceID(variant_ptr);
+
+    // clear memory
+    free(variant_ptr);
+
+    // We need the context 0 for backwards compatibility with the Java side
+    IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response);
+    response += " JavaScriptFinalize";
+
+    plugin_to_java_bus->post(response.c_str());
+
+    delete message_parts;
+
+}
+
+
 void*
 queue_processor(void* data)
 {
@@ -726,6 +774,12 @@
                 pthread_mutex_lock(&syn_write_mutex);
                 processor->setMember(message_parts);
                 pthread_mutex_unlock(&syn_write_mutex);
+            } else if (command == "Finalize")
+            {
+                // write methods are synchronized
+                pthread_mutex_lock(&syn_write_mutex);
+                processor->finalize(message_parts);
+                pthread_mutex_unlock(&syn_write_mutex);
             } else
             {
                 // Nothing matched
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaPluginRequestProcessor.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
@@ -72,14 +72,6 @@
 /* Internal request reference counter */
 static long internal_req_ref_counter;
 
-// JS request processor methods
-static void* requestFromMainThread();
-static void* getSlot(void* tdata);
-static void* setSlot(void* tdata);
-static void* removeMember(void* tdata);
-static void* call(void* tdata);
-static void* finalize(void* tdata);
-
 /* Given a value and type, performs the appropriate Java->JS type
  * mapping and puts it in the given variant */
 
@@ -147,6 +139,8 @@
         /* Evaluate the given script */
         void call(std::vector<std::string>* message_parts);
 
+        /* Decrements reference count for given object */
+        void finalize(std::vector<std::string>* message_parts);
 };
 
 #endif // __ICEDTEAPLUGINREQUESTPROCESSOR_H__
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaPluginUtils.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaPluginUtils.cc
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaPluginUtils.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaPluginUtils.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaPluginUtils.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaRunnable.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaRunnable.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaRunnable.cc
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaRunnable.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaRunnable.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaRunnable.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaScriptablePluginObject.cc	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.cc	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaScriptablePluginObject.cc
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/IcedTeaScriptablePluginObject.h	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/IcedTeaScriptablePluginObject.h	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /* IcedTeaScriptablePluginObject.h
 
-   Copyright (C) 2009  Red Hat
+   Copyright (C) 2009, 2010  Red Hat
 
 This file is part of IcedTea.
 
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Mon Mar 29 02:54:20 2010 +0100
@@ -1281,6 +1281,7 @@
              return null;
          }
 
+         PluginMessageConsumer.registerPriorityWait(reference);
          streamhandler.postCallRequest(request);
          streamhandler.write(request.getMessage());
          try {
@@ -1326,6 +1327,7 @@
              "plugin PluginProxyInfo reference " + reference + " " + 
              requestURI, reference);
 
+         PluginMessageConsumer.registerPriorityWait(reference);
          streamhandler.postCallRequest(request);
          streamhandler.write(request.getMessage());
          try {
--- a/plugin/icedteanp/java/sun/applet/PluginMain.java	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginMain.java	Mon Mar 29 02:54:20 2010 +0100
@@ -107,9 +107,13 @@
     public static void main(String args[])
 	throws IOException
     {
+        if (args.length != 2 || !(new File(args[0]).exists()) || !(new File(args[1]).exists())) {
+            System.err.println("Invalid pipe names provided. Refusing to proceed.");
+            System.exit(1);
+        }
 
     	try {
-    		PluginMain pm = new PluginMain(System.getProperty("user.home") + "/.icedteaplugin/icedteanp-plugin-to-appletviewer", System.getProperty("user.home") + "/.icedteaplugin/icedteanp-appletviewer-to-plugin");
+    		PluginMain pm = new PluginMain(args[0], args[1]);
     	} catch (Exception e) {
     		e.printStackTrace();
     		System.err.println("Something very bad happened. I don't know what to do, so I am going to exit :(");
--- a/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java	Mon Mar 29 02:54:20 2010 +0100
@@ -38,82 +38,257 @@
 package sun.applet;
 
 import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.LinkedList;
-
-import sun.applet.AppletSecurity;
+import java.util.Set;
 
 class PluginMessageConsumer {
 
-	int MAX_WORKERS = 20;
+	private static int MAX_PARALLEL_INITS = 1;
+
+	// Each initialization requires 5 responses (tag, handle, width, proxy, cookie) 
+	// before the message stack unlocks/collapses. This works out well because we 
+	// want to allow upto 5 parallel tasks anyway
+	private static int MAX_WORKERS = MAX_PARALLEL_INITS*5;
+	private static int PRIORITY_WORKERS = MAX_PARALLEL_INITS*2;
+
+	private static Hashtable<Integer, PluginMessageHandlerWorker> initWorkers = new Hashtable<Integer, PluginMessageHandlerWorker>(2);
+
 	LinkedList<String> readQueue = new LinkedList<String>();
+	private static LinkedList<String> priorityWaitQueue = new LinkedList<String>();
 	ArrayList<PluginMessageHandlerWorker> workers = new ArrayList<PluginMessageHandlerWorker>();
 	PluginStreamHandler streamHandler = null;
 	AppletSecurity as;
+	ConsumerThread consumerThread = new ConsumerThread();
 
+	/** 
+	 * Registers a reference to wait for. Responses to registered priority 
+	 * references get handled by priority worker if normal workers are busy.
+	 *
+	 * @param reference The reference to give priority to
+	 */
+	public static void registerPriorityWait(Long reference) {
+	    PluginDebug.debug("Registering priority for reference " + reference);
+	    registerPriorityWait("reference " + reference.toString());
+	}
+
+	/** 
+     * Registers a string to wait for.
+     *
+     * @param searchString the string to look for in a response
+     */
+    public static void registerPriorityWait(String searchString) {
+        PluginDebug.debug("Registering priority for string " + searchString);
+        synchronized (priorityWaitQueue) {
+            if (!priorityWaitQueue.contains(searchString))
+                priorityWaitQueue.add(searchString);
+        }
+    }
+
+	/** 
+     * Unregisters a priority reference to wait for.
+     *
+     * @param reference The reference to remove
+     */
+    public static void unRegisterPriorityWait(Long reference) {
+        unRegisterPriorityWait(reference.toString());
+    }
+
+    /** 
+     * Unregisters a priority string to wait for.
+     *
+     * @param searchString The string to unregister from the priority list
+     */
+    public static void unRegisterPriorityWait(String searchString) {
+        synchronized (priorityWaitQueue) {
+            priorityWaitQueue.remove(searchString);
+        }
+    }
+
+    /**
+     * Returns the reference for this message. This method assumes that 
+     * the message has a reference number.
+     * 
+     * @param The message
+     * @return the reference number
+     */
+    private Long getReference(String[] msgParts) {
+        return Long.parseLong(msgParts[3]);
+    }
+    
 	public PluginMessageConsumer(PluginStreamHandler streamHandler) {
 		
 		as = new AppletSecurity();
 		this.streamHandler = streamHandler;
+		this.consumerThread.start();
+	}
 
-		// create some workers at the start...
-		for (int i=0; i < 3; i++) {
-			PluginDebug.debug("Creating worker " + i);
-			PluginMessageHandlerWorker worker = new PluginMessageHandlerWorker(streamHandler, i, as);
-			worker.start();
-			workers.add(worker);
-		}
+	private String getPriorityStrIfPriority(String message) {
+
+	    synchronized (priorityWaitQueue) {
+	        Iterator<String> it = priorityWaitQueue.iterator();
+
+	        while (it.hasNext()) {
+	            String priorityStr = it.next();
+	            if (message.indexOf(priorityStr) > 0)
+	                return priorityStr;
+	        }
+	    }
+
+	    return null;
+	}
+
+	private boolean isInInit(Integer instanceNum) {
+	    return initWorkers.containsKey(instanceNum);
+	}
+
+	private void addToInitWorkers(Integer instanceNum, PluginMessageHandlerWorker worker) {
+        synchronized(initWorkers) {
+            initWorkers.put(instanceNum, worker);
+        }
+	}
+
+	private boolean okayToProcess(String[] msgParts) {
+
+	    if (msgParts[2].equals("tag")) {
+
+	        Integer instanceNum = new Integer(msgParts[1]);
+
+	        synchronized(initWorkers) {
+	            if (initWorkers.size() >= MAX_PARALLEL_INITS) {
+	                return false;
+	            }
+	        }
+	        
+	        registerPriorityWait("instance " + instanceNum + " handle");
+	        registerPriorityWait("instance " + instanceNum + " width");
+
+	    } else if (msgParts[2].equals("handle") || msgParts[2].equals("width")) {
+	            Integer instanceNum = new Integer(msgParts[1]);
+
+	            // If this instance is not in init, return false immediately. 
+	            // Handle/Width messages should NEVER go before tag messages
+	            if (!isInInit(instanceNum))
+	                return false;
+	    }
+
+	    return true;
+	}
+
+	public void notifyWorkerIsFree(PluginMessageHandlerWorker worker) {
+	    synchronized (initWorkers) {
+	        Iterator<Integer> i = initWorkers.keySet().iterator();
+            while (i.hasNext()) {
+                Integer key = i.next();
+                if (initWorkers.get(key).equals(worker))
+                    initWorkers.remove(key);
+            }
+	    }
+	    
+	    consumerThread.interrupt();
 	}
 
-	public void consume(String message) {
-		
-		PluginDebug.debug("Consumer received message " + message);
-		
-		synchronized(readQueue) {
-			readQueue.add(message);
-		}
-
-		PluginDebug.debug("Message " + message + " added to queue. Looking for free worker...");
-		final PluginMessageHandlerWorker worker = getFreeWorker();
-
-		synchronized(readQueue) {
-			if (readQueue.size() > 0) {
-				worker.setmessage(readQueue.poll());
-			}
-		}
-
-		worker.interrupt();
+	public void queue(String message) {
+	    synchronized(readQueue) {
+	        readQueue.addLast(message);
+	    }
+	    
+	    // Wake that lazy consumer thread
+	    consumerThread.interrupt();
 	}
 
-	private PluginMessageHandlerWorker getFreeWorker() {
-		
-		// FIXME: Can be made more efficient by having an idle worker pool
+	protected class ConsumerThread extends Thread { 
+	    public void run() {
+
+	        while (true) {
+
+                String message = null;
+
+	            synchronized(readQueue) {
+	                message = readQueue.poll();
+	            }
+
+	            if (message != null) {
+
+	                String[] msgParts = message.split(" ");
+
+	                // if it is no okay to process just yet, push it back and 
+	                if (!okayToProcess(msgParts)) {
+	                    synchronized(readQueue) {
+	                        readQueue.addLast(message);
+	                    }
+	                    
+	                    continue; // re-loop to try next msg
+	                }
+
+	                String priorityStr = getPriorityStrIfPriority(message);
+	                boolean isPriorityResponse = (priorityStr != null);
 		
-		while (true) {
+	                //PluginDebug.debug("Message " + message + " (priority=" + isPriorityResponse + ") ready to be processed. Looking for free worker...");
+	                final PluginMessageHandlerWorker worker = getFreeWorker(isPriorityResponse);
+	                
+	                if (worker == null) {
+	                    synchronized(readQueue) {
+                            readQueue.addLast(message);
+                        }
+
+	                    continue; // re-loop to try next msg
+	                }
+
+	                if (msgParts[2].equals("tag"))
+	                    addToInitWorkers((new Integer(msgParts[1])), worker);
+
+	                if (isPriorityResponse) {
+	                    unRegisterPriorityWait(priorityStr);
+	                }
+
+                    worker.setmessage(message);
+	                worker.interrupt();
+
+	            } else {
+	                try {
+	                    Thread.sleep(1000);
+	                } catch (InterruptedException ie) {}
+	            }
+	        }
+	    }
+	}
+
+	private PluginMessageHandlerWorker getFreeWorker(boolean prioritized) {
+
 			for (PluginMessageHandlerWorker worker: workers) {
-				if (worker.isFree()) {
-					PluginDebug.debug("Found free worker with id " + worker.getWorkerId());
+				if (worker.isFree(prioritized)) {
+					PluginDebug.debug("Found free worker (" + worker.isPriority() + ") with id " + worker.getWorkerId());
 					// mark it busy before returning
 					worker.busy();
 					return worker;
 				}
 			}
-			
+
 			// If we have less than MAX_WORKERS, create a new worker
 			if (workers.size() <= MAX_WORKERS) {
-			    PluginDebug.debug("Cannot find free worker, creating worker " + workers.size());
-			    PluginMessageHandlerWorker worker = new PluginMessageHandlerWorker(streamHandler, workers.size(), as);
-			    worker.start();
-			    workers.add(worker);
-			    worker.busy();
-			    return worker;
-			} else {
-			    // else wait
+			    PluginMessageHandlerWorker worker = null;
+			    
+			    if (workers.size() <= (MAX_WORKERS - PRIORITY_WORKERS)) {
+			        PluginDebug.debug("Cannot find free worker, creating worker " + workers.size());
+			        worker = new PluginMessageHandlerWorker(this, streamHandler, workers.size(), as, false);
+			    } else if (prioritized) {
+			        PluginDebug.debug("Cannot find free worker, creating priority worker " + workers.size());
+			        worker = new PluginMessageHandlerWorker(this, streamHandler, workers.size(), as, true);
+			    } else {
+			        return null;
+			    }
+
+		        worker.start();
+		        worker.busy();
+		        workers.add(worker);
+		        return worker;
+
 			}
-
-			Thread.yield();
-		}
-
-		//throw new RuntimeException("Out of message handler workers");
+			
+			// No workers available. Better luck next time! 
+			return null;
 	}
 	
 }
--- a/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java	Mon Mar 29 02:54:20 2010 +0100
@@ -42,15 +42,25 @@
 class PluginMessageHandlerWorker extends Thread {
 
 	private boolean free = true;
+	private boolean isPriorityWorker = false;
 	private int id;
 	private String message = null;
 	private SecurityManager sm;
 	PluginStreamHandler streamHandler = null;
+	PluginMessageConsumer consumer = null;
 
-	public PluginMessageHandlerWorker(PluginStreamHandler streamHandler, int id, SecurityManager sm) {
+	public PluginMessageHandlerWorker(
+	            PluginMessageConsumer consumer, 
+	            PluginStreamHandler streamHandler, int id, 
+	            SecurityManager sm, boolean isPriorityWorker) {
+
 		this.id = id;
 		this.streamHandler = streamHandler;
 		this.sm = sm;
+		this.isPriorityWorker = isPriorityWorker;
+		this.consumer = consumer;
+		
+		PluginDebug.debug("Worker " + this.id + " (priority=" + isPriorityWorker + ") created."); 
 	}
 
 	public void setmessage(String message) {
@@ -107,15 +117,27 @@
 	}
 
 	public void busy() {
-		this.free = false;
+	    synchronized (this) {
+	        this.free = false;            
+        }
 	}
-
 	
 	public void free() {
-		this.free = true;
+	    synchronized (this) {
+	        this.free = true;
+
+	        // Signal the consumer that we are done in case it was waiting
+	        consumer.notifyWorkerIsFree(this); 
+	    }
 	}
-	
-	public boolean isFree() {
-		return free;
+
+	public boolean isPriority() {
+	    return isPriorityWorker;
+	}
+
+	public boolean isFree(boolean prioritized) {
+	    synchronized (this) {
+	        return free && (prioritized == isPriorityWorker);
+	    }
 	}
 }
--- a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java	Mon Mar 29 00:25:26 2010 +0100
+++ b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java	Mon Mar 29 02:54:20 2010 +0100
@@ -141,7 +141,7 @@
     				//System.err.println("Total wait time: " + totalWait);
 
     				if (s != null) {
-    					consumer.consume(s);
+    					consumer.queue(s);
     				} else {
     					try {
     						// Close input/output channels to plugin.
@@ -191,31 +191,6 @@
     	listenerThread.start();
     }
     
-    public void postMessage(String s) {
-
-    	if (s == null || s.equals("shutdown")) {
-    	    try {
-    		// Close input/output channels to plugin.
-    		pluginInputReader.close();
-    		pluginOutputWriter.close();
-    	    } catch (IOException exception) {
-    		// Deliberately ignore IOException caused by broken
-    		// pipe since plugin may have already detached.
-    	    }
-    	    AppletSecurityContextManager.dumpStore(0);
-    	    PluginDebug.debug("APPLETVIEWER: exiting appletviewer");
-    	    System.exit(0);
-    	}
-
-   		//PluginAppletSecurityContext.contexts.get(0).store.dump();
-   		PluginDebug.debug("Plugin posted: " + s);
-
-		PluginDebug.debug("Consuming " + s);
-		consumer.consume(s);
-
-   		PluginDebug.debug("Added to queue");
-    }
-    
     public void handleMessage(String message) throws PluginException {
 
     	int nextIndex = 0;
--- a/ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -206,7 +206,6 @@
 
   // Update the invocation counter
   if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
-    thread->set_do_not_unlock();
     InvocationCounter *counter = method->invocation_counter();
     counter->increment();
     if (counter->reached_InvocationLimit()) {
@@ -215,7 +214,6 @@
       if (HAS_PENDING_EXCEPTION)
         goto unwind_and_return;
     }
-    thread->clr_do_not_unlock();
   }
 
   // Lock if necessary
--- a/ports/hotspot/src/cpu/zero/vm/disassembler_zero.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/cpu/zero/vm/disassembler_zero.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2007 Red Hat, Inc.
+ * Copyright 2007, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,10 @@
  *
  */
 
-// The disassembler prints out zero code annotated
-// with Java specific information.
-
   static int pd_instruction_alignment() {
-    ShouldNotCallThis();
+    return 1;
   }
 
   static const char* pd_cpu_opts() {
-    ShouldNotCallThis();
+    return "";
   }
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1043,18 +1043,20 @@
     if (is_get) {
       Value *field_value = builder()->CreateLoad(addr);
 
-      if (field_type != stack_type)
-      field_value = builder()->CreateIntCast(
-        field_value, stack_type, basic_type != T_CHAR);
+      if (field_type != stack_type) {
+        field_value = builder()->CreateIntCast(
+          field_value, stack_type, basic_type != T_CHAR);
+      }
 
       value = SharkValue::create_generic(field->type(), field_value, false);
     }
     else {
       Value *field_value = value->generic_value();
 
-      if (field_type != stack_type)
+      if (field_type != stack_type) {
         field_value = builder()->CreateIntCast(
           field_value, field_type, basic_type != T_CHAR);
+      }
 
       builder()->CreateStore(field_value, addr);
 
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -224,11 +224,21 @@
   return make_function((address) SafepointSynchronize::block, "T", "v");
 }
 
+Value* SharkBuilder::throw_ArithmeticException() {
+  return make_function(
+    (address) SharkRuntime::throw_ArithmeticException, "TCi", "v");
+}
+
 Value* SharkBuilder::throw_ArrayIndexOutOfBoundsException() {
   return make_function(
     (address) SharkRuntime::throw_ArrayIndexOutOfBoundsException, "TCii", "v");
 }
 
+Value* SharkBuilder::throw_ClassCastException() {
+  return make_function(
+    (address) SharkRuntime::throw_ClassCastException, "TCi", "v");
+}
+
 Value* SharkBuilder::throw_NullPointerException() {
   return make_function(
     (address) SharkRuntime::throw_NullPointerException, "TCi", "v");
@@ -374,6 +384,10 @@
     "Xxx", "x");
 }
 
+Value* SharkBuilder::frame_address() {
+  return make_function("llvm.frameaddress", "i", "C");
+}
+
 Value* SharkBuilder::memory_barrier() {
   return make_function(
 #ifdef ARM
@@ -414,13 +428,17 @@
   return CreateCall3(cmpxchg_ptr(), dst, compare_value, exchange_value);
 }
 
+CallInst* SharkBuilder::CreateGetFrameAddress() {
+  return CreateCall(frame_address(), LLVMValue::jint_constant(0));
+}
+
 CallInst *SharkBuilder::CreateMemoryBarrier(int flags) {
   Value *args[] = {
     LLVMValue::bit_constant((flags & BARRIER_LOADLOAD) ? 1 : 0),
     LLVMValue::bit_constant((flags & BARRIER_LOADSTORE) ? 1 : 0),
     LLVMValue::bit_constant((flags & BARRIER_STORELOAD) ? 1 : 0),
     LLVMValue::bit_constant((flags & BARRIER_STORESTORE) ? 1 : 0),
-    LLVMValue::bit_constant(0)};
+    LLVMValue::bit_constant(1)};
 
   return CreateCall(memory_barrier(), args, args + 5);
 }
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,9 @@
   llvm::Value* multianewarray();
   llvm::Value* register_finalizer();
   llvm::Value* safepoint();
+  llvm::Value* throw_ArithmeticException();
   llvm::Value* throw_ArrayIndexOutOfBoundsException();
+  llvm::Value* throw_ClassCastException();
   llvm::Value* throw_NullPointerException();
 
   // Intrinsics and external functions, part 2: High-level non-VM calls.
@@ -145,6 +147,7 @@
  private:
   llvm::Value* cmpxchg_int();
   llvm::Value* cmpxchg_ptr();
+  llvm::Value* frame_address();
   llvm::Value* memory_barrier();
   llvm::Value* memset();
   llvm::Value* unimplemented();
@@ -159,6 +162,7 @@
   llvm::CallInst* CreateCmpxchgPtr(llvm::Value* exchange_value,
                                    llvm::Value* dst,
                                    llvm::Value* compare_value);
+  llvm::CallInst* CreateGetFrameAddress();
   llvm::CallInst* CreateMemoryBarrier(int flags);
   llvm::CallInst* CreateMemset(llvm::Value* dst,
                                llvm::Value* value,
--- a/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkNativeWrapper.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2009 Red Hat, Inc.
+ * Copyright 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,7 +218,7 @@
   // Make sure new state is visible in the GC thread
   if (os::is_MP()) {
     if (UseMembar)
-      { Unimplemented(); }
+      builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
     else
       CreateWriteMemorySerializePage();
   }
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -133,6 +133,15 @@
   instanceKlass::register_finalizer(instanceOop(object), CHECK);
 JRT_END
 
+JRT_ENTRY(void, SharkRuntime::throw_ArithmeticException(JavaThread* thread,
+                                                        const char* file,
+                                                        int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ArithmeticException(),
+    "");
+JRT_END
+
 JRT_ENTRY(void, SharkRuntime::throw_ArrayIndexOutOfBoundsException(
                                                      JavaThread* thread,
                                                      const char* file,
@@ -146,6 +155,15 @@
     msg);
 JRT_END
 
+JRT_ENTRY(void, SharkRuntime::throw_ClassCastException(JavaThread* thread,
+                                                       const char* file,
+                                                       int         line))
+  Exceptions::_throw_msg(
+    thread, file, line,
+    vmSymbols::java_lang_ClassCastException(),
+    "");
+JRT_END
+
 JRT_ENTRY(void, SharkRuntime::throw_NullPointerException(JavaThread* thread,
                                                          const char* file,
                                                          int         line))
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -43,10 +43,16 @@
 
   static void register_finalizer(JavaThread* thread, oop object);
 
+  static void throw_ArithmeticException(JavaThread* thread,
+                                        const char* file,
+                                        int         line);
   static void throw_ArrayIndexOutOfBoundsException(JavaThread* thread,
                                                    const char* file,
                                                    int         line,
                                                    int         index);
+  static void throw_ClassCastException(JavaThread* thread,
+                                       const char* file,
+                                       int         line);
   static void throw_NullPointerException(JavaThread* thread,
                                          const char* file,
                                          int         line);
--- a/ports/hotspot/src/share/vm/shark/sharkStack.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkStack.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,9 +28,7 @@
 
 using namespace llvm;
 
-void SharkStack::initialize(Value* method) {
-  bool setup_sp_and_method = (method != NULL);
-
+void SharkStack::initialize(Value* method, bool setup_sp_and_method) {
   int locals_words  = max_locals();
   int extra_locals  = locals_words - arg_size();
   int header_words  = SharkFrame::header_words;
@@ -44,7 +42,7 @@
   Value *stack_pointer = builder()->CreateSub(
     CreateLoadStackPointer(),
     LLVMValue::intptr_constant((frame_words + extra_locals) * wordSize));
-  CreateHardStackOverflowCheck(stack_pointer);
+  CreateStackOverflowCheck(stack_pointer, method);
   if (setup_sp_and_method)
     CreateStoreStackPointer(stack_pointer);
 
@@ -94,35 +92,63 @@
   builder()->CreateStore(CreateLoadFramePointer(), fp);
   CreateStoreFramePointer(
     builder()->CreatePtrToInt(fp, SharkType::intptr_type()));
-
-  // Check we're not about to run out of stack
-  CreateSoftStackOverflowCheck(stack_pointer);
 }
 
-// Check that the stack will not overflow before a stack pointer
-// update.  Overflows here are problematic as we haven't yet
-// created a frame, so it's not clear how to report the error.
-// http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=249
-void SharkStack::CreateHardStackOverflowCheck(Value* sp) {
-  BasicBlock *overflow = CreateBlock("stack_overflow");
-  BasicBlock *no_overflow = CreateBlock("no_overflow");
+// Check that a stack overflow is not imminent, bailing to the
+// interpreter to throw a StackOverflowError if one is while
+// we still have some stack left to do it with.  This function
+// should mirror CppInterpreter::stack_overflow_imminent.
+void SharkStack::CreateStackOverflowCheck(Value* sp, Value* method) {
+  BasicBlock *overflow = CreateBlock("overflow_imminent");
+  BasicBlock *abi_ok   = CreateBlock("abi_stack_ok");
+  BasicBlock *zero_ok  = CreateBlock("zero_stack_ok");
 
-  builder()->CreateCondBr(
-    builder()->CreateICmpULT(sp, stack_base()),
-    overflow, no_overflow);
+  // Check the ABI stack
+  CreateCheckStack(
+    builder()->CreateSub(
+      builder()->CreateValueOfStructEntry(
+        thread(),
+        Thread::stack_base_offset(),
+        SharkType::intptr_type(),
+        "abi_base"),
+      builder()->CreateValueOfStructEntry(
+        thread(),
+        Thread::stack_size_offset(),
+        SharkType::intptr_type(),
+        "abi_size")),
+    builder()->CreatePtrToInt(
+      builder()->CreateGetFrameAddress(),
+      SharkType::intptr_type(),
+      "abi_pointer"),
+    overflow, abi_ok);
 
+  // Check the Zero stack
+  builder()->SetInsertPoint(abi_ok);
+  CreateCheckStack(stack_base(), sp, overflow, zero_ok);
+
+  // Bail to the interpreter if an overflow is imminent
   builder()->SetInsertPoint(overflow);
-  builder()->CreateUnimplemented(__FILE__, __LINE__);
-  builder()->CreateUnreachable();
+  builder()->CreateCall3(
+    builder()->CreateIntToPtr(
+      LLVMValue::intptr_constant((intptr_t) interpreter_entry_point()),
+      PointerType::getUnqual(SharkType::entry_point_type())),
+    method,
+    LLVMValue::intptr_constant(0),
+    thread());
+  builder()->CreateRetVoid();
 
-  builder()->SetInsertPoint(no_overflow);
+  builder()->SetInsertPoint(zero_ok);
 }
 
-// Check that a stack overflow is not imminent, throwing a
-// StackOverflowError if it is while we still have the stack
-// in which to do so.
-void SharkStack::CreateSoftStackOverflowCheck(Value* sp) {
-  // XXX see CppInterpreter::stack_overflow_imminent
+void SharkStack::CreateCheckStack(Value*      base,
+                                  Value*      sp,
+                                  BasicBlock* overflow,
+                                  BasicBlock* no_overflow) {
+  builder()->CreateCondBr(
+    builder()->CreateICmpULT(
+      builder()->CreateSub(sp, base),
+      LLVMValue::intptr_constant(StackShadowPages * os::vm_page_size())),
+    overflow, no_overflow);
 }
 
 Value* SharkStack::CreatePopFrame(int result_slots) {
@@ -176,12 +202,12 @@
   // be set during each decache, so it is not necessary to do them
   // at the time the frame is created.  However, we set them for
   // non-PRODUCT builds to make crash dumps easier to understand.
-  initialize(PRODUCT_ONLY(NULL) NOT_PRODUCT(method));
+  initialize(method, NOT_PRODUCT(true) PRODUCT_ONLY(false));
 }
 SharkStackWithNativeFrame::SharkStackWithNativeFrame(SharkNativeWrapper* wrp,
                                                      Value*              method)
   : SharkStack(wrp), _wrapper(wrp) {
-  initialize(method);
+  initialize(method, true);
 }
 
 int SharkStackWithNormalFrame::arg_size() const {
@@ -218,3 +244,10 @@
 BasicBlock* SharkStackWithNativeFrame::CreateBlock(const char* name) const {
   return wrapper()->CreateBlock(name);
 }
+
+address SharkStackWithNormalFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::normal_entry;
+}
+address SharkStackWithNativeFrame::interpreter_entry_point() const {
+  return (address) CppInterpreter::native_entry;
+}
--- a/ports/hotspot/src/share/vm/shark/sharkStack.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkStack.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,11 +40,16 @@
     : SharkCompileInvariants(parent) {}
 
  protected:
-  void initialize(llvm::Value* method);
+  void initialize(llvm::Value* method, bool setup_sp_and_method);
 
  protected:
-  void CreateHardStackOverflowCheck(llvm::Value* sp);
-  void CreateSoftStackOverflowCheck(llvm::Value* sp);
+  void CreateStackOverflowCheck(llvm::Value* sp, llvm::Value* method);
+
+ private:
+  void CreateCheckStack(llvm::Value*      base,
+                        llvm::Value*      sp,
+                        llvm::BasicBlock* overflow,
+                        llvm::BasicBlock* no_overflow);
 
   // Properties of the method being compiled
  protected:
@@ -57,6 +62,10 @@
  protected:
   virtual llvm::BasicBlock* CreateBlock(const char* name = "") const = 0;
 
+  // Interpreter entry point for bailouts
+ protected:
+  virtual address interpreter_entry_point() const = 0;
+
   // Interface with the Zero stack
  private:
   llvm::Value* zero_stack() const {
@@ -235,6 +244,10 @@
   // BasicBlock creation
  private:
   llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
 };
 
 class SharkStackWithNativeFrame : public SharkStack {
@@ -261,4 +274,8 @@
   // BasicBlock creation
  private:
   llvm::BasicBlock* CreateBlock(const char* name = "") const;
+
+  // Interpreter entry point for bailouts
+ private:
+  address interpreter_entry_point() const;
 };
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,6 +72,18 @@
             Deoptimization::Action_none), bci());
         return;
       }
+
+      // Bail out if we are trying to access a static variable
+      // before the class initializer has completed.
+      if (!is_field && !field->holder()->is_initialized()) {
+        if (!static_field_ok_in_clinit(field)) {
+          set_trap(
+            Deoptimization::make_trap_request(
+              Deoptimization::Reason_uninitialized,
+              Deoptimization::Action_reinterpret), bci());
+          return;
+        }
+      }
       break;
 
     case Bytecodes::_invokestatic:
@@ -139,6 +151,31 @@
   }
 }
 
+bool SharkTopLevelBlock::static_field_ok_in_clinit(ciField* field) {
+  assert(field->is_static(), "should be");
+
+  // This code is lifted pretty much verbatim from C2's
+  // Parse::static_field_ok_in_clinit() in parse3.cpp.
+  bool access_OK = false;
+  if (target()->holder()->is_subclass_of(field->holder())) {
+    if (target()->is_static()) {
+      if (target()->name() == ciSymbol::class_initializer_name()) {
+        // It's OK to access static fields from the class initializer
+        access_OK = true;
+      }
+    }
+    else {
+      if (target()->name() == ciSymbol::object_initializer_name()) {
+        // It's also OK to access static fields inside a constructor,
+        // because any thread calling the constructor must first have
+        // synchronized on the class by executing a "new" bytecode.
+        access_OK = true;
+      }
+    }
+  }
+  return access_OK;
+}
+
 SharkState* SharkTopLevelBlock::entry_state() {
   if (_entry_state == NULL) {
     assert(needs_phis(), "should do");
@@ -329,7 +366,13 @@
       EX_CHECK_NONE);
   }
   else {
-    builder()->CreateUnimplemented(__FILE__, __LINE__);
+    call_vm(
+      builder()->throw_ArithmeticException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
   }
 
   Value *pending_exception = get_pending_exception();
@@ -1344,9 +1387,21 @@
       success, failure);
 
     builder()->SetInsertPoint(failure);
-    builder()->CreateUnimplemented(__FILE__, __LINE__);
-    builder()->CreateUnreachable();
+    SharkState *saved_state = current_state()->copy();
 
+    call_vm(
+      builder()->throw_ClassCastException(),
+      builder()->CreateIntToPtr(
+        LLVMValue::intptr_constant((intptr_t) __FILE__),
+        PointerType::getUnqual(SharkType::jbyte_type())),
+      LLVMValue::jint_constant(__LINE__),
+      EX_CHECK_NONE);
+
+    Value *pending_exception = get_pending_exception();
+    clear_pending_exception();
+    handle_exception(pending_exception, EX_CHECK_FULL);
+
+    set_current_state(saved_state);
     builder()->SetInsertPoint(success);
     push(SharkValue::create_generic(klass, object, false));
   }
@@ -1652,7 +1707,7 @@
 
 void SharkTopLevelBlock::do_monitorexit() {
   pop(); // don't need this (monitors are block structured)
-  release_lock(EX_CHECK_FULL);
+  release_lock(EX_CHECK_NO_CATCH);
 }
 
 void SharkTopLevelBlock::acquire_lock(Value *lockee, int exception_action) {
--- a/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,6 +122,9 @@
  private:
   void scan_for_traps();
 
+ private:
+  bool static_field_ok_in_clinit(ciField* field);
+
   // Entry state
  private:
   bool _entered;
--- a/ports/hotspot/src/share/vm/shark/shark_globals.hpp	Mon Mar 29 00:25:26 2010 +0100
+++ b/ports/hotspot/src/share/vm/shark/shark_globals.hpp	Mon Mar 29 02:54:20 2010 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * Copyright 2008, 2009 Red Hat, Inc.
+ * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,6 @@
  *
  */
 
-//
-// Defines all global flags used by the shark compiler.
-//
-
 #define SHARK_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
                                                                               \
   product(intx, MaxNodeLimit, 65000,                                          \
@@ -40,19 +36,19 @@
   develop(ccstr, SharkPrintTypeflowOf, NULL,                                  \
           "Print the typeflow of the specified method")                       \
                                                                               \
-  develop(ccstr, SharkPrintBitcodeOf, NULL,                                   \
+  diagnostic(ccstr, SharkPrintBitcodeOf, NULL,                                \
           "Print the LLVM bitcode of the specified method")                   \
                                                                               \
-  develop(ccstr, SharkPrintAsmOf, NULL,                                       \
+  diagnostic(ccstr, SharkPrintAsmOf, NULL,                                    \
           "Print the asm of the specified method")                            \
                                                                               \
   develop(bool, SharkTraceBytecodes, false,                                   \
           "Trace bytecode compilation")                                       \
                                                                               \
-  develop(bool, SharkTraceInstalls, false,                                    \
+  diagnostic(bool, SharkTraceInstalls, false,                                 \
           "Trace method installation")                                        \
                                                                               \
-  develop(bool, SharkPerformanceWarnings, false,                              \
+  diagnostic(bool, SharkPerformanceWarnings, false,                           \
           "Warn about things that could be made faster")                      \
 
 SHARK_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG)
--- a/rt/com/sun/jmx/snmp/SnmpDataTypeEnums.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* SnmpDataTypeEnums.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public interface SnmpDataTypeEnums {
-	// Random values chosen to prevent conflicts in switch statements.
-	final static int IpAddressTag = 01;
-	final static int CounterTag = 11;
-	final static int GaugeTag = 21;
-	final static int TimeticksTag = 31;
-	final static int OpaqueTag = 41;
-	int NullTag = 0;
-	final static int errNoSuchObjectTag = 33;
-	final static int errNoSuchInstanceTag = 44;
-	final static int errEndOfMibViewTag = 55;
-	public static final int Counter64Tag = 0;
-}
--- a/rt/com/sun/jmx/snmp/SnmpDefinitions.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/* SnmpDefinitions.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public interface SnmpDefinitions {
-	// Random values chosen to prevent conflicts in switch statements.
-	final int snmpRspNoError = 1230;
-	final int pduGetRequestPdu = 1;
-	final int pduGetNextRequestPdu = 2;
-	final int pduWalkRequest = 3;
-	final int pduSetRequestPdu = 4;
-	final int pduV1TrapPdu = 5;
-	final int pduGetResponsePdu = 6;
-	final int pduInformRequestPdu = 7;
-	final int pduGetBulkRequestPdu = 8;
-	final int pduV2TrapPdu = 9;
-	int snmpVersionOne = 330;
-	int snmpVersionTwo = 220;
-	final int pduReportPdu = 10;
-	int snmpRspWrongEncoding = 0;
-	final int snmpReqUnknownError = 110;
-	final byte noAuthNoPriv = 0;
-	final byte privMask = 0;
-	final int snmpVersionThree = 4430;
-	final int snmpRspGenErr = 0;
-	final int snmpRspNotWritable = 0;
-	final byte authPriv = 0;
-	final int authMask = 0;
-	final int snmpRspNoSuchName = 10;
-	final int snmpRspNoAccess = 20;
-	final int snmpRspReadOnly = 30;
-	final int snmpRspBadValue = 40;
-	final int snmpRspWrongValue = 50;
-	final int snmpRspInconsistentName = 60;
-	final int snmpRspAuthorizationError = 70;
-	final int snmpRspNoCreation = 80;
-	final int snmpRspWrongType = 90;
-	final int snmpRspWrongLength = 110;
-	final int snmpRspInconsistentValue = 220;
-	final int snmpRspResourceUnavailable = 330;
-	final int snmpRspCommitFailed = 440;
-	final int snmpRspUndoFailed = 550;
-	final int snmpRspTooBig = 660;
-	final int snmpV1SecurityModel = 650;
-	final int snmpV2SecurityModel = 560;
-	final int snmpWrongSnmpVersion = 221;	
-	
-}
--- a/rt/com/sun/jmx/snmp/SnmpOid.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/* SnmpOid.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpOid extends SnmpValue {
-
-	public int componentCount = 0;
-	public long[] components;
-	
-	public SnmpOid() {
-	}
-	
-	public SnmpOid(long[] ls) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpOid(String dotAddress) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpOid(long b1, long b2, long b3, long b4) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpOid(long value) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public SnmpValue duplicate() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public String getTypeName() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public SnmpOid toOid() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public long[] longValue() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public int getLength() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void append(SnmpOid source) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void append(int length) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-	public int compareTo(SnmpOid oid) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public long[] longValue(boolean b) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public long getOidArc(int depth) throws SnmpStatusException {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public Byte[] toByte() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpOidRecord.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* SnmpOidRecord.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpOidRecord {
-
-	public SnmpOidRecord(String string, String string2, String string3) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public String getOid() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpOidTable.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* SnmpOidTable.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpOidTable {
-
-	public SnmpOidTable(String string) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpOidRecord resolveVarName(String string) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpOidTableSupport.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/* SnmpOidTableSupport.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpOidTableSupport extends SnmpOidTable {
-	
-	public SnmpOidTableSupport(String string) {
-		super(string);
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-    public void loadMib(SnmpOidRecord[] varList2) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpParameters.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/* SnmpParameters.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpParameters {
-
-	public String getRdCommunity() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public String getInformCommunity() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setRdCommunity(String community) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpPduPacket.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* SnmpPduPacket.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-import java.net.InetAddress;
-
-public class SnmpPduPacket extends SnmpPdu {
-	// Random values chosen to prevent conflicts in switch statements.
-	public int type;
-	public final static int pduGetBulkRequestPdu = 223;
-	public int version;
-	public int snmpVersionTwo;
-	public InetAddress address;
-	public int port;
-	public byte[] community;
-	public int requestId;
-}
--- a/rt/com/sun/jmx/snmp/SnmpPeer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/* SnmpPeer.java -- stub file. 
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-import java.net.InetAddress;
-
-public class SnmpPeer {
-
-	public SnmpPeer(InetAddress address, int port) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpParameters getParams() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public InetAddress getDestAddr() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public int getDestPort() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void setParams(SnmpParameters p) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpSession.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/* SnmpSession.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-import java.net.InetAddress;
-
-import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
-import com.sun.jmx.snmp.daemon.SnmpInformHandler;
-import com.sun.jmx.snmp.daemon.SnmpInformRequest;
-
-public class SnmpSession {
-
-	public SnmpSession(SnmpAdaptorServer server) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpInformRequest makeAsyncRequest(InetAddress addr, String cs, SnmpInformHandler cb, SnmpVarBindList fullVbl, int informPort) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void destroySession() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpTimeticks.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* SnmpTimeticks.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpTimeticks extends SnmpValue {
-
-	public SnmpTimeticks(long l) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public SnmpValue duplicate() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public String getTypeName() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public SnmpOid toOid() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public int longValue() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpVarBind.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/* SnmpVarBind.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpVarBind {
-	// Random values chosen to prevent conflicts in switch statements.
-	public final static int errNoSuchObjectTag = 3;
-	public final static int errNoSuchInstanceTag = 8;
-	public final static int errEndOfMibViewTag = 9;
-	public static SnmpValue noSuchObject;
-	public static SnmpValue noSuchInstance;
-	public static SnmpValue endOfMibView;
-	public SnmpValue value;
-	public SnmpOid oid;
-	public SnmpVarBind(SnmpOid oid2, SnmpValue value2) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-	public SnmpVarBind() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-	public void setSnmpValue(SnmpValue value2) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-	public void setEndOfMibView() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-	public void setNoSuchObject() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/SnmpVarBindList.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/* SnmpVarBindList.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp;
-
-public class SnmpVarBindList {
-
-	public SnmpVarBindList(int i) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpVarBindList() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public int size() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void copyInto(SnmpVarBind[] varBindList) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void insertElementAt(SnmpVarBind bind, int i) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-	
-	public SnmpVarBindList clone() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void add(SnmpVarBind varPoolName) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/jmx/snmp/daemon/SnmpInformRequest.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/* SnmpInformRequest.java -- stub file
-   Copyright (C) 2007 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 com.sun.jmx.snmp.daemon;
-
-public class SnmpInformRequest {
-
-}
--- a/rt/com/sun/jmx/snmp/daemon/SnmpSession.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/* SnmpSession.java -- stub file.
-   Copyright (C) 2007 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 com.sun.jmx.snmp.daemon;
-
-import java.net.InetAddress;
-
-import com.sun.jmx.snmp.SnmpVarBindList;
-import com.sun.jmx.snmp.daemon.SnmpAdaptorServer;
-import com.sun.jmx.snmp.daemon.SnmpInformHandler;
-import com.sun.jmx.snmp.daemon.SnmpInformRequest;
-
-public class SnmpSession {
-
-	public SnmpSession(SnmpAdaptorServer server) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated constructor stub
-	}
-
-	public SnmpInformRequest makeAsyncRequest(InetAddress addr, String cs, SnmpInformHandler cb, SnmpVarBindList fullVbl, int informPort) {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-
-	}
-
-	public void destroySession() {
-		throw new RuntimeException("Not implemented.");
-		// TODO Auto-generated method stub
-		
-	}
-
-}
--- a/rt/com/sun/media/sound/AbstractPlayer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* AbstractPlayer.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class AbstractPlayer
-{
-
-}
-
-
--- a/rt/com/sun/media/sound/HeadspaceMixer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* HeadspaceMixer.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class HeadspaceMixer
-{
-
-}
-
--- a/rt/com/sun/media/sound/HeadspaceSoundbank.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* HeadspaceSoundbank.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class HeadspaceSoundbank
-{
-
-}
-
-
--- a/rt/com/sun/media/sound/MixerClip.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* MixerClip.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class MixerClip
-{
-
-}
-
--- a/rt/com/sun/media/sound/MixerMidiChannel.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* MixerMidiChannel.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class MixerMidiChannel
-{
-
-}
-
-
--- a/rt/com/sun/media/sound/MixerSequencer.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/* MixerSequencer.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-import javax.sound.midi.*;
-import java.io.*;
-
-public class MixerSequencer
-{
-
-  public synchronized void close()
-  {
-  }
-
-  public synchronized void open() throws MidiUnavailableException
-  {
-  }
-
-  public synchronized void setTempoFactor(float f)
-  {
-  }
-
-  public void addMetaEventListener(MetaEventListener mel)
-  {
-  }
-
-  public int[] addControllerEventListener(ControllerEventListener listener, int[] controllers)
-  {
-    return null;
-  }
-
-  public void recordDisable(Track track) {
-  }
-
-  public Sequence getSequence()
-  {
-    return null;
-  }
-
-  public synchronized void start()
-  {
-  }
-
-  public synchronized void stop()
-  {
-  }
- 
-  public boolean isRunning()
-  {
-    return false;
-  }
-
-  public void startRecording()
-  {
-  }
-
-  public void stopRecording()
-  {
-  }
-
-  public void recordEnable(Track t, int i)
-  {
-  }
-
-  public float getTempoInBPM()
-  {
-    return 0;
-  }
-
-  public void setTempoInBPM(float f)
-  {
-  }
-
-  public void setTempoInMPQ(float f)
-  {
-  }
-  
-  public float getTempoInMPQ() {
-     return 0;
-  }
-
-
-  public float getTempoFactor()
-  {
-    return 0;
-  }
-
-  public long getTickLength()
-  {
-    return 0;
-  }
-
-  public long getTickPosition()
-  {
-    return 0;
-  }
-
-  public void setTickPosition(long l)
-  {
-  }
-
-  public long getMicrosecondLength()
-  {
-    return 0;
-  }
-
-  public void setMicrosecondLength(long l)
-  {
-  }
-
-  public void setMasterSyncMode(Sequencer.SyncMode s)
-  {
-  }
-
-  public Sequencer.SyncMode getMasterSyncMode()
-  {
-    return null;
-  }
-
-  public Sequencer.SyncMode[] getMasterSyncModes()
-  {
-    return null;
-  }
-
-  public void setSlaveSyncMode(Sequencer.SyncMode sync)
-  {
-  }
-
-  public Sequencer.SyncMode getSlaveSyncMode()
-  {
-    return null;
-  }
- 
-  public Sequencer.SyncMode[] getSlaveSyncModes()
-  {
-     return null;
-  }
-
-  public synchronized void setTrackMute(int track, boolean mute) {
-  }
-
-  public synchronized boolean getTrackMute(int track) {
-    return false;
-  }
-
-  public synchronized boolean getTrackSolo(int track) {
-    return false;
-  }
-
-  public void removeMetaEventListener(MetaEventListener listener) {
-  }
-
-  public int[] removeControllerEventListener(ControllerEventListener listener, int[] controllers) {
-     return null;
-  }
-
-  public void setLoopStartPoint(long tick) {
-  }
-
-  public long getLoopStartPoint() {
-    return 0;
-  }
-
-  public void setLoopEndPoint(long tick) {
-  }
-
-  public long getLoopEndPoint() {
-    return 0;
-  }
-
-  public void setLoopCount(int count) {
-  }
-
-  public int getLoopCount() {
-    return 0;
-  }
-
-  public synchronized void setSequence(InputStream is)  throws IOException
-  {
-  }
-  
-  public long getMicrosecondPosition() {
-    return 0;
-  }
-
-  public void setMicrosecondPosition(long microseconds) {
-  }
-
-  public synchronized void setTrackSolo(int track, boolean solo) {
-  } 
-
-  public boolean isRecording() {
-    return false;
-  }
-
-}
-
-
--- a/rt/com/sun/media/sound/MixerSourceLine.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* MixerSourceLine.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class MixerSourceLine
-{
-
-}
-
--- a/rt/com/sun/media/sound/MixerSynth.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* MixerSynth.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-import javax.sound.midi.*;
-
-public class MixerSynth
-{
-  public class SynthReceiver
-  {
-     public void send(MidiMessage message, long timeStamp) {
-     }
-     
-     public void sendPackedMidiMessage(int packedMessage, long timeStamp) {
-     }
-
-  }
-}
-
-
--- a/rt/com/sun/media/sound/MixerThread.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* MixerThread.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class MixerThread
-{
-
-}
-
--- a/rt/com/sun/media/sound/SimpleInputDevice.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* SimpleInputDevice.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class SimpleInputDevice
-{
-
-}
-
--- a/rt/com/sun/media/sound/SimpleInputDeviceProvider.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/* SimpleInputDeviceProvider.java -- stub file.
-   Copyright (C) 2007 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 com.sun.media.sound;
-
-public class SimpleInputDeviceProvider
-{
-
-}
-
-
--- a/rt/javax/jnlp/BasicService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/ClipboardService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/DownloadService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/DownloadServiceListener.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/ExtendedService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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 javax.jnlp;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * This interface provides a way for the JNLP application to open specific files
- * in the client's system. It asks permission from the user before opening any
- * files.
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- * 
- */
-public interface ExtendedService {
-
-    /**
-     * Open a file on the client' system and return its contents. The user must
-     * grant permission to the application for this to work.
-     * 
-     * @param file the file to open
-     * @return the opened file as a {@link FileContents} object
-     * @throws IOException on any io problems
-     */
-    FileContents openFile(File file) throws IOException;
-
-    /**
-     * Opens multiple files on the user's sytem and returns their contents as a
-     * {@link FileContents} array
-     * 
-     * @param files the files to open
-     * @return an array of FileContents objects
-     * @throws IOException on any io problems
-     */
-    FileContents[] openFiles(File[] files) throws IOException;
-}
--- a/rt/javax/jnlp/ExtensionInstallerService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/FileContents.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/FileOpenService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/FileSaveService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/JNLPRandomAccessFile.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/PersistenceService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/PrintService.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/ServiceManager.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/ServiceManagerStub.java	Mon Mar 29 00:25:26 2010 +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/rt/javax/jnlp/SingleInstanceListener.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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 javax.jnlp;
-
-/**
- * This interface specifies a listener which is notified whenever a new instance
- * of the web start application is launched.
- * 
- */
-public interface SingleInstanceListener {
-
-    /**
-     * This method is called when a new instance of the application is launched.
-     * The arguments passed to the new instance are passed into this method.
-     * 
-     * @param arguments the arguments passed to the new instance of the
-     *        application
-     */
-    void newActivation(String[] arguments);
-
-}
--- a/rt/javax/jnlp/SingleInstanceService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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 javax.jnlp;
-
-/**
- * The SingleInstanceService provides a way to ensure that only one instance of
- * the application is ever running - singleton behavior at the application
- * level.
- * 
- */
-public interface SingleInstanceService {
-
-    /**
-     * Adds the specified SingleInstanceListener to the notification list. This
-     * listener is notified when a new instance of the application is started.
-     * 
-     * 
-     * @param listener the single instance listener to be added. No action is
-     *        performed if it is null.
-     */
-    void addSingleInstanceListener(SingleInstanceListener listener);
-
-    /**
-     * Removes the specified SingleInstanceListener from the notification list.
-     * This listener will not be notified if a new instance of the application
-     * is started.
-     * 
-     * @param listener the single instance listener to be removed. No action is
-     *        performed if it is null or not in the notification list.
-     */
-    void removeSingleInstanceListener(SingleInstanceListener listener);
-}
--- a/rt/javax/jnlp/UnavailableServiceException.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/AppletDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/ApplicationDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/AssociationDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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;
-
-public final class AssociationDesc {
-
-    /** the extensions this application wants to register with */
-    private String[] extensions;
-
-    /** the mime type for the association */
-    private String mimeType;
-
-    public AssociationDesc(String mimeType, String[] extensions) throws ParseException {
-        checkMimeType(mimeType);
-        this.mimeType = mimeType;
-        this.extensions = extensions;
-    }
-
-    /**
-     * Return the extensions for this association
-     */
-    public String[] getExtensions() {
-        return extensions;
-    }
-
-    /**
-     * Return the mimetype for this association
-     */
-    public String getMimeType() {
-        return mimeType;
-    }
-
-    /**
-     * Check for valid mimeType 
-     * @param mimeType a mime type
-     * @throws ParseException if mimeType is an invalid MIME type
-     */
-    private void checkMimeType(String mimeType) throws ParseException {
-        // TODO check that mime type is valid
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/ComponentDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/DefaultLaunchHandler.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/ExtensionDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +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 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) {
-        this.name = name;
-        this.version = version;
-        this.location = location;
-    }
-
-    /**
-     * 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);
-
-            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;
-    }
-}
-
-
--- a/rt/net/sourceforge/jnlp/IconDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +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";
-    
-    /** destop shortcut icon */
-    public static final Object SHORTCUT = "shortcut";
-
-
-    /** 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/rt/net/sourceforge/jnlp/InformationDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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 associations specified in the JNLP file
-     */
-    public AssociationDesc[] getAssociations() {
-        List associations = getItems("association");
-        
-        return (AssociationDesc[]) associations.toArray(new AssociationDesc[associations.size()]);
-    }
-    
-    /**
-     * Returns the shortcut specified by this JNLP file
-     */
-    public ShortcutDesc getShortcut() {
-        return (ShortcutDesc) getItem("shortcut");
-    }
-    
-    /**
-     * Returns the related-contents specified by this JNLP file
-     */
-    public RelatedContentDesc[] getRelatedContents() {
-        List relatedContents = getItems("related-content");
-        
-        return (RelatedContentDesc[]) relatedContents.toArray(
-                new RelatedContentDesc[relatedContents.size()]);
-    }
-    
-    /**
-     * 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/rt/net/sourceforge/jnlp/InstallerDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/JARDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/JNLPFile.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,623 +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.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-
-import net.sourceforge.jnlp.cache.ResourceTracker;
-import net.sourceforge.jnlp.cache.UpdatePolicy;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * 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;
-    
-    /** A key that uniquely identifies connected instances (main jnlp+ext) */
-    protected String uniqueKey = null;
-
-    /** the URL used to resolve relative URLs in the file */
-    protected URL codeBase;
-
-    /** 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) throws IOException, ParseException {
-        this(location, 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, boolean strict) throws IOException, ParseException {
-        this(location, (Version) null, strict);
-    }
-    
-    /**
-     * Create a JNLPFile from a URL and a Version checking for updates using 
-     * the default policy.
-     *
-     * @param location the location of the JNLP file
-     * @param version the version 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, Version version, boolean strict) throws IOException, ParseException {
-        this(location, version, strict, JNLPRuntime.getDefaultUpdatePolicy());
-    }
-
-    /**
-     * Create a JNLPFile from a URL and a version, checking for updates 
-     * using the specified policy.
-     *
-     * @param location the location of the JNLP file
-     * @param version the version 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, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        Node root = Parser.getRootNode(openURL(location, version, policy));
-        parse(root, strict, location);
-        	
-        //Downloads the original jnlp file into the cache if possible
-        //(i.e. If the jnlp file being launched exist locally, but it 
-        //originated from a website, then download the one from the website
-        //into the cache).  		
-        if (sourceLocation != null && location.getProtocol() == "file") {
-            openURL(sourceLocation, version, policy);
-        }
-
-        this.fileLocation = location;
-        
-        this.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" +
-                         Math.abs(((new java.util.Random()).nextInt())) + "-" +
-                         location;
-
-        if (JNLPRuntime.isDebug())
-            System.err.println("UNIQUEKEY=" + this.uniqueKey);
-    }
-
-    /**
-     * Create a JNLPFile from a URL, parent URLm a version and checking for 
-     * updates using the specified policy.
-     *
-     * @param location the location of the JNLP file
-     * @param uniqueKey A string that uniquely identifies connected instances
-     * @param version the version 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 uniqueKey, Version version, boolean strict, UpdatePolicy policy) throws IOException, ParseException {
-        this(location, version, strict, policy);
-        this.uniqueKey = uniqueKey;
-
-        if (JNLPRuntime.isDebug())
-            System.err.println("UNIQUEKEY (override) =" + this.uniqueKey);
-    }
-
-    /**
-     * 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, Version version, 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, 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 location of the parent file if it exists, null otherwise
-     */
-    public String getUniqueKey() {
-        return uniqueKey;
-    }
-
-    /**
-     * 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 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() != null ? parser.getFileLocation() : location;
-            info = parser.getInfo(root);
-            resources = parser.getResources(root, false); // false == not a j2se/java 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());
-        }
-    }
-
-    /**
-     * 
-     * @return true if the JNLP file specifies things that can only be 
-     * applied on a new vm (eg: different max heap memory)
-     */
-    public boolean needsNewVM() {
-        
-        if (getNewVMArgs().size() == 0) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     *  @return a list of args to pass to the new 
-     *  JVM based on this JNLP file
-     */
-    public List<String> getNewVMArgs() {
-        
-        List<String> newVMArgs = new LinkedList<String>();
-        
-        JREDesc[] jres = getResources().getJREs();
-        for (int jreIndex = 0; jreIndex < jres.length; jreIndex++) {
-            String initialHeapSize = jres[jreIndex].getInitialHeapSize();
-            if (initialHeapSize != null) {
-                newVMArgs.add("-Xms" + initialHeapSize);
-            }
-            
-            String maxHeapSize = jres[jreIndex].getMaximumHeapSize();
-            if (maxHeapSize != null) {
-                newVMArgs.add("-Xmx" + maxHeapSize);
-            }
-            
-            String vmArgsFromJre = jres[jreIndex].getVMArgs();
-            if (vmArgsFromJre != null) {
-                String[] args = vmArgsFromJre.split(" ");
-                newVMArgs.addAll(Arrays.asList(args));
-            }
-        }
-        
-        return newVMArgs;
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/JNLPSplashScreen.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/JREDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +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 J2SE/Java 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 String initialHeapSize;
-
-    /** maximum head size */
-    private String maximumHeapSize;
-
-    /** args to pass to the vm */
-    private String vmArgs;
-    
-    /** 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 vmArgs, String initialHeapSize, 
-            String maximumHeapSize, List resources) throws ParseException {
-        this.version = version;
-        this.location = location;
-        this.vmArgs = vmArgs;
-        checkHeapSize(initialHeapSize);
-        this.initialHeapSize = initialHeapSize;
-        checkHeapSize(maximumHeapSize);
-        this.maximumHeapSize = 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 String getMaximumHeapSize() {
-        return maximumHeapSize;
-    }
-
-    /**
-     * Returns the initial heap size in bytes.
-     */
-    public String getInitialHeapSize() {
-        return initialHeapSize;
-    }
-
-    /**
-     * Returns the resources defined for this JRE.
-     */
-    public List getResourcesDesc() {
-        return resources;
-    }
-
-    /**
-     * Returns the additional arguments to pass to the Java VM
-     * Can be null
-     */
-    public String getVMArgs() {
-        return vmArgs;
-    }
-    
-    /**
-     * Check for valid heap size string
-     * @throws ParseException if heapSize is invalid
-     */
-    static private void checkHeapSize(String heapSize) throws ParseException {
-        // need to implement for completeness even though not used in netx
-        if (heapSize == null) {
-            return;
-        }
-        
-        boolean lastCharacterIsDigit = true;
-        // the last character must be 0-9 or k/K/m/M
-        char lastChar = Character.toLowerCase(heapSize.charAt(heapSize.length()-1));
-        if ((lastChar < '0' || lastChar > '9')) {
-            lastCharacterIsDigit = false;
-            if (lastChar != 'k' && lastChar!= 'm' ) {
-                throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize",new Object[] {heapSize}));
-            }
-        }
-        
-        int indexOfLastDigit = heapSize.length() - 1;
-        if (!lastCharacterIsDigit) {
-            indexOfLastDigit = indexOfLastDigit - 1;
-        }
-        
-        String size = heapSize.substring(0,indexOfLastDigit);
-        try {
-            // check that the number is a number!
-            Integer.valueOf(size);
-        } catch (NumberFormatException numberFormat) {
-            throw new ParseException(JNLPRuntime.getMessage("PBadHeapSize", new Object[] {heapSize}), numberFormat);
-        }
-              
-    }
-
-}
-
-
--- a/rt/net/sourceforge/jnlp/LaunchException.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/LaunchHandler.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/Launcher.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,792 +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.Applet;
-import java.awt.Container;
-import java.io.File;
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadMXBean;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.jar.JarFile;
-
-import net.sourceforge.jnlp.cache.CacheUtil;
-import net.sourceforge.jnlp.cache.ResourceTracker;
-import net.sourceforge.jnlp.cache.UpdatePolicy;
-import net.sourceforge.jnlp.runtime.AppThreadGroup;
-import net.sourceforge.jnlp.runtime.AppletInstance;
-import net.sourceforge.jnlp.runtime.ApplicationInstance;
-import net.sourceforge.jnlp.runtime.JNLPClassLoader;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.services.InstanceExistsException;
-import net.sourceforge.jnlp.services.ServiceUtil;
-import net.sourceforge.jnlp.util.Reflect;
-
-/**
- * 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;
-        
-        //First checks whether offline-allowed tag is specified inside the jnlp
-        //file.
-        if (!file.getInformation().isOfflineAllowed()) {
-            try {
-                //Checks the offline/online status of the system.
-                //If system is offline do not launch.
-                InetAddress.getByName(file.getSourceLocation().getHost());
-
-            } catch (UnknownHostException ue) {
-                System.err.println("File cannot be launched because offline-allowed tag not specified and system currently offline.");
-                return null;
-            } catch (Exception e) {
-                System.err.println(e);
-            }
-        }
-
-        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 vmArgs the arguments to pass to the new JVM. Can be empty but
-     *        must not be null.
-     * @param file the JNLP file to launch
-     * @param javawsArgs the arguments to pass to the javaws command. Can be
-     *        an empty list but must not be null.
-     * @throws LaunchException if there was an exception 
-     */
-    public void launchExternal(List<String> vmArgs, JNLPFile file, List<String> javawsArgs) throws LaunchException {
-        List<String> updatedArgs = new LinkedList<String>(javawsArgs);
-        
-        if (file.getFileLocation() != null)
-            updatedArgs.add(file.getFileLocation().toString());
-        else if (file.getSourceLocation() != null)
-            updatedArgs.add(file.getFileLocation().toString());
-        else
-            launchError(new LaunchException(file, null, R("LSFatal"), R("LCExternalLaunch"), R("LNullLocation"), R("LNullLocationInfo")));
-        
-        launchExternal(vmArgs, updatedArgs);
-        
-    }
-    
-    /**
-     * 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 url the URL of the JNLP file to launch
-     * @throws LaunchException if there was an exception 
-     */
-    public void launchExternal(URL url) throws LaunchException {
-        List<String> javawsArgs = new LinkedList<String>();
-        javawsArgs.add(url.toString());
-        launchExternal(new LinkedList<String>(), javawsArgs);       
-    }
-
-    /**
-     * 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 vmArgs the arguments to pass to the jvm
-     * @param javawsArgs the arguments to pass to javaws (aka Netx)
-     * @throws LaunchException if there was an exception 
-     */
-    public void launchExternal(List<String> vmArgs, List<String> javawsArgs) throws LaunchException {
-        try {
-
-            List<String> commands = new LinkedList<String>();
-            
-            String pathToWebstartBinary = System.getProperty("java.home") + 
-                                      File.separatorChar + 
-                                      "bin" + 
-                                      File.separatorChar + 
-                                      "javaws";
-            commands.add(pathToWebstartBinary);
-            // use -Jargument format to pass arguments to the JVM through the launcher
-            for (String arg: vmArgs) {
-                commands.add("-J" + arg);
-            }
-            commands.addAll(javawsArgs);
-            
-            String[] command = commands.toArray(new String[] {});
-
-            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, (Version) null, true, updatePolicy); // strict
-            }
-            catch (ParseException ex) {
-                file = new JNLPFile(location, (Version) 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 {
-            
-            try {
-                ServiceUtil.checkExistingSingleInstance(file);
-            } catch (InstanceExistsException e) {
-                return null;
-            }
-            
-            if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) {
-                List<String> netxArguments = new LinkedList<String>();
-                netxArguments.add("-Xnofork");
-                netxArguments.addAll(JNLPRuntime.getInitialArguments());
-                launchExternal(file.getNewVMArgs(), netxArguments);
-                return null;
-            }
-            
-            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, 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();
-
-            setContextClassLoaderForAllThreads(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")));
-        }
-    }
-
-    /**
-     * Set the classloader as the context classloader for all threads. This is
-     * required to make some applications work. For example, an application that
-     * provides a custom Swing LnF may ask the swing thread to load resources
-     * from their JNLP, which would only work if the Swing thread knows about
-     * the JNLPClassLoader.
-     * 
-     * @param classLoader the classloader to set as the context classloader
-     */
-    private void setContextClassLoaderForAllThreads(ClassLoader classLoader) {
-        ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
-        ThreadGroup root;
-        
-        root = Thread.currentThread().getThreadGroup();
-        while (root.getParent() != null) {
-            root = root.getParent();
-        }
-
-        /* be prepared for change in thread size */
-        int threadCountGuess = threadBean.getThreadCount();
-        Thread[] threads;
-        do {
-            threadCountGuess = threadCountGuess * 2;
-            threads = new Thread[threadCountGuess];
-            root.enumerate(threads, true);
-        } while (threads[threadCountGuess-1] != null);
-        
-        
-        for (Thread thread: threads) {
-            if (thread != null) {
-                if (JNLPRuntime.isDebug()) {
-                    System.err.println("Setting " + classLoader + " as the classloader for thread " + thread.getName());
-                }
-                thread.setContextClassLoader(classLoader);
-            }
-        }
-        
-    }
-
-    /** 
-     * 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);
-
-            setContextClassLoaderForAllThreads(appletInstance.getClassLoader());
-
-            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("LInitApplication"), R("LInitApplicationInfo"));
-        }
-    }
-
-    /**
-     * 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.
-            }
-        }
-    };
-
-}
-
-
--- a/rt/net/sourceforge/jnlp/MenuDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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;
-
-public class MenuDesc {
-
-    /** the submenu for this menu entry */
-    private String subMenu;
-
-    /**
-     * Create a new menu descriptor
-     */
-    public MenuDesc(String subMenu) {
-        this.subMenu = subMenu;
-    }
-
-    /**
-     * Returns the submenu for this menu entry.
-     */
-    public String getSubMenu() {
-        return subMenu;
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/NetxPanel.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +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 boolean appletAlive;
-
-    public NetxPanel(URL documentURL, Hashtable atts)
-    {
-        super(documentURL, atts);
-    }
-    
-    // overloaded constructor, called when initialized via plugin 
-    public NetxPanel(URL documentURL, Hashtable atts, boolean exitOnFailure)
-    {
-        this(documentURL, atts);
-        this.exitOnFailure = exitOnFailure;
-        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,
-    				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 != null && handler.isAlive() && this.appletAlive;
-    }
-}
-
--- a/rt/net/sourceforge/jnlp/Node.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/PackageDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/ParseException.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/Parser.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1202 +0,0 @@
-// Copyright (C) 2001-2003 Jon A. Maxwell (JAM)
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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 1.5 6.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 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));
-        
-        fileLocation = getURL(root, "href", codebase);
-
-        // 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 or java 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 or java 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) || "java".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/java 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", codebase);
-        String vmArgs = getAttribute(node, "java-vm-args",null);
-        try {
-            checkVMArgs(vmArgs);
-        } catch (IllegalArgumentException argumentException) {
-            vmArgs = null;
-        }
-        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, vmArgs, 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", codebase);
-        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", codebase);
-
-        ExtensionDesc ext = new ExtensionDesc(name, version, location);
-
-        Node dload[] = getChildNodes(node, "ext-download");
-        for (int i=0; i < dload.length; i++) {
-            boolean lazy = "lazy".equals(getAttribute(dload[i], "download", "eager"));
-
-            ext.addPart(getRequiredAttribute(dload[i], "ext-part", null),
-                        getAttribute(dload[i], "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", codebase));
-            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);
-            }
-            if ("association".equals(name)) {
-                addInfo(info, child, null, getAssociation(child));
-            }
-            if ("shortcut".equals(name)) {
-                addInfo(info, child, null, getShortcut(child));
-            }
-            if ("related-content".equals(name)) {
-                addInfo(info, child, null, getRelatedContent(child));
-            }
-
-            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", codebase);
-        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 (codebase != null)
-            return new SecurityDesc(file, type, codebase.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", codebase);
-        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);
-    }
-
-    /**
-     * Returns the association descriptor.
-     */
-    public AssociationDesc getAssociation(Node node) throws ParseException {
-        String[] extensions = getRequiredAttribute(node, "extensions", null).split(" ");
-        String mimeType = getRequiredAttribute(node, "mime-type", null);
-
-        return new AssociationDesc(mimeType, extensions);
-    }
-    
-    /**
-     * Returns the shortcut descriptor.
-     */
-    public ShortcutDesc getShortcut(Node node) throws ParseException {
-        
-        String online = getAttribute(node, "online", "true");
-        boolean shortcutIsOnline = Boolean.valueOf(online);
-        
-        boolean showOnDesktop = false;
-        MenuDesc menu = null;
-        
-        // step through the elements
-        Node child = node.getFirstChild();
-        while (child != null) {
-            String name = child.getNodeName();
-
-            if ("desktop".equals(name)) {
-                if (showOnDesktop && strict) {
-                    throw new ParseException(R("PTwoDesktops"));
-                }
-                showOnDesktop = true;
-            } else if ("menu".equals(name)){
-                if (menu != null && strict) {
-                    throw new ParseException(R("PTwoMenus"));
-                }
-                menu = getMenu(child);
-            }
-            
-            child = child.getNextSibling();
-        }
-        
-        ShortcutDesc shortcut = new ShortcutDesc(shortcutIsOnline, showOnDesktop);
-        if (menu != null) {
-            shortcut.addMenu(menu);
-        }
-        return shortcut;
-    }
-    
-    /**
-     * Returns the menu descriptor.
-     */
-    public MenuDesc getMenu(Node node) {
-        String subMenu = getAttribute(node, "submenu", null);
-        
-        return new MenuDesc(subMenu);
-    }
-
-    
-    /**
-     * Returns the related-content descriptor.
-     */
-    public RelatedContentDesc getRelatedContent(Node node) throws ParseException {
-        
-        getRequiredAttribute(node, "href", null);
-        URL location = getURL(node, "href", codebase);
-        
-        String title = null;
-        String description = null;
-        IconDesc icon = null;
-        
-        // step through the elements
-        Node child = node.getFirstChild();
-        while (child != null) {
-            String name = child.getNodeName();
-            
-            if ("title".equals(name)) {
-                if (title != null && strict) {
-                    throw new ParseException(R("PTwoTitles"));
-                }
-                title = getSpanText(child);
-            } else if ("description".equals(name)) {
-                if (description != null && strict) {
-                    throw new ParseException(R("PTwoDescriptions"));
-                }
-                description = getSpanText(child);
-            } else if ("icon".equals(name)) {
-                if (icon != null && strict) {
-                    throw new ParseException(R("PTwoIcons"));
-                }
-                icon = getIcon(child);
-            }
-            
-            child = child.getNextSibling();
-        }
-        
-        RelatedContentDesc relatedContent = new RelatedContentDesc(location);
-        relatedContent.setDescription(description);
-        relatedContent.setIconDesc(icon);
-        relatedContent.setTitle(title);
-        
-        return relatedContent;
-        
-    }
-    
-    // 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);
-    }
-    
-    /**
-     * Check that the VM args are valid and safe
-     * @param vmArgs a string containing the args
-     * @throws ParseException if the VM arguments are invalid or dangerous
-     */
-    private void checkVMArgs(String vmArgs) throws IllegalArgumentException {
-        if (vmArgs == null) {
-            return;
-        }
-        
-        List<String> validArguments = Arrays.asList(getValidVMArguments());
-        List<String> validStartingArguments = Arrays.asList(getValidStartingVMArguments());
-        
-        String[] arguments = vmArgs.split(" ");
-        boolean argumentIsValid = false;
-        for (String argument: arguments) {
-            argumentIsValid = false;
-            
-            if (validArguments.contains(argument)) {
-                argumentIsValid = true;
-            } else {
-                for (String validStartingArgument: validStartingArguments) {
-                    if (argument.startsWith(validStartingArgument)) {
-                        argumentIsValid = true;
-                        break;
-                    }
-                }
-            }
-            
-            if (!argumentIsValid) {
-                throw new IllegalArgumentException(argument);
-            }
-        }
-        
-    }
-    
-    /**
-     * Returns an array of valid (ie safe and supported) arguments for the JVM
-     * 
-     * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
-     */
-    private String[] getValidVMArguments() {
-        return new String[] {
-        "-d32",                             /* use a 32-bit data model if available */
-        "-client",                          /* to select the client VM */
-        "-server",                          /* to select the server VM */
-        "-verbose",                         /* enable verbose output */
-        "-version",                         /* print product version and exit */
-        "-showversion",                     /* print product version and continue */                              
-        "-help",                            /* print this help message */
-        "-X",                               /* print help on non-standard options */
-        "-ea",                              /* enable assertions */
-        "-enableassertions",                /* enable assertions */
-        "-da",                              /* disable assertions */
-        "-disableassertions",               /* disable assertions */
-        "-esa",                             /* enable system assertions */
-        "-enablesystemassertions",          /* enable system assertions */
-        "-dsa",                             /* disable system assertione */
-        "-disablesystemassertions",         /* disable system assertione */
-        "-Xmixed",                          /* mixed mode execution (default) */
-        "-Xint",                            /* interpreted mode execution only */
-        "-Xnoclassgc",                      /* disable class garbage collection */
-        "-Xincgc",                          /* enable incremental garbage collection */
-        "-Xbatch",                          /* disable background compilation */
-        "-Xprof",                           /* output cpu profiling data */
-        "-Xdebug",                          /* enable remote debugging */
-        "-Xfuture",                         /* enable strictest checks, anticipating future default */
-        "-Xrs",                             /* reduce use of OS signals by Java/VM (see documentation) */
-        "-XX:+ForceTimeHighResolution",     /* use high resolution timer */
-        "-XX:-ForceTimeHighResolution",     /* use low resolution (default) */
-        };
-    }
-
-    /**
-     * Returns an array containing the starts of valid (ie safe and supported)
-     * arguments for the JVM
-     * 
-     * Based on http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html
-     */
-    private String[] getValidStartingVMArguments() {
-        return new String[] {
-        "-ea",                          /* enable assertions for classes */
-        "-enableassertions",            /* enable assertions for classes */
-        "-da",                          /* disable assertions for classes */
-        "-disableassertions",           /* disable assertions for classes */
-        "-verbose",                     /* enable verbose output */
-        "-Xms",                         /* set initial Java heap size */
-        "-Xmx",                         /* set maximum Java heap size */
-        "-Xss",                         /* set java thread stack size */
-        "-XX:NewRatio",                 /* set Ratio of new/old gen sizes */
-        "-XX:NewSize",                  /* set initial size of new generation */
-        "-XX:MaxNewSize",               /* set max size of new generation */
-        "-XX:PermSize",                 /* set initial size of permanent gen */
-        "-XX:MaxPermSize",              /* set max size of permanent gen */
-        "-XX:MaxHeapFreeRatio",         /* heap free percentage (default 70) */
-        "-XX:MinHeapFreeRatio",         /* heap free percentage (default 40) */
-        "-XX:UseSerialGC",              /* use serial garbage collection */
-        "-XX:ThreadStackSize",          /* thread stack size (in KB) */
-        "-XX:MaxInlineSize",            /* set max num of bytecodes to inline */
-        "-XX:ReservedCodeCacheSize",    /* Reserved code cache size (bytes) */
-        "-XX:MaxDirectMemorySize",
-
-        };
-    }
-
-    /**
-     * 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/rt/net/sourceforge/jnlp/PluginBridge.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +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.Calendar;
-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, 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.uniqueKey = Calendar.getInstance().getTimeInMillis() + "-" +
-                         Math.abs(((new java.util.Random()).nextInt())) + "-" +
-                         documentBase;
-    }
-
-    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/rt/net/sourceforge/jnlp/PropertyDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/RelatedContentDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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.net.URL;
-
-public class RelatedContentDesc {
-
-    /** title of the content */
-    private String title = null;;
-
-    /** the description of the content */
-    private String description = null;
-
-    /** the location of the content */
-    private URL location = null;
-
-    /** the icon for this related content */
-    private IconDesc icon = null;
-
-    /**
-     * Create a related-content descriptor
-     * @param href the url of the related content
-     */
-    public RelatedContentDesc(URL href) {
-        this.location = href;
-    }
-
-    /**
-     * Set the title of this content
-     * @param title the title of this content
-     */
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    /**
-     * Returns the title of this content..
-     */
-    public String getTitle() {
-        return title;
-    }
-
-    /**
-     * Set the description of this related content
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Returns the description of the related content
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Returns the location of the related content. Not null
-     */
-    public URL getLocation() {
-        return location;
-    }
-
-    /**
-     * Set the icon for this related content
-     */
-    public void setIconDesc(IconDesc icon) {
-        this.icon = icon;
-    }
-
-    /**
-     * Returns the icon descriptor for the realted content
-     */
-    public IconDesc getIcon() {
-        return icon;
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/ResourcesDesc.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/SecurityDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +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;
-    }
-    
-    /**
-     * Returns a PermissionCollection containing the sandbox permissions
-     */
-    public PermissionCollection getSandBoxPermissions() {
-        
-        Permissions permissions = new Permissions();
-
-        for (int i=0; i < sandboxPermissions.length; i++)
-            permissions.add(sandboxPermissions[i]);
-
-        if (downloadHost != null)
-            permissions.add(new SocketPermission(downloadHost,
-                                                 "connect, accept"));
-
-        // 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/rt/net/sourceforge/jnlp/ShortcutDesc.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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;
-
-public final class ShortcutDesc {
-
-    /** the application wants to be placed on the desktop */
-    private boolean onDesktop = false;
-
-    /** the application needs to be launched online */
-    private boolean requiresOnline = true;
-
-    /** the menu descriptor */
-    private MenuDesc menu = null;
-
-    /**
-     * Create a new Shortcut descriptor
-     * @param requiresOnline whether the shortcut requires connectivity
-     * @param onDesktop whether the shortcut wants to be placed on the desktop
-     */
-    public ShortcutDesc(boolean requiresOnline, boolean onDesktop) {
-        this.requiresOnline = requiresOnline;
-        this.onDesktop = onDesktop;
-    }
-
-    /**
-     * Returns whether the shortcut requires being online
-     */
-    public boolean isOnline() {
-        return requiresOnline;
-    }
-
-    /**
-     * Return whether the shortcut should be placed on the desktop
-     */
-    public boolean onDesktop() {
-        return onDesktop;
-    }
-
-    /**
-     * Add a shortcut to the 'start menu'
-     * (whatever that means on gnome/kde/other ...)
-     * @param menu if/what menu this shortcut should be added to
-     */
-    public void addMenu(MenuDesc menu) {
-        this.menu = menu;
-    }
-
-    /**
-     * Returns the menu this shortcut should be added to
-     */
-    public MenuDesc getMenu() {
-        return menu;
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/StreamEater.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * This class reads the output from a launched process and writes it to stdout.
- */
-public class StreamEater extends Thread {
-    private InputStream stream;
-
-    public 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/rt/net/sourceforge/jnlp/Version.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/cache/CacheEntry.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/cache/CacheUtil.java	Mon Mar 29 00:25:26 2010 +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, Version version, UpdatePolicy policy) {
-        ResourceTracker rt = new ResourceTracker();
-        rt.addResource(location, 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/rt/net/sourceforge/jnlp/cache/DefaultDownloadIndicator.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/cache/DownloadIndicator.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/cache/Resource.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +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;
-    
-    /** 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, Version requestVersion, UpdatePolicy updatePolicy) {
-        this.location = location;
-        this.requestVersion = requestVersion;
-        this.updatePolicy = updatePolicy;
-    }
-
-    /**
-     * Return a shared Resource object representing the given
-     * location and version.
-     */
-    public static Resource getResource(URL location, Version requestVersion, UpdatePolicy updatePolicy) {
-        synchronized (resources) {
-            Resource resource = new Resource(location, requestVersion, updatePolicy);
-
-            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 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/rt/net/sourceforge/jnlp/cache/ResourceTracker.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1051 +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.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Pack200;
-import java.util.jar.Pack200.Unpacker;
-import java.util.zip.GZIPInputStream;
-
-import net.sourceforge.jnlp.Version;
-import net.sourceforge.jnlp.event.DownloadEvent;
-import net.sourceforge.jnlp.event.DownloadListener;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.util.WeakList;
-
-/**
- * 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, Version version, UpdatePolicy updatePolicy) {
-        if (location == null)
-            throw new IllegalArgumentException("location==null");
-
-        Resource resource = Resource.getResource(location, version, updatePolicy);
-        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 a resource to a file, uncompressing it if required
-     * 
-     * @param resource the resource to download
-     */
-    private void downloadResource(Resource resource) {
-        resource.fireDownloadEvent(); // fire DOWNLOADING
-
-        try {
-            // create out second in case in does not exist
-            URLConnection con = getVersionedResourceURL(resource).openConnection();
-            con.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
-            
-            con.connect();
-
-            /*
-             * We dont really know what we are downloading. If we ask for
-             * foo.jar, the server might send us foo.jar.pack.gz or foo.jar.gz
-             * instead. So we save the file with the appropriate extension
-             */
-            URL downloadLocation = resource.location;
-
-            String contentEncoding = con.getContentEncoding();
-
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Content encoding for " + resource.location + ": "
-                        + contentEncoding);
-            }
-
-            if (contentEncoding != null) {
-                if (contentEncoding.equals("gzip")) {
-                    downloadLocation = new URL(downloadLocation.toString() + ".gz");
-                } else if (contentEncoding.equals("pack200-gzip")) {
-                    downloadLocation = new URL(downloadLocation.toString() + ".pack.gz");
-                }
-            }
-
-            InputStream in = new BufferedInputStream(con.getInputStream());
-            OutputStream out = CacheUtil.getOutputStream(downloadLocation, 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();
-            
-            /*
-             * If the file was compressed, uncompress it.
-             */
-            if (contentEncoding != null) {
-                if (contentEncoding.equals("gzip")) {
-                    GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(CacheUtil
-                            .getCacheFile(downloadLocation, resource.downloadVersion)));
-                    InputStream inputStream = new BufferedInputStream(gzInputStream);
-
-                    BufferedOutputStream outputStream = new BufferedOutputStream(
-                            new FileOutputStream(CacheUtil.getCacheFile(resource.location,
-                                    resource.downloadVersion)));
-
-                    while (-1 != (rlen = inputStream.read(buf))) {
-                        outputStream.write(buf, 0, rlen);
-                    }
-
-                    outputStream.close();
-                    inputStream.close();
-                    gzInputStream.close();
-                    
-                } else if (contentEncoding.equals("pack200-gzip")) {
-                    GZIPInputStream gzInputStream = new GZIPInputStream(new FileInputStream(
-                            CacheUtil.getCacheFile(downloadLocation, resource.downloadVersion)));
-                    InputStream inputStream = new BufferedInputStream(gzInputStream);
-
-                    JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(
-                            CacheUtil.getCacheFile(resource.location, resource.downloadVersion)));
-
-                    Unpacker unpacker = Pack200.newUnpacker();
-                    unpacker.unpack(inputStream, outputStream);
-
-                    outputStream.close();
-                    inputStream.close();
-                    gzInputStream.close();
-                }
-            }
-            
-            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
-            connection.addRequestProperty("Accept-Encoding", "pack200-gzip, gzip");
-
-            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
-        }
-    }
-
-    /**
-     * Returns the versioned url for a resource
-     * @param resource the resource to get the url for 
-     */
-    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/rt/net/sourceforge/jnlp/cache/UpdatePolicy.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/cache/package.html	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/event/ApplicationEvent.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/event/ApplicationListener.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/event/DownloadEvent.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/event/DownloadListener.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/event/package.html	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/package.html	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/resources/Manifest.mf	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/resources/Messages.properties	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +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.
-PTwoDesktops=Only one desktop element allowed
-PTwoMenus=Only one menu element allowed
-PTwoTitles=Only one title element allowed
-PTwoIcons=Only one icon element allowed
-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.
-PBadHeapSize=Invalid value for heap size ({0})
-
-# 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.
-RNoLockDir=Unable to create locks directory ({0})
-RNestedJarExtration=Unable to extract nested jar.
-RUnexpected=Unexpected {0} at {1}
-
-# 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.
-BXnofork    = Do not create another JVM.
-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?
-SDesktopShortcut=The application has requested permission to create a desktop launcher. 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.
-SCNMisMatch=The expected hostname for this certificate is: "{0}"<BR>The address being connected to is: "{1}"
-SRunWithoutRestrictions=This application will be run without the security restrictions normally provided by java.
-
-
--- a/rt/net/sourceforge/jnlp/resources/about.jnlp	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/resources/default.jnlp	Mon Mar 29 00:25:26 2010 +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 rt/net/sourceforge/jnlp/resources/info-small.png has changed
Binary file rt/net/sourceforge/jnlp/resources/install.png has changed
Binary file rt/net/sourceforge/jnlp/resources/netx-icon.png has changed
Binary file rt/net/sourceforge/jnlp/resources/warning-small.png has changed
Binary file rt/net/sourceforge/jnlp/resources/warning.png has changed
--- a/rt/net/sourceforge/jnlp/runtime/AppThreadGroup.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/AppletAudioClip.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/AppletEnvironment.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/AppletInstance.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/ApplicationInstance.java	Mon Mar 29 00:25:26 2010 +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.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.security.SecurityWarningDialog.AccessType;
-import net.sourceforge.jnlp.services.ServiceUtil;
-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();
-
-        //Fixme: -Should check whether a desktop entry already exists for
-        //        for this jnlp file, and do nothing if it exists.
-        //       -If no href is specified in the jnlp tag, it should 
-        //        default to using the one passed in as an argument.
-        addMenuAndDesktopEntries();
-    }
-
-    /**
-     * Creates menu and desktop entries if required by the jnlp file
-     */
-
-    private void addMenuAndDesktopEntries() {
-        XDesktopEntry entry = new XDesktopEntry(file);
-        ShortcutDesc sd = file.getInformation().getShortcut();
-
-        if (sd != null && sd.onDesktop()) {
-            if (ServiceUtil.checkAccess(this, AccessType.CREATE_DESTKOP_SHORTCUT)) {
-                entry.createDesktopShortcut();
-            }
-        }
-
-        if (sd != null && sd.getMenu() != null) {
-            /*
-             * Sun's WebStart implementation doesnt seem to do anything under GNOME
-             */
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("ApplicationInstance.addMenuAndDesktopEntries():"
-                        + " Adding menu entries NOT IMPLEMENTED");
-            }
-        }
-
-    }
-
-    /**
-     * 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/rt/net/sourceforge/jnlp/runtime/Boot.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +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.Arrays;
-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 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"
-        + "  -Xnofork              "+R("BXnofork")+"\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);
-        
-        if (null != getOption("-Xnofork")) {
-            JNLPRuntime.setForksAllowed(false);
-        }
-        
-        // 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();
-        }
-
-        JNLPRuntime.setInitialArgments(Arrays.asList(argsIn));
-        
-        // 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());
-
-    }
-
-    /**
-     * 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(JNLPRuntime.getMessage("RUnexpected", 
-                        new Object[] {ex.toString(), ex.getStackTrace()[0]} ));
-        }
-
-        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(JNLPRuntime.NETX_ABOUT_FILE).exists())
-            return JNLPRuntime.NETX_ABOUT_FILE;
-        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, strict);
-
-        // Launches the jnlp file where this file originated. 
-        if (file.getSourceLocation() != null) {
-            file = new JNLPFile(file.getSourceLocation(), 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 JNLPRuntime.NETX_ABOUT_FILE file.
-     * 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
-        File basedir = JNLPRuntime.getDefaultBaseDir();
-        if (basedir == null)
-            fatalError(R("BNoBase"));
-
-        return basedir;
-    }
-
-}
-
--- a/rt/net/sourceforge/jnlp/runtime/Boot13.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1052 +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.Version;
-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() {
-		
-        URL codebase = null;
-
-        if (file.getCodeBase() != null) {
-            codebase = file.getCodeBase();
-        } else {
-            //Fixme: codebase should be the codebase of the Main Jar not 
-            //the location. Although, it still works in the current state.
-            codebase = file.getResources().getMainJAR().getLocation();
-        }
-
-        /**
-         * 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,
-                    codebase.getHost());
-            } else {
-                this.security = new SecurityDesc(file, 
-                    SecurityDesc.SANDBOX_PERMISSIONS, 
-                    codebase.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, 
-                        codebase.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 baseLoader = null;
-        JNLPClassLoader loader = null;
-        String uniqueKey = file.getUniqueKey();
-
-        if (uniqueKey != null)
-            baseLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
-
-		try {
-		    
-		    // If base loader is null, or the baseloader's file and this 
-		    // file is different, initialize a new loader
-		    if (baseLoader == null || 
-		        !baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation())) {
-
-		        loader = new JNLPClassLoader(file, policy);
-
-		        // New loader init may have caused extentions to create a 
-		        // loader for this unique key. Check.
-		        JNLPClassLoader extLoader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
-
-		        if (extLoader != null) {
-		            for (URL u : loader.getURLs())
-		                extLoader.addURL(u);
-
-		            loader = extLoader;
-		        }
-
-                // loader is now current + ext. But we also need to think of 
-                // the baseLoader
-		        if (baseLoader != null) {
-                    for (URL u : loader.getURLs())
-                        baseLoader.addURL(u);
-
-                    loader = baseLoader;
-                } 
-
-		    } else {
-		        // if key is same and locations match, this is the loader we want
-		        loader = baseLoader;
-		    }
-
-		} catch (LaunchException e) {
-			throw e;
-		}
-
-        // loaders are mapped to a unique key. Only extensions and parent 
-        // share a key, so it is safe to always share based on it
-        urlToLoader.put(uniqueKey, loader);
-
-        return loader;
-    }
-
-    /**
-     * Returns a JNLP classloader for the JNLP file at the specified
-     * location. 
-     *
-     * @param location the file's location
-     * @param version the file's version
-     * @param policy the update policy to use when downloading resources
-     */
-    public static JNLPClassLoader getInstance(URL location, String uniqueKey, Version version, UpdatePolicy policy)
-            throws IOException, ParseException, LaunchException {
-        JNLPClassLoader loader = (JNLPClassLoader) urlToLoader.get(uniqueKey);
-
-        if (loader == null || !location.equals(loader.getJNLPFile().getFileLocation()))
-            loader = getInstance(new JNLPFile(location, uniqueKey, version, 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 {
-                    String uniqueKey = this.getJNLPFile().getUniqueKey();
-                    JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), 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(),
-                                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) {
-            // Security desc. is used only to track security settings for the
-            // application. However, an application may comprise of multiple
-            // jars, and as such, security must be evaluated on a per jar basis.
-            
-            // set default perms
-            PermissionCollection permissions = security.getSandBoxPermissions();
-            
-            // If more than default is needed, evaluate based on codesource
-            if (security.getSecurityType().equals(SecurityDesc.ALL_PERMISSIONS) ||
-                security.getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS)) {
-
-                if (cs.getCodeSigners() != null) {
-                    permissions = security.getPermissions();
-                }
-            }
-
-            Enumeration<Permission> e = permissions.elements();
-            while (e.hasMoreElements())
-                result.add(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();
-                                    File parentDir = new File(extractedJarLocation).getParentFile();
-                                    if (!parentDir.isDirectory() && !parentDir.mkdirs()) {
-                                        throw new RuntimeException(R("RNestedJarExtration"));
-                                    }
-                                    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(),
-                                    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/rt/net/sourceforge/jnlp/runtime/JNLPPolicy.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,559 +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.util.List;
-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; 
-    
-    /** set to false to indicate another JVM should not be spawned, even if necessary */
-    private static boolean forksAllowed = true;
-
-    /** contains the arguments passed to the jnlp runtime */
-    private static List<String> initialArguments;
-
-    /** Username */
-    public static final String USER = System.getProperty("user.name");
-
-    /** User's home directory */
-    public static final String HOME_DIR = System.getProperty("user.home");
-
-    /** the ~/.netxrc file containing netx settings */
-    public static final String NETXRC_FILE = HOME_DIR + File.separator + ".netxrc";
-
-    /** the ~/.netx directory containing user-specific data */
-    public static final String NETX_DIR = HOME_DIR + File.separator + ".netx";
-
-    /** the ~/.netx/security directory containing security related information */
-    public static final String SECURITY_DIR = NETX_DIR + File.separator + "security";
-
-    /** the ~/.netx/security/trusted.certs file containing trusted certificates */
-    public static final String CERTIFICATES_FILE = SECURITY_DIR + File.separator + "trusted.certs";
-
-    /** the /tmp/ directory used for temporary files */
-    public static final String TMP_DIR = System.getProperty("java.io.tmpdir");
-
-    /**
-     * the /tmp/$USER/netx/locks/ directory containing locks for single instance
-     * applications
-     */
-    public static final String LOCKS_DIR = TMP_DIR + File.separator + USER + File.separator
-            + "netx" + File.separator + "locks";
-
-    /** the java.home directory */
-    public static final String JAVA_HOME_DIR = System.getProperty("java.home");
-    
-    /** the JNLP file to open to display the network-based about window */
-    public static final String NETX_ABOUT_FILE = JAVA_HOME_DIR + File.separator + "lib"
-            + File.separator + "about.jnlp";
-
-    
-    
-    /**
-     * 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();
-
-        String baseStr = props.getProperty("basedir");
-        if (baseStr != null)
-            return new File(baseStr);
-
-        String homeDir = HOME_DIR;
-        File baseDir = new File(NETX_DIR);
-        if (homeDir == null || (!baseDir.isDirectory() && !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(NETXRC_FILE);
-        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);
-    }
-
-    /**
-     * Returns true if the current runtime will fork
-     */
-    public static boolean getForksAllowed() {
-        return forksAllowed;
-    }
-    
-    public static void setForksAllowed(boolean value) {
-        checkInitialized();
-        forksAllowed = value;
-    }
-    
-    /**
-     * 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();
-        }
-    }
-
-
-    public static void setInitialArgments(List<String> args) {
-        checkInitialized();
-        SecurityManager securityManager = System.getSecurityManager();
-        if (securityManager != null)
-            securityManager.checkPermission(new AllPermission());
-        initialArguments = args;
-    }
-    
-    public static List<String> getInitialArguments() {
-        return initialArguments;
-    }
-    
-}
-
-
--- a/rt/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,556 +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 java.util.PropertyPermission;
-
-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 = null;
-				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 if (perm instanceof PropertyPermission) {
-
-				    if (JNLPRuntime.isDebug())
-				        System.err.println("Requesting property: " + perm.toString());
-
-				    // We go by the rules here:
-				    // http://java.sun.com/docs/books/tutorial/deployment/doingMoreWithRIA/properties.html
-
-				    // Since this is security sensitive, take a conservative approach:
-				    // Allow only what is specifically allowed, and deny everything else
-
-				    // First, allow what everyone is allowed to read
-				    if (perm.getActions().equals("read")) {
-				        if (    perm.getName().equals("java.class.version") ||
-				                perm.getName().equals("java.vendor") ||
-				                perm.getName().equals("java.vendor.url")  ||
-				                perm.getName().equals("java.version") ||
-				                perm.getName().equals("os.name") ||
-				                perm.getName().equals("os.arch") ||
-				                perm.getName().equals("os.version") ||
-				                perm.getName().equals("file.separator") ||
-				                perm.getName().equals("path.separator") ||
-				                perm.getName().equals("line.separator") ||
-				                perm.getName().startsWith("javaplugin.")
-				            ) {
-				            return;
-				        }
-				    }
-
-				    // Next, allow what only JNLP apps can do
-				    if (getApplication().getJNLPFile().isApplication()) {
-				        if (    perm.getName().equals("awt.useSystemAAFontSettings") ||
-				                perm.getName().equals("http.agent") ||
-				                perm.getName().equals("http.keepAlive") ||
-				                perm.getName().equals("java.awt.syncLWRequests") ||
-				                perm.getName().equals("java.awt.Window.locationByPlatform") ||
-				                perm.getName().equals("javaws.cfg.jauthenticator") ||
-				                perm.getName().equals("javax.swing.defaultlf") ||
-				                perm.getName().equals("sun.awt.noerasebackground") ||
-				                perm.getName().equals("sun.awt.erasebackgroundonresize") ||
-				                perm.getName().equals("sun.java2d.d3d") ||
-				                perm.getName().equals("sun.java2d.dpiaware") ||
-				                perm.getName().equals("sun.java2d.noddraw") ||
-				                perm.getName().equals("sun.java2d.opengl") ||
-				                perm.getName().equals("swing.boldMetal") ||
-				                perm.getName().equals("swing.metalTheme") ||
-				                perm.getName().equals("swing.noxp") ||
-				                perm.getName().equals("swing.useSystemFontSettings")
-				        ) {
-				            return; // JNLP apps can read and write to these
-				        }
-				    }
-
-				    // Next, allow access to customizable properties 
-				    if (perm.getName().startsWith("jnlp.") || 
-				        perm.getName().startsWith("javaws.")) {
-				        return;
-				    }
-
-				    // Everything else is denied
-				    throw se;
-
-				} else {
-				    tmpPerm = perm;
-				}
-
-				if (tmpPerm != null) {
-				    //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/rt/net/sourceforge/jnlp/runtime/package.html	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/AccessWarningPane.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +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 CREATE_DESTKOP_SHORTCUT:
-			    topLabelText = R("SDesktopShortcut");
-			    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/rt/net/sourceforge/jnlp/security/AppletWarningPane.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/CertVerifier.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/CertWarningPane.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +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 = SecurityUtil.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 = SecurityUtil.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>";
-    }
-
-	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/rt/net/sourceforge/jnlp/security/CertsInfoPane.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +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 = 
-			SecurityUtil.getCN(firstCert.getSubjectX500Principal().getName());
-		String issuerString = 
-			SecurityUtil.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 = 
-				SecurityUtil.getCN(secondCert.getSubjectX500Principal().getName());
-			issuerString = 
-				SecurityUtil.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] = SecurityUtil.getCN(c.getSubjectX500Principal().getName())
-				+ " (" + SecurityUtil.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);
-	}
-
-	/**
-	 * 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/rt/net/sourceforge/jnlp/security/HttpsCertVerifier.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +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.io.IOException;
-import java.security.cert.CertPath;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateExpiredException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateNotYetValidException;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.tools.KeyTool;
-import sun.security.util.DerValue;
-import sun.security.util.HostnameChecker;
-import sun.security.x509.X500Name;
- 
-public class HttpsCertVerifier implements CertVerifier {
-
-    private VariableX509TrustManager tm;
-    private X509Certificate[] chain;
-    private String authType;
-    private String hostName;
-    private boolean isTrusted;
-    private boolean hostMatched;
-    private ArrayList<String> details = new ArrayList<String>();
-    
-    public HttpsCertVerifier(VariableX509TrustManager tm, 
-                             X509Certificate[] chain, String authType, 
-                             boolean isTrusted, boolean hostMatched,
-                             String hostName) {
-        this.tm = tm;
-        this.chain = chain;
-        this.authType = authType;
-        this.hostName = hostName;
-        this.isTrusted = isTrusted;
-        this.hostMatched = hostMatched;
-    }
-
-    public boolean getAlreadyTrustPublisher() {
-        return isTrusted;
-    }
-
-    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; 
-	boolean CNMisMatch = !hostMatched;
-
-	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;
-	   }
-	}
-
-	String altNames = getNamesForCert(chain[0]);
-
-	if (isUntrusted || hasExpiredCert || hasExpiringCert || notYetValidCert || CNMisMatch) {
-	      if (isUntrusted)
-	        addToDetails(R("SUntrustedCertificate"));
-              if (hasExpiredCert)
-                addToDetails(R("SHasExpiredCert"));
-              if (hasExpiringCert)
-                addToDetails(R("SHasExpiringCert"));
-              if (notYetValidCert)
-                addToDetails(R("SNotYetValidCert"));
-              if (CNMisMatch)
-                  addToDetails(R("SCNMisMatch", altNames, this.hostName));  
-        }
-	
-	
-	return details;
-    }
-
-    private String getNamesForCert(X509Certificate c) {
-        
-        String names = "";
-        
-        
-        // We use the specification from 
-        // http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/X509Certificate.html#getSubjectAlternativeNames()
-        // to determine the type of address
-        int ALTNAME_DNS = 2;
-        int ALTNAME_IP = 7;
-
-        try {
-            Collection<List<?>> subjAltNames = c.getSubjectAlternativeNames();
-            X500Name subjectName = HostnameChecker.getSubjectX500Name(c);
-            DerValue derValue = subjectName.findMostSpecificAttribute
-                                                        (X500Name.commonName_oid);
-            names += derValue.getAsString();
-
-            if (subjAltNames != null) {
-                for (List<?> next : subjAltNames) {
-                    if ( ((Integer)next.get(0)).intValue() == ALTNAME_IP || 
-                            ((Integer)next.get(0)).intValue() == ALTNAME_DNS
-                    ) {
-                        names += ", " + (String)next.get(1);
-                    }
-                }
-            }
-            
-            if (subjAltNames != null)
-                names = names.substring(2); // remove proceeding ", "
-
-        } catch (CertificateParsingException cpe) {
-            cpe.printStackTrace();
-        } catch (IOException ioe) {
-            ioe.printStackTrace();
-        }
-
-        return names;
-    }
-    
-    private void addToDetails(String detail) {
-      if (!details.contains(detail))
-        details.add(detail);
-    }
-
-    private static String R(String key) {
-      return JNLPRuntime.getMessage(key);
-    }
-    
-    private static String R(String key, String arg1, String arg2) {
-        return JNLPRuntime.getMessage(key, new Object[] { arg1, arg2 });
-    }
-
-    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/rt/net/sourceforge/jnlp/security/MoreInfoPane.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/SecurityDialogUI.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/SecurityUtil.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +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;
-
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-public class SecurityUtil {
-
-	private static final char[] password = "changeit".toCharArray();
-	
-	public static String getTrustedCertsFilename() throws Exception{
-		
-		String homeDir = JNLPRuntime.HOME_DIR;
-		
-		if (homeDir == null) {
-			throw new Exception("Could not access home directory");
-		} else {
-			return JNLPRuntime.CERTIFICATES_FILE;
-		}
-	}
-	
-	public static char[] getTrustedCertsPassword() {
-		return password;
-	}
-	
-    /**
-     * Extracts the CN field from a Certificate principal string. Or, if it
-     * can't find that, return the principal unmodified.
-     * 
-     * This is a simple (and hence 'wrong') version. See
-     * http://www.ietf.org/rfc/rfc2253.txt for all the gory details.
-     */
-    public static String getCN(String principal) {
-
-        /*
-         * FIXME Incomplete
-         * 
-         * This does not implement RFC 2253 completely
-         * 
-         * Issues:
-         * - rfc2253 talks about utf8, java uses utf16.
-         * - theoretically, java should have dealt with all byte encodings
-         *   so we shouldnt even see cases like \FF
-         * - if the above is wrong, then we need to deal with cases like 
-         *   \FF\FF
-         */
-
-        int start = principal.indexOf("CN=");
-        if (start == -1) {
-            return principal;
-        }
-
-        StringBuilder commonName = new StringBuilder();
-
-        boolean inQuotes = false;
-        boolean escaped = false;
-
-        /*
-         * bit 0 = high order bit. bit 1 = low order bit
-         */
-        char[] hexBits = null;
-
-        for (int i = start + 3; i < principal.length(); i++) {
-            char ch = principal.charAt(i);
-            switch (ch) {
-            case '"':
-                if (escaped) {
-                    commonName.append(ch);
-                    escaped = false;
-                } else {
-                    inQuotes = !inQuotes;
-                }
-                break;
-
-            case '\\':
-                if (escaped) {
-                    commonName.append(ch);
-                    escaped = false;
-                } else {
-                    escaped = true;
-                }
-                break;
-
-            case ',':
-                /* fall through */
-            case ';':
-                /* fall through */
-            case '+':
-                if (escaped || inQuotes) {
-                    commonName.append(ch);
-                    if (escaped) {
-                        escaped = false;
-                    }
-                } else {
-                    return commonName.toString();
-                }
-                break;
-
-            default:
-                if (escaped && isHexDigit(ch)) {
-                    hexBits = new char[2];
-                    hexBits[0] = ch;
-                } else if (hexBits != null) {
-                    if (!isHexDigit(ch)) {
-                        /* error parsing */
-                        return "";
-                    }
-                    hexBits[1] = ch;
-                    commonName.append((char) Integer.parseInt(new String(hexBits), 16));
-                    hexBits = null;
-                } else {
-                    commonName.append(ch);
-                }
-                escaped = false;
-            }
-        }
-
-        return commonName.toString();
-
-    }
-
-    private static boolean isHexDigit(char ch) {
-        return ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'));
-    }
-
-	/**
-	 * 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 = certFile.getAbsoluteFile().getParentFile();
-			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/rt/net/sourceforge/jnlp/security/SecurityWarningDialog.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,430 +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,
-        CREATE_DESTKOP_SHORTCUT,
-        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/rt/net/sourceforge/jnlp/security/SingleCertInfoPane.java	Mon Mar 29 00:25:26 2010 +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 = 
-			SecurityUtil.getCN(cert.getSubjectX500Principal().getName());
-		String issuerString = 
-			SecurityUtil.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] = SecurityUtil.getCN(c.getSubjectX500Principal().getName())
-		+ " (" + SecurityUtil.getCN(c.getIssuerX500Principal().getName()) + ")";
-	}
-}
--- a/rt/net/sourceforge/jnlp/security/VariableX509TrustManager.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +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.util.HostnameChecker;
-import sun.security.validator.ValidatorException;
-
-import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
-
-/**
- * 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 extends X509ExtendedTrustManager {
-
-    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 (no support for custom here, only system/user)
-     */
-    public void checkClientTrusted(X509Certificate[] chain, String authType, 
-                                   String hostName, String algorithm)
-            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 checkClientTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-        checkClientTrusted(chain, authType, null, null);
-    }
-
-    public void checkServerTrusted(X509Certificate[] chain, String authType, 
-                                   String hostName, String algorithm)
-            throws CertificateException {
-        checkServerTrusted(chain, authType, hostName, false);
-    }
-    
-    public void checkServerTrusted(X509Certificate[] chain, String authType)
-            throws CertificateException {
-        checkServerTrusted(chain, authType, null, null);
-    }
-
-    /**
-     * 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 synchronized void checkServerTrusted(X509Certificate[] chain, 
-                             String authType, String hostName, 
-                             boolean checkOnly) throws CertificateException {
-        CertificateException ce = null;
-        boolean trusted = true;
-        boolean CNMatched = true;
-
-        try {
-            checkAllManagers(chain, authType);
-        } catch (CertificateException e) {
-            trusted = false;
-            ce = e;
-        }
-
-        // If the certificate is not explicitly trusted, we 
-        // need to prompt the user
-        if (!isExplicitlyTrusted(chain, authType)) {
-
-            try {
-                HostnameChecker checker = HostnameChecker
-                        .getInstance(HostnameChecker.TYPE_TLS);
-
-                checker.match(hostName, chain[0]); // only need to match @ 0 for
-                                                   // CN
-
-            } catch (CertificateException e) {
-                CNMatched = false;
-                ce = e;
-            }
-        }
-
-        if (!trusted || !CNMatched) {
-            if (checkOnly) {
-                throw ce;
-            } else {
-
-                boolean b = askUser(chain, authType, trusted, CNMatched, hostName);
-
-                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;
-            }
-        }        
-    }
-    
-    /**
-     * Return if the user explicitly trusted this i.e. in userTrustManager or temporarilyTrusted
-     */
-    private boolean isExplicitlyTrusted(X509Certificate[] chain, String authType) {
-        boolean explicitlyTrusted = false;
-        
-        try {
-            userTrustManager.checkServerTrusted(chain, authType);
-            explicitlyTrusted = true;
-        } catch (ValidatorException uex) {
-            if (temporarilyTrusted.contains(chain[0]))
-                explicitlyTrusted = true;
-        } catch (CertificateException ce) {
-            // do nothing, this means that the cert is not explicitly trusted
-        }
-
-        return explicitlyTrusted;
-        
-    }
-
-    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, 
-                            boolean isTrusted, boolean hostMatched, 
-                            String hostName) {
-    	return SecurityWarningDialog.showCertWarningDialog(
-    	                SecurityWarningDialog.AccessType.UNVERIFIED, null, 
-    	                new HttpsCertVerifier(this, chain, authType, 
-    	                                      isTrusted, hostMatched,
-    	                                      hostName)); 
-    }
-
-    /**
-     * Return an instance of this singleton
-     * 
-     * @return The instance
-     */
-    public static VariableX509TrustManager getInstance() {
-        if (instance == null)
-            instance = new VariableX509TrustManager();
-        
-        return instance;
-    }
-}
--- a/rt/net/sourceforge/jnlp/security/viewer/CertificatePane.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/ExtendedSingleInstanceService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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 javax.jnlp.SingleInstanceService;
-
-import net.sourceforge.jnlp.JNLPFile;
-
-/**
- * Extends SingleInstanceService to provide a few additional methods that are
- * required to initialize SingleInstanceService and check things. These methods
- * are not exposed publicly
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- * 
- */
-interface ExtendedSingleInstanceService extends SingleInstanceService {
-
-    /**
-     * Check if the instance identified by this jnlp file is already running
-     * 
-     * @param jnlpFile The JNLPFile that specifies the application
-     * 
-     * @throws InstanceExistsException if an instance of this application
-     *         already exists
-     * 
-     */
-    void checkSingleInstanceRunning(JNLPFile jnlpFile);
-
-    /**
-     * Start a single instance service based on the current application
-     */
-    void initializeSingleInstance();
-
-}
--- a/rt/net/sourceforge/jnlp/services/InstanceExistsException.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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;
-
-/**
- * 
- * This class represents an exception indicating that an application instance
- * already exists for this jnlp file
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- * 
- */
-public class InstanceExistsException extends RuntimeException {
-
-    private static final long serialVersionUID = 7950552292795498272L;
-
-    public InstanceExistsException(String message) {
-        super(message);
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/services/ServiceUtil.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +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.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.jnlp.BasicService;
-import javax.jnlp.ClipboardService;
-import javax.jnlp.DownloadService;
-import javax.jnlp.ExtensionInstallerService;
-import javax.jnlp.FileOpenService;
-import javax.jnlp.FileSaveService;
-import javax.jnlp.PersistenceService;
-import javax.jnlp.PrintService;
-import javax.jnlp.ServiceManager;
-import javax.jnlp.SingleInstanceService;
-import javax.jnlp.UnavailableServiceException;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.runtime.ApplicationInstance;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-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);
-    }
-
-    /**
-     * 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 SingleInstanceService reference, or null if the service is
-     * unavailable.
-     */
-    public static SingleInstanceService getSingleInstanceService() {
-        return (SingleInstanceService) getService("javax.jnlp.SingleInstanceService");
-    }
-    
-    /**
-     * Checks that this application (represented by the jnlp) isnt already running
-     * @param jnlpFile the {@link JNLPFile} that specifies the application
-     * 
-     * @throws InstanceExistsException if an instance of this application already exists
-     */
-    public static void checkExistingSingleInstance(JNLPFile jnlpFile) {
-        ExtendedSingleInstanceService esis = (ExtendedSingleInstanceService) getSingleInstanceService();
-        esis.checkSingleInstanceRunning(jnlpFile);
-    }
-    
-    /**
-     * 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);
-                }
-            };
-
-            try {
-                Object result = AccessController.doPrivileged(invoker);
-
-                if (JNLPRuntime.isDebug())
-                    System.err.println("        result: "+result);
-
-                return result;
-            } catch (PrivilegedActionException e) {
-                // Any exceptions thrown by the actual methods are wrapped by a 
-                // InvocationTargetException, which is further wrapped by the 
-                // PrivilegedActionException. Lets unwrap them to make the 
-                // proxy transparent to the callers
-                if (e.getCause() instanceof InvocationTargetException) {
-                    throw e.getCause().getCause();
-                } else {
-                    throw e.getCause();
-                }
-            }
-
-        }
-    };
-
-    /**
-     * 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) {
-        return checkAccess(null, type, extras);
-    }    
-    
-    /**
-     * 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 app the application which is requesting the check. If null, the current
-     * application is used.
-     * @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(ApplicationInstance app, 
-            SecurityWarningDialog.AccessType type,
-    		Object... extras) {
-
-        if (app == null) {
-            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/rt/net/sourceforge/jnlp/services/SingleInstanceLock.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-//
-// 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.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.BindException;
-import java.net.ServerSocket;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.util.FileUtils;
-
-/**
- * This class represents a Lock for single instance jnlp applications
- * 
- * The lock is per-session, per user.
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- */
-class SingleInstanceLock {
-
-    JNLPFile jnlpFile;
-    File lockFile = null;
-
-    public static final int INVALID_PORT = Integer.MIN_VALUE;
-
-    int port = INVALID_PORT;
-
-    /**
-     * Create an object to manage the instance lock for the specified JNLP file.
-     * 
-     * @param jnlpFile the jnlpfile to create the lock for
-     */
-    public SingleInstanceLock(JNLPFile jnlpFile) {
-        this.jnlpFile = jnlpFile;
-        lockFile = getLockFile();
-
-    }
-
-    /**
-     * Create/overwrite the instance lock for the jnlp file.
-     * 
-     * @param localPort the network port for the lock
-     * @throws IOException on any io problems
-     */
-    public void createWithPort(int localPort) throws IOException {
-
-        BufferedWriter lockFileWriter = new BufferedWriter(new FileWriter(lockFile, false));
-        lockFileWriter.write(String.valueOf(localPort));
-        lockFileWriter.newLine();
-        lockFileWriter.flush();
-        lockFileWriter.close();
-
-    }
-
-    /**
-     * Returns true if the lock if valid. That is, the lock exists, and port it
-     * points to is listening for incoming messages.
-     */
-    public boolean isValid() {
-        return (exists() && getPort() != INVALID_PORT && !isPortFree(getPort()));
-    }
-
-    /**
-     * Returns the port in this lock file.
-     */
-    public int getPort() {
-        if (!exists()) {
-            return INVALID_PORT;
-        }
-
-        try {
-            parseFile();
-        } catch (NumberFormatException e) {
-            port = INVALID_PORT;
-        } catch (IOException e) {
-            port = INVALID_PORT;
-        }
-        return port;
-
-    }
-
-    /**
-     * Returns true if the lock file already exists.
-     */
-    private boolean exists() {
-        return lockFile.exists();
-    }
-
-    /**
-     * Returns true if the port is free.
-     */
-    private boolean isPortFree(int port) {
-        try {
-            ServerSocket socket = new ServerSocket(port);
-            socket.close();
-            return true;
-        } catch (BindException e) {
-            return false;
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    /**
-     * Return a file object that represents the lock file. The lock file itself
-     * may or may not exist.
-     */
-    private File getLockFile() {
-        File baseDir = new File(JNLPRuntime.LOCKS_DIR);
-
-        if (!baseDir.isDirectory() && !baseDir.mkdirs()) {
-            throw new RuntimeException(R("RNoLockDir", baseDir));
-        }
-        String lockFileName = getLockFileName();
-        File applicationLockFile = new File(baseDir, lockFileName);
-        return applicationLockFile;
-    }
-
-    /**
-     * Returns the name of the lock file.
-     */
-    private String getLockFileName() {
-        String initialName = "";
-
-        if (jnlpFile.getSourceLocation() != null) {
-            initialName = initialName + jnlpFile.getSourceLocation();
-        } else {
-            initialName = initialName + jnlpFile.getFileLocation();
-        }
-
-        if (jnlpFile.getFileVersion() != null) {
-            initialName = initialName + jnlpFile.getFileVersion().toString();
-        }
-        
-        initialName = initialName + getCurrentDisplay();
-        return FileUtils.sanitizeFileName(initialName);
-
-    }
-
-    /**
-     * Parse the lock file.
-     * 
-     * @throws NumberFormatException
-     * @throws IOException
-     */
-    private void parseFile() throws NumberFormatException, IOException {
-        BufferedReader lockFileReader = new BufferedReader(new FileReader(lockFile));
-        int port = Integer.valueOf(lockFileReader.readLine());
-        lockFileReader.close();
-        this.port = port;
-    }
-
-    /**
-     * Returns a string identifying this display.
-     * 
-     * Implementation note: On systems with X support, this is the DISPLAY
-     * variable
-     * 
-     * @return a string that is guaranteed to be not null.
-     */
-    private String getCurrentDisplay() {
-        String display = System.getenv("DISPLAY");
-        return (display == null) ? "" : display;
-    }
-
-    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 });
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/services/XBasicService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +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.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.jnlp.BasicService;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import net.sourceforge.jnlp.InformationDesc;
-import net.sourceforge.jnlp.JARDesc;
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.Launcher;
-import net.sourceforge.jnlp.runtime.ApplicationInstance;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-import net.sourceforge.jnlp.util.PropertiesFile;
-
-/**
- * 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() {
-        
-        URL url = findFirstURLFromJNLPFile();
-        
-        try {
-            url.openConnection().getInputStream().close();
-            return false;
-        } catch (IOException exception) {
-            return true;
-        }
-    }
-
-    /**
-     * Return the first URL from the jnlp file
-     * Or a default URL if no url found in JNLP file
-     */
-    private URL findFirstURLFromJNLPFile() {
-        
-        ApplicationInstance app = JNLPRuntime.getApplication();
-        
-        if (app != null) {
-            JNLPFile jnlpFile = app.getJNLPFile();
-            
-            URL sourceURL = jnlpFile.getSourceLocation();
-            if (sourceURL != null) {
-                return sourceURL;
-            }
-            
-            URL codeBaseURL = jnlpFile.getCodeBase();
-            if (codeBaseURL != null) {
-                return codeBaseURL;
-            }
-    
-            InformationDesc informationDesc = jnlpFile.getInformation();
-            URL homePage = informationDesc.getHomepage();
-            if (homePage != null) {
-                return homePage;
-            }
-            
-            JARDesc[] jarDescs = jnlpFile.getResources().getJARs();
-            for (JARDesc jarDesc: jarDescs) {
-                return jarDesc.getLocation();
-            }
-        }
-        
-        // this section is only reached if the jnlp file has no jars.
-        // that doesnt seem very likely.
-        URL arbitraryURL;
-        try {
-            arbitraryURL = new URL("http://icedtea.classpath.org");
-        } catch (MalformedURLException malformedURL) {
-            throw new RuntimeException(malformedURL);
-        }
-        
-        return arbitraryURL;
-    }
-
-    /**
-     * 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/rt/net/sourceforge/jnlp/services/XClipboardService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XDownloadService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XExtendedService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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.File;
-import java.io.IOException;
-
-import javax.jnlp.ExtendedService;
-import javax.jnlp.FileContents;
-
-import net.sourceforge.jnlp.security.SecurityWarningDialog;
-
-/**
- * Implementation of ExtendedService
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- * 
- */
-public class XExtendedService implements ExtendedService {
-
-    public FileContents openFile(File file) throws IOException {
-
-        if (ServiceUtil.checkAccess(SecurityWarningDialog.AccessType.READ_FILE)) {
-            return (FileContents) ServiceUtil.createPrivilegedProxy(FileContents.class,
-                    new XFileContents(file));
-        } else {
-            return null;
-        }
-
-    }
-
-    public FileContents[] openFiles(File[] files) throws IOException {
-        FileContents[] contents = new FileContents[files.length];
-        for (int i = 0; i < files.length; i++) {
-            contents[i] = openFile(files[i]);
-        }
-        return contents;
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/services/XExtensionInstallerService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XFileContents.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XFileOpenService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XFileSaveService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XJNLPRandomAccessFile.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XPersistenceService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XPrintService.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/services/XServiceManagerStub.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +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.ExtendedService",
-        "javax.jnlp.ExtensionInstallerService", // required
-        "javax.jnlp.PersistenceService",
-        "javax.jnlp.FileOpenService",
-        "javax.jnlp.FileSaveService",
-        "javax.jnlp.ClipboardService",
-        "javax.jnlp.PrintService",
-        "javax.jnlp.SingleInstanceService"
-    };
-
-    private static Object services[] = {
-        ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()),
-        ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()),
-        ServiceUtil.createPrivilegedProxy(ExtendedService.class, new XExtendedService()),
-        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()),
-        ServiceUtil.createPrivilegedProxy(ExtendedSingleInstanceService.class, new XSingleInstanceService())
-    };
-
-
-    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/rt/net/sourceforge/jnlp/services/XSingleInstanceService.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.jnlp.SingleInstanceListener;
-import javax.management.InstanceAlreadyExistsException;
-
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * This class implements SingleInstanceService
- * 
- * @author <a href="mailto:omajid@redhat.com">Omair Majid</a>
- */
-public class XSingleInstanceService implements ExtendedSingleInstanceService {
-
-    boolean initialized = false;
-    List<SingleInstanceListener> listeners = new LinkedList<SingleInstanceListener>();
-
-    /**
-     * Implements a server that listens for arguments from new instances of this
-     * application
-     * 
-     */
-    class SingleInstanceServer implements Runnable {
-
-        SingleInstanceLock lockFile = null;
-
-        public SingleInstanceServer(SingleInstanceLock lockFile) {
-            this.lockFile = lockFile;
-        }
-
-        public void run() {
-            ServerSocket listeningSocket = null;
-            try {
-                listeningSocket = new ServerSocket(0);
-                lockFile.createWithPort(listeningSocket.getLocalPort());
-
-                if (JNLPRuntime.isDebug()) {
-                    System.out.println("Starting SingleInstanceServer on port" + listeningSocket);
-                }
-
-                while (true) {
-                    try {
-                        Socket communicationSocket = listeningSocket.accept();
-                        ObjectInputStream ois = new ObjectInputStream(communicationSocket
-                                .getInputStream());
-                        String[] arguments = (String[]) ois.readObject();
-                        notifySingleInstanceListeners(arguments);
-                    } catch (Exception exception) {
-                        // not much to do here...
-                        exception.printStackTrace();
-                    }
-
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            } finally {
-                if (listeningSocket != null) {
-                    try {
-                        listeningSocket.close();
-                    } catch (IOException e) {
-                        // Give up.
-                        e.printStackTrace();
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * Create a new XSingleInstanceService
-     */
-    protected XSingleInstanceService() {
-    }
-
-    /**
-     * Initialize the new SingleInstanceService
-     * 
-     * @throws InstanceAlreadyExistsException if the instance already exists
-     */
-    public void initializeSingleInstance() {
-        if (!initialized) {
-            // this is called after the application has started. so safe to use
-            // JNLPRuntime.getApplication()
-            checkSingleInstanceRunning(JNLPRuntime.getApplication().getJNLPFile());
-            initialized = true;
-            SingleInstanceLock lockFile;
-            JNLPFile jnlpFile = JNLPRuntime.getApplication().getJNLPFile();
-            lockFile = new SingleInstanceLock(jnlpFile);
-            if (!lockFile.isValid()) {
-                startListeningServer(lockFile);
-            }
-        }
-
-    }
-
-    /**
-     * Check if another instance of this application is already running
-     * 
-     * @param jnlpFile The {@link JNLPFile} that specifies the application
-     * 
-     * @throws InstanceExistsException if an instance of this application
-     *         already exists
-     */
-    public void checkSingleInstanceRunning(JNLPFile jnlpFile) {
-        SingleInstanceLock lockFile = new SingleInstanceLock(jnlpFile);
-        if (lockFile.isValid()) {
-            int port = lockFile.getPort();
-            if (JNLPRuntime.isDebug()) {
-                System.out.println("Lock file is valid (port=" + port + "). Exiting.");
-            }
-            try {
-                sendProgramArgumentsToExistingApplication(port, jnlpFile.getApplication()
-                        .getArguments());
-                throw new InstanceExistsException(String.valueOf(port));
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    /**
-     * Start the listening server to accept arguments from new isntances of
-     * applications
-     * 
-     * @param lockFile
-     */
-    private void startListeningServer(SingleInstanceLock lockFile) {
-        SingleInstanceServer server = new SingleInstanceServer(lockFile);
-        new Thread(server).start();
-    }
-
-    /**
-     * Send the arguments for this application to the main instance
-     * 
-     * @param port the port at which the SingleInstanceServer is listening at
-     * @param arguments the new arguments
-     * @throws IOException on any io exception
-     */
-    private void sendProgramArgumentsToExistingApplication(int port, String[] arguments)
-            throws IOException {
-        try {
-            Socket serverCommunicationSocket = new Socket((String) null, port);
-            ObjectOutputStream argumentStream = new ObjectOutputStream(serverCommunicationSocket
-                    .getOutputStream());
-            argumentStream.writeObject(arguments);
-            argumentStream.close();
-            serverCommunicationSocket.close();
-
-        } catch (UnknownHostException unknownHost) {
-            if (JNLPRuntime.isDebug()) {
-                System.out.println("Unable to find localhost");
-            }
-            throw new RuntimeException(unknownHost);
-        }
-    }
-
-    /**
-     * Notify any SingleInstanceListener with new arguments
-     * 
-     * @param arguments the new arguments to the application
-     */
-    private void notifySingleInstanceListeners(String[] arguments) {
-        for (SingleInstanceListener listener : listeners) {
-            // TODO this proxy is privileged. should i worry about security in
-            // methods being called?
-            listener.newActivation(arguments);
-        }
-    }
-
-    /**
-     * Add the specified SingleInstanceListener
-     * 
-     * @throws InstanceExistsException, which is likely to terminate the
-     *         application but not guaranteed to
-     */
-    public void addSingleInstanceListener(SingleInstanceListener sil) {
-        initializeSingleInstance();
-
-        if (sil == null) {
-            return;
-        }
-
-        listeners.add(sil);
-    }
-
-    /**
-     * Remove the specified SingleInstanceListener
-     * 
-     * @throws InstanceExistsException if an instance of this single instance
-     *         application already exists
-     * 
-     */
-    public void removeSingleInstanceListener(SingleInstanceListener sil) {
-        initializeSingleInstance();
-
-        if (sil == null) {
-            return;
-        }
-
-        listeners.remove(sil);
-    }
-
-}
--- a/rt/net/sourceforge/jnlp/services/package.html	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/CharacterEncoder.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/HexDumpEncoder.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/JarRunner.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/JarSigner.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,545 +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;
-        JarFile jarFile = null;
-
-        // certs could be uninitialized if one calls this method directly
-        if (certs == null)
-            certs = new ArrayList<CertPath>();
-        
-        try {
-            jarFile = new JarFile(jarName, true);
-            Vector<JarEntry> entriesVec = new Vector<JarEntry>();
-            byte[] buffer = new byte[8192];
-
-            JarEntry je;
-            Enumeration<JarEntry> entries = jarFile.entries();
-            while (entries.hasMoreElements()) {
-                je = entries.nextElement();
-                entriesVec.addElement(je);
-
-                InputStream is = jarFile.getInputStream(je);
-                try {
-                    int n;
-                    while ((n = is.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();
-                    }
-                }
-            }
-
-            if (jarFile.getManifest() != 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 (jarFile != null) {
-                jarFile.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/rt/net/sourceforge/jnlp/tools/JarSignerResources.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/KeyStoreUtil.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/tools/KeyTool.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,461 +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: " + SecurityUtil.getCN(((X509Certificate)usercerts
-				.getCertificate(alias)).getSubjectX500Principal().getName()));
-			out.println("Certificate fingerprint (MD5): "
-					+ getCertFingerPrint("MD5", cert));
-			out.println();
-		}
-	}
-
-    /**
-     * 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/rt/net/sourceforge/jnlp/util/FileUtils.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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;
-
-/**
- * This class contains a few file-related utility functions. 
- * 
- * @author Omair Majid
- */
-
-public class FileUtils {
-
-    
-    /**
-     * Given an input, return a sanitized form of the input suitable for use as
-     * a file/directory name
-     * 
-     * @param input
-     * @return a sanitized version of the input
-     */
-    public static String sanitizeFileName(String input) {
-
-        /*
-         * FIXME
-         * 
-         * Assuming safe characters are 'a-z','A-Z','0-9', '_', '.'
-         */
-
-        String sanitizedName = input.replaceAll("[^a-zA-Z0-9.]", "_");
-        return sanitizedName;
-    }
-    
-}
--- a/rt/net/sourceforge/jnlp/util/PropertiesFile.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/util/Reflect.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/util/WeakList.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/jnlp/util/XDesktopEntry.java	Mon Mar 29 00:25:26 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-// Copyright (C) 2009 Red Hat, Inc.
-// 
-// 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.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.StringReader;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.Arrays;
-
-import net.sourceforge.jnlp.IconDesc;
-import net.sourceforge.jnlp.JNLPFile;
-import net.sourceforge.jnlp.StreamEater;
-import net.sourceforge.jnlp.cache.CacheUtil;
-import net.sourceforge.jnlp.cache.UpdatePolicy;
-import net.sourceforge.jnlp.runtime.JNLPRuntime;
-
-/**
- * This class builds a (freedesktop.org) desktop entry out of a {@link JNLPFile}
- * . This entry can be used to install desktop shortcuts. See xdg-desktop-icon
- * (1) and http://standards.freedesktop.org/desktop-entry-spec/latest/ for more
- * information
- * 
- * @author Omair Majid
- * 
- */
-public class XDesktopEntry {
-
-    public static final String JAVA_ICON_NAME = "java.png";
-    
-    private JNLPFile file = null;
-    private int iconSize = -1;
-    private String iconLocation = null;
-
-    private int[] VALID_ICON_SIZES = new int[] { 16, 22, 32, 48, 64, 128 };
-
-    /**
-     * Create a XDesktopEntry for the given JNLP file
-     * 
-     * @param file a {@link JNLPFile} that indicates the application to launch
-     */
-    public XDesktopEntry(JNLPFile file) {
-        this.file = file;
-
-        /* looks like a good initial value */
-        iconSize = VALID_ICON_SIZES[2];
-    }
-
-    /**
-     * Returns the contents of the {@link XDesktopEntry} through the
-     * {@link Reader} interface.
-     */
-    public Reader getContentsAsReader() {
-
-        String pathToJavaws = System.getProperty("java.home") + File.separator + "bin"
-                + File.separator + "javaws";
-        File cacheFile = CacheUtil.urlToPath(file.getSourceLocation(), "cache");
-
-        String fileContents = "[Desktop Entry]\n";
-        fileContents += "Version=1.0\n";
-        fileContents += "Name=" + file.getTitle() + "\n";
-        fileContents += "GenericName=Java Web Start Application\n";
-        fileContents += "Comment=" + file.getInformation().getDescription() + "\n";
-        fileContents += "Type=Application\n";
-        if (iconLocation != null) {
-            fileContents += "Icon=" + iconLocation + "\n";
-        } else {
-            fileContents += "Icon=" + JAVA_ICON_NAME + "\n";
-            
-        }
-        if (file.getInformation().getVendor() != null) {
-            fileContents += "Vendor=" + file.getInformation().getVendor() + "\n";
-        }
-        
-        //Shortcut executes the jnlp from cache and system preferred java..
-        fileContents += "Exec=" + "javaws" + " \"" + cacheFile.getAbsolutePath() + "\"\n";
-
-        return new StringReader(fileContents);
-
-    }
-
-    /**
-     * Get the size of the icon (in pixels) for the desktop shortcut
-     */
-    public int getIconSize() {
-        return iconSize;
-    }
-
-    /**
-     * Set the icon size to use for the desktop shortcut
-     * 
-     * @param size the size (in pixels) of the icon to use. Commonly used sizes
-     *        are of 16, 22, 32, 48, 64 and 128
-     */
-    public void setIconSize(int size) {
-        iconSize = size;
-    }
-
-    /**
-     * Create a desktop shortcut for this desktop entry
-     */
-    public void createDesktopShortcut() {
-        try {
-            cacheIcon();
-            installDesktopLauncher();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Install this XDesktopEntry into the user's desktop as a launcher
-     */
-    private void installDesktopLauncher() {
-        File shortcutFile = new File(JNLPRuntime.TMP_DIR + File.separator
-                + FileUtils.sanitizeFileName(file.getTitle()) + ".desktop");
-        try {
-
-            /*
-             * Write out a Java String (UTF-16) as a UTF-8 file
-             */
-
-            OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(shortcutFile),
-                    Charset.forName("UTF-8"));
-            Reader reader = getContentsAsReader();
-
-            char[] buffer = new char[1024];
-            int ret = 0;
-            while (-1 != (ret = reader.read(buffer))) {
-                writer.write(buffer, 0, ret);
-            }
-
-            reader.close();
-            writer.close();
-
-            /*
-             * Install the desktop entry
-             */
-
-            String[] execString = new String[] { "xdg-desktop-icon", "install", "--novendor",
-                    shortcutFile.getCanonicalPath() };
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Execing: " + Arrays.toString(execString));
-            }
-            Process installer = Runtime.getRuntime().exec(execString);
-            new StreamEater(installer.getInputStream()).start();
-            new StreamEater(installer.getErrorStream()).start();
-
-            try {
-                installer.waitFor();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-
-            if (!shortcutFile.delete()) {
-                throw new IOException("Unable to delete temporary file:" + shortcutFile);
-            }
-
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Cache the icon for the desktop entry
-     */
-    private void cacheIcon() {
-
-        URL iconLocation = file.getInformation().getIconLocation(IconDesc.SHORTCUT, iconSize,
-                iconSize);
-
-        if (iconLocation == null) {
-            iconLocation = file.getInformation().getIconLocation(IconDesc.DEFAULT, iconSize,
-                    iconSize);
-        }
-
-        if (iconLocation != null) {
-            String location = CacheUtil.getCachedResource(iconLocation, null, UpdatePolicy.SESSION)
-                    .toString();
-            if (!location.startsWith("file:")) {
-                throw new RuntimeException("Unable to cache icon");
-            }
-
-            this.iconLocation = location.substring("file:".length());
-
-            if (JNLPRuntime.isDebug()) {
-                System.err.println("Cached desktop shortcut icon: " + this.iconLocation);
-            }
-        }
-    }
-
-}
--- a/rt/net/sourceforge/nanoxml/XMLElement.java	Mon Mar 29 00:25:26 2010 +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/rt/net/sourceforge/nanoxml/XMLParseException.java	Mon Mar 29 00:25:26 2010 +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;
-    }
-
-}