`TextLayout` should deal more gracefully with zero length strings. Currently 
the exception listed below is the one that is thrown.

`new TextLayout("", f, new FontRenderContext(null, false, false));`

> Exception in thread "main" java.lang.IllegalArgumentException: Zero length
> string passed to TextLayout constructor.
> at java.lang.Throwable.<init>(Compiled Code)
> at java.lang.Exception.<init>(Compiled Code)
> at java.lang.RuntimeException.<init>(Compiled Code)
> at java.lang.IllegalArgumentException.<init>(Compiled Code)
> at java.awt.font.TextLayout.<init>(Compiled Code)
> at test.main(Compiled Code)

**REVIEWER NOTE:** Please check the empty-string `TextLayout` behavior 
documented in `TextLayoutConstructorTest` carefully; a badly-behaving empty 
`TextLayout` is probably worse than a `TextLayout` which doesn't allow empty 
strings...

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

Commit messages:
 - Use more general leading expectations
 - Allow TextLayout to handle empty strings

Changes: https://git.openjdk.org/jdk/pull/26947/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26947&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-4138921
  Stats: 368 lines in 4 files changed: 339 ins; 6 del; 23 mod
  Patch: https://git.openjdk.org/jdk/pull/26947.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26947/head:pull/26947

PR: https://git.openjdk.org/jdk/pull/26947

Reply via email to