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

Thread unsafe code in java_beans classes.

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.6
    • Not verified


      allan.jacobs@Eng 1998-03-24

      Only the static variables that are set and used in thread-unsafe
      methods are listed. Only methods that are thread-unsafe are listed.
      The code review was done on JDK 1.2 build L sources.

      Sometimes a method is not listed because it is called from a thread
      unsafe method and the fix is in the caller. An example of this is
      in java/awt/swing/BasicButtonUI.java for the variable listener.
      It is set and used in createListener. But createListener is called
      from installUI. Here is the source code for installUI:
          public void installUI(JComponent c) {
            if (c.getFont() == null || c.getFont() instanceof UIResource)
          c.setFont(UIManager.getFont("Label.font"));

            listener = createListener(c);
            listener.setupKeyboard((AbstractButton) c);
            c.addMouseListener(listener);
            c.addMouseMotionListener(listener);
            c.addFocusListener(listener);
            ((AbstractButton)c).addChangeListener(listener);
            BasicLookAndFeel.installBorder(c,"Button.border");
          }
      If installUI were fixed, no synchronization is necessary in
      createListener(JComponent).
          public void installUI(JComponent c) {
            if (c.getFont() == null || c.getFont() instanceof UIResource)
                c.setFont(UIManager.getFont("Label.font"));
            synchronized (this) {
              listener = createListener(c);
              listener.setupKeyboard((AbstractButton) c);
              c.addMouseListener(listener);
              c.addMouseMotionListener(listener);
              c.addFocusListener(listener);
              ((AbstractButton)c).addChangeListener(listener);
            }
            BasicLookAndFeel.installBorder(c,"Button.border");
          }

      /**********************************************************************/
      java/beans/Beans.java
      Variable: designTime
         Methods: isDesignTime(),setDesignTime(boolean)

      /**********************************************************************/
      java/beans/Introspector.java
      Variable: searchPath
         Methods: getBeanInfoSearchPath(),setBeanInfoSearchPath(String),
                  findInformant(Class)

      /**********************************************************************/
      java/beans/PropertyEditorManager.java
      Variable: searchPath
         Methods: getEditorSearchPath(),setEditorSearchPath(String),
                  findEditor(Class),load(Class,String)
      Variable: registry
         Methods: registerEditor(Class,Class),findEditor(Class),
                  load(Class,String)

            ghamiltosunw Graham Hamilton (Inactive)
            ajacobssunw Allan Jacobs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: