On Fri, 13 Nov 2026 20:35:17 GMT, Phil Race <[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).

Marked as reviewed by azvegint (Reviewer).

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.

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.

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.

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

PR Review: https://git.openjdk.org/jdk/pull/33900#pullrequestreview-5898737301
PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569512975
PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569463332
PR Review Comment: https://git.openjdk.org/jdk/pull/33900#discussion_r4569529536

Reply via email to