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

BorderFactory.createBevelBorder and createSoftBevelBorder throws NPE for null highlight and shadow

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • client-libs
    • None
    • binary
    • minimal
    • Gracefully avoid NullPointerException and create BevelBorder from valid type param
    • Java API
    • SE

      Summary

      BorderFactory.createBevelBorder and BorderFactory.createSoftBevelBorder should not throw NullPointerException when null value is passed as highlight color and shadow color

      Problem

      BorderFactory.createBevelBorder and BorderFactory.createSoftBevelBorder throws NullPointerException when null value is passed as highlight color and shadow color

      Solution

      BorderFactory.createBevelBorder and BorderFactory.createSoftBevelBorder should fallback to create BevelBorder and SoftBevelBorder from type field if passed highlight and shadow color is null

      Specification

      javax.swing.BorderFactory

           * Creates a beveled border of the specified type, using
            * the specified highlighting and shadowing. The outer
            * edge of the highlighted area uses a brighter shade of
            * the highlight color. The inner edge of the shadow area
            * uses a brighter shade of the shadow color.
      +     * If highlight and shadow color are null, then it will
      +     * fallback to create beveled border of the specified type.
            *
      public static Border createBevelBorder(int type, Color highlight, Color shadow)
      
      
            * The outer edge of the highlight area uses
            * a brighter shade of the {@code highlight} color.
            * The inner edge of the shadow area uses
            * a brighter shade of the {@code shadow} color.
      +     * If highlight and shadow color are null, then it will
      +     * fallback to create beveled border of the specified type with softened corners.
            *
      public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {

            psadhukhan Prasanta Sadhukhan
            psadhukhan Prasanta Sadhukhan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: