The ColorModel.getRGBdefault() method is not thread-safe

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 17, 21
    • Component/s: client-libs
    • None
    • 2d
    • b06
    • generic
    • generic

      The next implementation of ColorModel.getRGBdefault() is not thread-safe:

          private static ColorModel RGBdefault;

          public static ColorModel getRGBdefault() {
              if (RGBdefault == null) {
                  RGBdefault = new DirectColorModel(32,
                                                    0x00ff0000, // Red
                                                    0x0000ff00, // Green
                                                    0x000000ff, // Blue
                                                    0xff000000 // Alpha
                                                    );
              }
              return RGBdefault;
          }

            Assignee:
            Sergey Bylokhov
            Reporter:
            Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: