JDK-5079850 : Accessing HTML form via JSObject in JS->Java call results in 100% CPU Usage
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.4.2_04
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-07-28
  • Updated: 2004-09-25
  • Resolved: 2004-09-25
Related Reports
Duplicate :  
Description
When JavaScript calls a method on an applet which tries to access HTML form, CPU usage goes to 100% and the browser do not respond. This is reproducible with IE using 1.4.2_0x and 1.5 JRE

Steps to reproduce:
1)Run the test case using the following .java and .html file
2)Selct the drop down list using mouse 
3)Use the Keyboard to select one of the currency
4)Press enter

//CurrencyTester.java
import netscape.javascript.JSObject;

public class CurrencyTester extends java.applet.Applet
{
  // These references get reset for each deal/screen refresh.
  private static JSObject jsWin;
  private static JSObject jsDoc;
  private static JSObject spotEntryForm;

  public void init()
  {
    System.out.println("init");
    try {

      jsWin = JSObject.getWindow(this);
      jsDoc = (JSObject) jsWin.getMember("document");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public void testCcy(String ccy, String valueDate) {
    System.out.println("ccy " + ccy + " " + valueDate);
    JSObject tradeList = (JSObject) jsDoc.getMember("tradeList");
    System.out.println("ccy " + ccy + " " + valueDate);
    JSObject valueDateObj  = (JSObject) tradeList.getMember("valueDate");
    System.out.println("ccy " + ccy + " " + valueDate);

    String [] message = {ccy};
    jsWin.call("setValueDate", message);

  }
}

//currency.html
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Currency Drop Down </title>
<META CONTENT="no-cache" HTTP-EQUIV="Pragma">
<META CONTENT="-1" HTTP-EQUIV="Expires">
</head>
<body rightmargin="0" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#ffffff">

<script language="JavaScript1.2">
function selectCcy(ccy, valueDate) {
   document.TestApplet.testCcy(ccy.value, valueDate.value);
}
function setValueDate(date)
{
  //alert('setValueDate');	
  document.tradeList.valueDate.value = date;
}

</script>

<table border="0" bgcolor="#999999" width="100%" cellpadding="4" cellspacing="1">
<form method="post" action="" name="tradeList">

<input onBlur="selectCcy(ccy, this);" value="" name="valueDate" size="12" class="ft" type="text">

<select onChange="selectCcy(this, valueDate)" name="ccy" class="ft">
<option value="">Not Selected</option><OPTION VALUE="USD12">USD - US Dollar</OPTION><OPTION VALUE="ALL111">ALL - Albanian Lek</OPTION><OPTION VALUE="AMD129">AMD - Armenia Dram</OPTION><OPTION VALUE="ANG37">ANG - Netherland Antilles Guilder</OPTION><OPTION VALUE="AOA107">AOA - Angola Kwanza</OPTION><OPTION VALUE="ARS45">ARS - Argentina Peso</OPTION><OPTION VALUE="AUD2">AUD - Australian Dollar</OPTION><OPTION VALUE="AZM150">AZM - Azerbaijan Manat</OPTION>
<OPTION VALUE="BBD42">BBD - Barbados Dollar</OPTION><OPTION VALUE="BDT101">BDT - Bangladesh Taka</OPTION><OPTION VALUE="BGN34">BGN - Bulgarian Lev</OPTION><OPTION VALUE="BIF133">BIF - Burundi Franc</OPTION><OPTION VALUE="BMD27">BMD - Bermuda Dollar</OPTION><OPTION VALUE="BND35">BND - Brunei Dollar</OPTION><OPTION VALUE="BOB69">BOB - Bolivia Boliviano</OPTION><OPTION VALUE="BRL47">BRL - Brazilian Real</OPTION><OPTION VALUE="BSD26">BSD - Bahamas Dollar</OPTION>
<OPTION VALUE="BTN95">BTN - Bhutan Ngultrum</OPTION><OPTION VALUE="BWP9">BWP - Botswana Pula</OPTION><OPTION VALUE="BYR142">BYR - Belarus Ruble</OPTION><OPTION VALUE="BZD41">BZD - Belize Dollar</OPTION><OPTION VALUE="CAD30">CAD - Canadian Dollar</OPTION><OPTION VALUE="CDF124">CDF - Rep. Of Congo Franc</OPTION><OPTION VALUE="CHF29">CHF - Swiss Franc</OPTION><OPTION VALUE="CLP131">CLP - Chile Peso</OPTION><OPTION VALUE="CNY72">CNY - China Yuan</OPTION>
<OPTION VALUE="COP146">COP - Columbian Peso</OPTION><OPTION VALUE="CRC125">CRC - Costa Rica Colon</OPTION><OPTION VALUE="CSD100">CSD - Serbia Dinars</OPTION><OPTION VALUE="CVE113">CVE - Cape Verde Islands Escudo</OPTION><OPTION VALUE="CYP20">CYP - Cyprus Pound</OPTION><OPTION VALUE="CZK83">CZK - Czech Koruna</OPTION><OPTION VALUE="DJF117">DJF - Djibouti Franc</OPTION><OPTION VALUE="DOP91">DOP - Dominican Republic Peso</OPTION><OPTION VALUE="DZD103">DZD - Algeria Dinar</OPTION>
<OPTION VALUE="EEK79">EEK - Estonian Kroon</OPTION><OPTION VALUE="EGP58">EGP - Egyptian Pound</OPTION><OPTION VALUE="ETB73">ETB - Ethiopia Birr</OPTION><OPTION VALUE="EUR0">EUR - Euro</OPTION><OPTION VALUE="FJD5">FJD - Fijian Dollar</OPTION><OPTION VALUE="FKP33">FKP - Falkland/Malvinas Pound</OPTION><OPTION VALUE="GBP1">GBP - British Pound</OPTION><OPTION VALUE="GEL43">GEL - Georgia Lari</OPTION><OPTION VALUE="GHC156">GHC - Ghana Cedi</OPTION><OPTION VALUE="GIP31">GIP - Gibraltar Pound</OPTION>
<OPTION VALUE="GMD84">GMD - Gambia Dalasi</OPTION><OPTION VALUE="GNF141">GNF - Guinea Franc</OPTION><OPTION VALUE="GTQ71">GTQ - Guatemala Quetzal</OPTION><OPTION VALUE="GWP163">GWP - Guinea-Bissau Peso</OPTION><OPTION VALUE="GYD119">GYD - Guyana Dollar</OPTION><OPTION VALUE="HKD68">HKD - Hong Kong Dollar</OPTION><OPTION VALUE="HNL81">HNL - Honduras Lempira</OPTION><OPTION VALUE="HRK59">HRK - Croatia Kuna</OPTION><OPTION VALUE="HTG88">HTG - Haiti Gourd</OPTION><OPTION VALUE="HUF121">HUF - Hungarian Forint</OPTION>
<OPTION VALUE="IDR154">IDR - Indonesia Rupiah</OPTION><OPTION VALUE="ILS54">ILS - Israeli Shekel</OPTION><OPTION VALUE="IQD11">IQD - Iraq Dinar</OPTION><OPTION VALUE="ISK104">ISK - Iceland Krona</OPTION><OPTION VALUE="JMD102">JMD - Jamaica Dollar</OPTION><OPTION VALUE="JOD23">JOD - Jordan Dinar</OPTION><OPTION VALUE="JPY110">JPY - Japanese Yen</OPTION><OPTION VALUE="KES106">KES - Kenya Shilling</OPTION><OPTION VALUE="KGS92">KGS - Kyrgyzstan Som</OPTION><OPTION VALUE="KHR147">KHR - Cambodia Riel</OPTION>
<OPTION VALUE="KMF126">KMF - Comoros Franc</OPTION><OPTION VALUE="KRW135">KRW - Korean Won</OPTION><OPTION VALUE="KWD16">KWD - Kuwaiti Dinar</OPTION><OPTION VALUE="KYD24">KYD - Cayman Islands Dollar</OPTION><OPTION VALUE="KZT116">KZT - Kazakstan Tenge</OPTION><OPTION VALUE="LAK153">LAK - Lao Kip</OPTION><OPTION VALUE="LBP138">LBP - Lebanon Pound</OPTION><OPTION VALUE="LKR108">LKR - Sri Lankan Rupee</OPTION><OPTION VALUE="LRD97">LRD - Liberia Dinar</OPTION><OPTION VALUE="LSL63">LSL - Lesotho Loti</OPTION>
<OPTION VALUE="LTL46">LTL - Lithuanian Lita</OPTION><OPTION VALUE="LVL22">LVL - Latvian Lat</OPTION><OPTION VALUE="MAD75">MAD - Moroccan Dirham</OPTION><OPTION VALUE="MDL77">MDL - Moldova Leu</OPTION><OPTION VALUE="MGF152">MGF - Madasgascar Franc</OPTION><OPTION VALUE="MKD96">MKD - Macedonia Dinar</OPTION><OPTION VALUE="MMK65">MMK - Myanmar Kyat</OPTION><OPTION VALUE="MNT136">MNT - Mongolia Tugrik</OPTION><OPTION VALUE="MOP70">MOP - Macau Pataca</OPTION><OPTION VALUE="MRO122">MRO - Mauritania Ouguiya</OPTION>
<OPTION VALUE="MTL4">MTL - Maltese Lira</OPTION><OPTION VALUE="MUR82">MUR - Mauritius Rupee</OPTION><OPTION VALUE="MVR78">MVR - Maldives Rufiyaa</OPTION><OPTION VALUE="MWK112">MWK - Malawi Kwacha</OPTION><OPTION VALUE="MXN76">MXN - Mexican Nuevo Peso</OPTION><OPTION VALUE="MYR52">MYR - Malaysian Ringitt</OPTION><OPTION VALUE="MZM158">MZM - Mozambique Maputo</OPTION><OPTION VALUE="NAD64">NAD - Namibia Dollar</OPTION><OPTION VALUE="NGN115">NGN - Nigeria Naira</OPTION><OPTION VALUE="NIO80">NIO - Nicaragua Cordoba</OPTION>
<OPTION VALUE="NOK66">NOK - Norwegian Krone</OPTION><OPTION VALUE="NPR105">NPR - Nepal Rupee</OPTION><OPTION VALUE="NZD3">NZD - New Zealand Dollar</OPTION><OPTION VALUE="OMR19">OMR - Omani Rial</OPTION><OPTION VALUE="PAB25">PAB - Panama Balboa</OPTION><OPTION VALUE="PEN48">PEN - Peruvian Nuevo Sol</OPTION><OPTION VALUE="PGK7">PGK - Papau New Guinea Kina</OPTION><OPTION VALUE="PHP98">PHP - Philippine Peso</OPTION><OPTION VALUE="PKR99">PKR - Pakistan Rupee</OPTION><OPTION VALUE="PLN53">PLN - Polish Zloty</OPTION>
<OPTION VALUE="PYG151">PYG - Paraguay Guarani</OPTION><OPTION VALUE="QAR49">QAR - Qatar Riyal</OPTION><OPTION VALUE="ROL159">ROL - Romanian Lel</OPTION><OPTION VALUE="RUB85">RUB - Russia Ruble</OPTION><OPTION VALUE="RWF130">RWF - Rwanda Franc</OPTION><OPTION VALUE="SAR51">SAR - Saudi Arabian Riyal</OPTION><OPTION VALUE="SBD8">SBD - Solomon Islands Dollar</OPTION><OPTION VALUE="SCR56">SCR - Seychelles Rupee</OPTION><OPTION VALUE="SDD123">SDD - Sudan Dinar</OPTION><OPTION VALUE="SEK67">SEK - Swedish Krona</OPTION>
<OPTION VALUE="SGD36">SGD - Singapore Dollar</OPTION><OPTION VALUE="SHP32">SHP - St.Helena Pound</OPTION><OPTION VALUE="SIT120">SIT - Slovanian Tolar</OPTION><OPTION VALUE="SKK89">SKK - Slovak Koruna</OPTION><OPTION VALUE="SLL144">SLL - Sierra Leone Leone</OPTION><OPTION VALUE="SOS145">SOS - Somalia Shilling</OPTION><OPTION VALUE="SRG143">SRG - Suriname Guilder</OPTION><OPTION VALUE="STD155">STD - Sao Tome &amp; Principe Dobra</OPTION><OPTION VALUE="SVC74">SVC - El Salvador Colon</OPTION>
<OPTION VALUE="SYP94">SYP - Syria Pound</OPTION><OPTION VALUE="SZL62">SZL - Swaziland Lilangeni</OPTION><OPTION VALUE="THB90">THB - Thai Baht</OPTION><OPTION VALUE="TMM161">TMM - Turkmenistan Manat</OPTION><OPTION VALUE="TND28">TND - Tunisia Dinar</OPTION><OPTION VALUE="TOP6">TOP - Tonga Paanga</OPTION><OPTION VALUE="TRL160">TRL - Turkey Lira</OPTION><OPTION VALUE="TTD57">TTD - Trinidad &amp; Tobago Dollar</OPTION><OPTION VALUE="TWD87">TWD - Taiwan Dollar</OPTION>
<OPTION VALUE="TZS134">TZS - Tanzania Shilling</OPTION><OPTION VALUE="UAH55">UAH - Ukraine Hryvaia</OPTION><OPTION VALUE="UGX139">UGX - Uganda Shilling</OPTION><OPTION VALUE="UYU86">UYU - Uruguayan Peso</OPTION><OPTION VALUE="TJS162">TJS - Tajikistan Somoni</OPTION><OPTION VALUE="UZS132">UZS - Uzbekistan Som</OPTION><OPTION VALUE="VEB140">VEB - Venezuela Bolivar</OPTION><OPTION VALUE="VND157">VND - Vietnam Dong</OPTION><OPTION VALUE="VUV114">VUV - Vatu</OPTION>
<OPTION VALUE="WST10">WST - Western Samoan Tala</OPTION><OPTION VALUE="XAF128">XAF - Central Africa - BEAC Franc</OPTION><OPTION VALUE="XCD44">XCD - Eastern Caribbean Dollar</OPTION><OPTION VALUE="XOF127">XOF - Central Africa- BCEAO Franc</OPTION><OPTION VALUE="XPF109">XPF - C.F.P. Franc</OPTION><OPTION VALUE="YER118">YER - Yeman Rial</OPTION><OPTION VALUE="ZAR61">ZAR - South African Rand</OPTION><OPTION VALUE="ZMK149">ZMK - Zambia Kawacha</OPTION><OPTION VALUE="ZWD148">ZWD - Zimbabwe Dollar</OPTION>
</select>

<APPLET name="TestApplet" code = "CurrencyTester.class">
<PARAM VALUE="imendoza" name="userName">
<PARAM value="rateserver_user" name="java.naming.security.principal">
<PARAM value="8BC58122FA5DC143FC32A623BD4DB7C9" name="java.naming.security.credentials">
<PARAM value="" name="QueueNameKey">
<PARAM value="" name="QueueFactoryNameKey">
</APPLET>

</form>
</table>
</body>
</html>






Comments
EVALUATION Pumping messages while JS->Java call is happenning is primarily responsible for this bug. We will try to address this in mustang ###@###.### 2004-07-28
28-07-2004