Details
-
Bug
-
Resolution: Fixed
-
P4
-
8
Description
While fixing RT-26547 I went through the canvas code and noticed that it throws NPE when setting null values for some enums (lineCap, lineJoin, textAlign, textBaseline) and allows null in other cases (fillRule, globalBlendMode).
In the rest of the scenegraph we take following approach:
* in setters of properties we just use default value if the value given by user is null (because of the binding)
* in other methods (setters for values which are not properties, etc.). we throw NPE
Since the values mentioned here are not properties, I think that throwing NPE might be OK here, and just should be documented. On the other way, setting their counterparts in scenegraph doesn't throw NPE (and also setting fillRule and gobalBlendMode to NULL doesn't), so the different behavior might be confusing for the user...
Furthermore, canvas throws NPE when setting null values for fill/stroke. In shapes package, null values are OK for fill/stroke, I am not sure whether the canvas should not behave the same. Also, default values of fill/stroke should be documented.
In the rest of the scenegraph we take following approach:
* in setters of properties we just use default value if the value given by user is null (because of the binding)
* in other methods (setters for values which are not properties, etc.). we throw NPE
Since the values mentioned here are not properties, I think that throwing NPE might be OK here, and just should be documented. On the other way, setting their counterparts in scenegraph doesn't throw NPE (and also setting fillRule and gobalBlendMode to NULL doesn't), so the different behavior might be confusing for the user...
Furthermore, canvas throws NPE when setting null values for fill/stroke. In shapes package, null values are OK for fill/stroke, I am not sure whether the canvas should not behave the same. Also, default values of fill/stroke should be documented.
Attachments
Issue Links
- relates to
-
JDK-8095947 [Canvas] FX Canvas node does not allow path specifications with missing initial movetos
- Resolved
-
JDK-8096486 FX Canvas does not allow missing initial moveto commands (which HTML5 Canvas allows)
- Closed