Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8097218

Consolidate/document handling of null values in javafx.scene.canvas.GraphicsContext

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: emb-8u6, 8u20
    • Component/s: javafx
    • Labels:

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              msladecek Martin Sládeček
              Reporter:
              ekrejcir Eva Krejčířová (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: