On Thu, 14 Oct 2021 17:45:40 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> This PR fixes a bug where the blend mode will be falsely recognized as a 
>> color and therefore won't be set. 
>> Also a ClassCastException is thrown (The converter expects a String, but 
>> gets a Color).
>> 
>> Note: There is another similar bug but I can't reproduce it (Tried with 
>> 18-ea+3).
>> https://bugs.openjdk.java.net/browse/JDK-8268657
>> It also looks different so I don't think this PR fixes this, if it is still 
>> there.
>
> modules/javafx.graphics/src/main/java/javafx/css/CssParser.java line 822:
> 
>> 820:             int ttype = root.token.getType();
>> 821: 
>> 822:             if (ttype != CssLexer.STRING && ttype != CssLexer.IDENT || 
>> str == null || str.isEmpty()) {
> 
> Why did you modify this code? It looks conceptually identical to the 
> previous, but without a check for `root.token == null`. As it is, you will 
> need to prove that `root.token` can never be `null` (I suspect it cannot be, 
> but since `root` is an instance variable you will need to prove that no call 
> earlier in this method can change it as a side effect). I recommend either 
> restoring the previous logic to minimize the diffs of your fix, or else 
> adding a check for `token == null`.

Right, I removed it because it is checked on top of this method (Line 705), and 
this allowed to tidy the code a bit as this big if condition is quite 
confusing. But since I will readd the null check, it's probably the best to 
restore the behaviour.

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

PR: https://git.openjdk.java.net/jfx/pull/640

Reply via email to