RFR (XS): 8160024 jdb returns invalid argument count if first parameter to Arrays.asList is null

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Wed Nov 2 02:53:35 UTC 2016


Dan,

Thank you for the review and the suggestions!
I'll add the suggested comments.

The test is ridiculously simple so that I did not want to make it
more complex just for the sake of no shell scripting. :)

Thanks!
Serguei


On 11/1/16 18:03, Daniel D. Daugherty wrote:
> On 11/1/16 6:58 AM, serguei.spitsyn at oracle.com wrote:
>> Please, review this small fix.
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8160024
>>
>> JDK webrev:
>> http://cr.openjdk.java.net/~sspitsyn/webrevs/2016/hotspot/8160024-JDI-eval.jdk1/ 
>>
>
> src/jdk.jdi/share/classes/com/sun/tools/jdi/MethodImpl.java
>     L318:         if (nthArgValue == null && argCount == paramCount) {
>     L319:             // The only one varargs parameter is null
>         Perhaps this comment rewrite:
>                       // We have one varargs parameter and it is null
>                       // so we don't have to do anything.
>
>     L322:         Type nthArgType = (nthArgValue == null) ? null : 
> nthArgValue.type();
>         Perhaps add this comment above L322:
>                   // If the first varargs parameter is null, then don't
>                   // access its type since it can't be an array.
>
>     L347:         argArray.setValues(0, arguments, paramCount - 1, 
> count);
>         Looks like setValues() will happily copy any null values that
>         happen to be in the arguments List to the argArray. Good.
>
> test/com/sun/jdi/EvalArraysAsList.sh
>     No comments.
>
> Thumbs up, but I thought we weren't suppose to add any more
> new shell script tests... :-)
>
> Dan
>
>
>>
>> The bug is confidential, so the RFR is sent to the confidential mailing
>> lists.
>>
>>
>> Summary:
>>
>>   The JDI incorrectly evaluates the expression: Arrays.asList(null, 
>> "a").
>>   The root cause is a special case in the method 
>> MethodImpl.handleVarArgs()
>>   that has been corrected in order to fix the problem.
>>
>>   New unit test is included: jdk/test/com/sun/jdi/EvalArraysAsList.sh
>>
>> Testing:
>>   Ran new unit test, Jtreg com/sun/jdi and nsk.jdi.testlist.
>>   All tests are passed.
>>
>> Thanks,
>> Serguei
>>
>



More information about the serviceability-dev mailing list