On Fri, 13 Nov 2026 22:44:13 GMT, Alexander Zvegintsev <[email protected]> 
wrote:

>> This  updates the test FCComposite.java to not expect the first fontconfig 
>> font to be used by JDK fonts if it is a variation font. 
>> This change can be reverted after we support variation fonts.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> test/jdk/java/awt/font/FontNames/FCCompositeTest.java line 61:
> 
>> 59:             Runtime runtime = Runtime.getRuntime();
>> 60:             Process p = runtime.exec(filecmd, null, null);
>> 61:             p.waitFor();
> 
> Calling `waitFor()` before consuming process output may cause a deadlock:
> [doc](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Process.html)
>>   Because some native platforms only provide limited buffer size for 
>> standard input and output streams, failure to promptly write the input 
>> stream or read the output stream of the process may cause the process to 
>> block, or even deadlock. 
> 
> It most likely will not happen for such a small amount of input though.

The test already does that  in the existing exec and yes, it is minimal so I 
don't think it is a problem.

> test/jdk/java/awt/font/FontNames/FCCompositeTest.java line 67:
> 
>> 65:             br.close();
>> 66:             String[] list = fileline.split("=|,", 0);
>> 67:             String filename = list[1];
> 
> Minor: we can use the `String[] filecmd = {"fc-match", "-f", "%{file}", 
> name};` to get just the filename without a need of additional parsing.

Again I was following a similar pre-existing pattern and it seems to work well 
so I'd prefer to keep it.

> test/jdk/java/awt/font/FontNames/FCCompositeTest.java line 83:
> 
>> 81:             br.close();
>> 82:         } catch (Exception e) {
>> 83:              return true;
> 
> I am assuming that returning `true` on any exception is intentional to skip 
> the test when the font type cannot be determined.
> 
> However, this way it can silently hide unexpected failures, so it might be 
> worth adding some diagnostic output to make it easier to investigate later.
> 
> Process exit codes and stderr are not checked, so failures of `fc-match` or 
> `fc-query` may be unnoticed.

That's why I have print statements of each file found and each string returned 
from fc-query

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569761227
PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569775803
PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569781481

Reply via email to