Closed Bug 282447 Opened 20 years ago Closed 20 years ago

NPE trying to report error when trying to convert null to primitive type

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: szegedia, Assigned: igor)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Opera/7.54 (Windows NT 5.0; U)  [en]
Build Identifier: 

When null is attempted to be passed as a parameter argument to a Java method 
taking primitive type, Rhino attempts to report this as error. However, the 
error reporting itself fails with:

java.lang.NullPointerException
        at org.mozilla.javascript.NativeJavaObject.
reportConversionError(NativeJavaObject.java:896)
        at org.mozilla.javascript.NativeJavaObject.
coerceTypeImpl(NativeJavaObject.java:505)
...

I won't bother submitting a patch for this, as it's trivial. Just change "value.
toString()" to "String.valueOf(value)" in NativeJavaObject.
reportConversionError() method.

Reproducible: Always

Steps to Reproduce:
Attached patch The fix (obsolete) — Splinter Review
It is nice to be able to press "Diff" link ;)
Attachment #174470 - Attachment is obsolete: true
I committed the fix, thanks for reporting it!
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: