RFR: JDK-8198393: Instrumentation.retransformClasses() throws NullPointerException when handling a zero-length array

serguei.spitsyn at oracle.com serguei.spitsyn at oracle.com
Mon Mar 26 23:44:17 UTC 2018


Hi Alex,


On 3/26/18 16:36, Alex Menkov wrote:
> Hi Serguei,
>
> updated webrev:
> http://cr.openjdk.java.net/~amenkov/retransformClassesZeroLength/webrev.02/ 
>
>
> - updated copyright in th eInstrumentationImpl.java
> - removed inused imports in the test

Thank you for the update!


> On 03/26/2018 14:31, serguei.spitsyn at oracle.com wrote:
>> Hi Alex,
>>
>> It looks good to me.
>>
>> A couple of questions:
>>
>>   - How does the test fail with the unfixed code?
>
> As described in the jira issue:
>  stdout: [FATAL ERROR in native method: processing of -javaagent failed
> ];
>  stderr: [java.lang.reflect.InvocationTargetException
>         at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>         at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>         at 
> java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
>         at 
> java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
> Caused by: java.lang.NullPointerException
>         at 
> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native 
> Method)
>         at 
> java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
>         at 
> RetransformClassesZeroLength$Agent.premain(RetransformClassesZeroLength.java:77)
>         ... 6 more
> *** java.lang.instrument ASSERTION FAILED ***: "numClasses != 0" at 
> line: 1146

Great.

Reviewed.

Thanks,
Serguei

>
> --alex
>
>>
>>   - It seems, the following imports in the test are not needed:
>>
>>    34 import java.io.IOException;
>>    . . .
>>    43 import java.util.Arrays;
>>    . . .
>>    45 import jdk.test.lib.Utils;
>>    46 import jdk.test.lib.process.ExitCode;
>>    47 import jdk.test.lib.process.OutputAnalyzer;
>>
>> Thanks,
>> Serguei
>>
>>
>> On 3/22/18 16:18, Alex Menkov wrote:
>>> Hi all,
>>>
>>> Please take a look at a simple fix for
>>> https://bugs.openjdk.java.net/browse/JDK-8198393
>>> webrev: 
>>> http://cr.openjdk.java.net/~amenkov/retransformClassesZeroLength/webrev/ 
>>>
>>>
>>> --alex
>>



More information about the serviceability-dev mailing list