RFR: Fix NullPointerException on a parallel run [v3]
Dmitry Bessonov
dbessono at openjdk.org
Thu Sep 1 00:49:29 UTC 2022
On Thu, 1 Sep 2022 00:44:22 GMT, Dmitry Bessonov <dbessono at openjdk.org> wrote:
>> src/com/sun/javatest/TRT_TreeNode.java line 808:
>>
>>> 806: String path = TestResultTable.getRootRelativePath(this);
>>> 807: processFile(new File( "".equals(path) // Zero length string if the node is a root
>>> 808: ? filesToScan[i] : (path + File.separator + filesToScan[i]) ));
>>
>> Pretty ugly code, containing a complex expression inside the `new File`, and even path string computation instead of using a better `File` constructor.
>>
>> I suggest something like:
>>
>>
>> processFile(path.isEmpty() // Zero length string if the node is a root
>> ? new File(filesToScan[i])
>> : new File(path, filesToScan[i]));
>
> What if `path` is null ?
Also, it might be better not to pull in an additional constructor that was not used before, but rather maximally stick with the existing code and APi calls it does
-------------
PR: https://git.openjdk.org/jtharness/pull/35
More information about the jtharness-dev
mailing list