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, [email protected] 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



Reply via email to