Nullpointer exception using expando/super-expando properties

RESOLVED DUPLICATE of bug 380173

Status

Rhino
E4X
RESOLVED DUPLICATE of bug 380173
10 years ago
9 years ago

People

(Reporter: Jörg Brunsmann, Unassigned)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5
Build Identifier: rhino1_6R6

Executing

$ java -classpath js.jar org.mozilla.javascript.tools.shell.Main \testcase.js

gives

Exception in thread "main" java.lang.NullPointerException
        at org.mozilla.javascript.xmlimpl.XMLList.put(XMLList.java:227)
        at org.mozilla.javascript.xmlimpl.XMLObjectImpl.ecmaPut(XMLObjectImpl.java:288)
        at org.mozilla.javascript.ScriptRuntime.setObjectElem(ScriptRuntime.java:1442)
        at org.mozilla.javascript.ScriptRuntime.setObjectElem(ScriptRuntime.java:1434)
        at org.mozilla.javascript.gen.c1._c0(Unknown Source)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.gen.c1.exec(Unknown Source)
        at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:524)
        at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:446)
        at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:412)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:403)
        at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
        at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
        at org.mozilla.javascript.Context.call(Context.java:577)
        at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:503)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
(Reporter)

Comment 1

10 years ago
Created attachment 275115 [details]
Test case the demonstrate the NPE
(Reporter)

Comment 2

10 years ago
If you uncomment the line

order.item.description = "descr";

no exception is thrown.
(Reporter)

Comment 3

10 years ago
BTW, as a side note: running this e4x script

var order = <order/>;
order.customer.name = "Fred Jones";
order.customer.address.street = "123 Long Lang";
order.customer.address.city = "Underwood";
order.customer.address.state = "CA";
print("The order custructed using expandos and super-expandos is:\n" + order);

with a gcj compiled rhino gives:

<order>
  <customer>
    <name>Fred Jones</name>
  </customer>
  <customer>
    <address>
      <street>123 Long Lang</street>
    </address>
  </customer>
  <customer>
    <address>
      <city>Underwood</city>
    </address>
  </customer>
  <customer>
    <address>
      <state>CA</state>
    </address>
  </customer>

whereas with a sun vm it gives:

The order custructed using expandos and super-expandos is:
<order>
  <customer>
    <name>Fred Jones</name>
    <address>
      <street>123 Long Lang</street>
      <city>Underwood</city>
      <state>CA</state>
    </address>
  </customer>
</order>

Updated

9 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 380173
You need to log in before you can comment on or make changes to this bug.