Incorrect double-checked locking in com.sun.beans.introspect.ClassInfo

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • 20
    • Affects Version/s: 11, 17, 18, 19, 20
    • Component/s: client-libs
    • None

      There are 3 incorrect double-checked locking cases in ClassInfo:
          private List<Method> methods;
          private Map<String,PropertyInfo> properties;
          private Map<String,EventSetInfo> eventSets;

      For example:

          public List<Method> getMethods() {
              if (this.methods == null) {
                  synchronized (this.mutex) {
                      if (this.methods == null) {
                          this.methods = MethodInfo.get(this.type);
                      }
                  }
              }
              return this.methods;
          }

      'methods' is not volatile and read multiple times. This makes it an incorrect DCL.

            Assignee:
            Andrey Turbanov
            Reporter:
            Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: