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

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: Attila Szegedi, Assigned: Igor Bukanov)

Tracking

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

14 years ago
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:
(Assignee)

Comment 1

14 years ago
Created attachment 174470 [details] [diff] [review]
The fix

It is nice to be able to press "Diff" link ;)
(Assignee)

Comment 2

14 years ago
Created attachment 174471 [details] [diff] [review]
The fix with comments
(Assignee)

Updated

14 years ago
Attachment #174470 - Attachment is obsolete: true
(Assignee)

Comment 3

14 years ago
I committed the fix, thanks for reporting it!
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.