RFR(M) 8240990: convert clhsdb "dumpclass" command from javascript to java

Chris Plummer chris.plummer at oracle.com
Thu Apr 9 03:06:02 UTC 2020


Ok. Thanks for the review!

Chris

On 4/8/20 8:04 PM, Yasumasa Suenaga wrote:
> Yeah, it looks good!
> I think this change is more safely.
>
>
> Thanks,
>
> Yasumasa
>
>
> On 2020/04/09 11:57, Chris Plummer wrote:
>> Like this?
>>
>>                  /* Dump the class file. */
>>                  try {
>>                      int index = 
>> fileName.lastIndexOf(File.separatorChar);
>>                      File dir = new File(fileName.substring(0, index));
>>                      dir.mkdirs();
>>                      try (FileOutputStream fos = new 
>> FileOutputStream(file)) {
>>                          ClassWriter cw = new ClassWriter(ik, fos);
>>                          cw.write();
>>                      }
>>                  } catch (Exception e) {
>>                      err.println("Error: " + e);
>>                      if (verboseExceptions) {
>>                          e.printStackTrace(err);
>>                      }
>>                  }
>>
>> Chris
>>
>> On 4/8/20 7:39 PM, Yasumasa Suenaga wrote:
>>> Hi Chris,
>>>
>>> CommandProcessor.java
>>>
>>> 1751                 /* Dump the class file. */
>>> 1752                 try {
>>> 1753                     int index = 
>>> fileName.lastIndexOf(File.separatorChar);
>>> 1754                     File dir = new File(fileName.substring(0, 
>>> index));
>>> 1755                     dir.mkdirs();
>>> 1756                     FileOutputStream fos = new 
>>> FileOutputStream(file);
>>> 1757                     ClassWriter cw = new ClassWriter(ik, fos);
>>> 1758                     cw.write();
>>> 1759                     fos.close();
>>> 1760                 } catch (Exception e) {
>>> 1761                     err.println("Error: " + e);
>>> 1762                     if (verboseExceptions) {
>>> 1763                         e.printStackTrace(err);
>>> 1764                     }
>>> 1765                 }
>>>
>>> Can you use try-with-resources for `fos`?
>>>
>>>
>>> Thanks,
>>>
>>> Yasumasa
>>>
>>>
>>> On 2020/04/09 11:08, Chris Plummer wrote:
>>>> Thanks Serguei,
>>>>
>>>> Can I get one more review please?
>>>>
>>>> thanks,
>>>>
>>>> Chris
>>>>
>>>> On 4/7/20 10:19 PM, serguei.spitsyn at oracle.com wrote:
>>>>> Hi Chris,
>>>>>
>>>>> It looks good to me.
>>>>>
>>>>> Thanks,
>>>>> Serguei
>>>>>
>>>>> On 4/7/20 20:12, Chris Plummer wrote:
>>>>>> Hello,
>>>>>>
>>>>>> Please review the following:
>>>>>>
>>>>>> https://bugs.openjdk.java.net/browse/JDK-8240990
>>>>>> http://cr.openjdk.java.net/~cjplummer/8240990/webrev.00
>>>>>>
>>>>>> The javascript code was just a few lines like other recent 
>>>>>> commands, but it had quite a bit of support on the java side in 
>>>>>> JSJavaScriptEngine.dumpClass(), which needed some massaging when 
>>>>>> moved to CommandProcessor.java. The CR contains the javascript 
>>>>>> and java code that was converted.
>>>>>>
>>>>>> thanks,
>>>>>>
>>>>>> Chris
>>>>>
>>>>
>>



More information about the serviceability-dev mailing list